[MC/AsmParser] Avoid setting MCSymbol.IsUsed in some cases
authorVedant Kumar <vsk@apple.com>
Mon, 31 Aug 2015 17:44:53 +0000 (17:44 +0000)
committerVedant Kumar <vsk@apple.com>
Mon, 31 Aug 2015 17:44:53 +0000 (17:44 +0000)
commitae65a7a88e8cf63c9ad01e1483181cb7e7bf6f55
treeddbb30d9881b4ef1526bc782a1a1544dce7da182
parent6997c3ae842fac2c3ae97bed5ea28d1021b04e18
[MC/AsmParser] Avoid setting MCSymbol.IsUsed in some cases

Avoid marking some MCSymbols as used in MC/AsmParser.cpp when no uses
exist. This fixes a bug in parseAssignmentExpression() which
inadvertently sets IsUsed, thereby triggering:

    "invalid re-assignment of non-absolute variable"

on otherwise valid code. No other functionality change intended.

The original version of this patch touched many calls to MCSymbol
accessors. On rafael's advice, I have stripped this patch down a bit.

As a follow-up, I intend to find the call sites which intentionally set
IsUsed and force them to do so explicitly.

Differential Revision: http://reviews.llvm.org/D12347

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246457 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/MC/MCSymbol.h
lib/MC/MCParser/AsmParser.cpp
test/MC/AsmParser/reassign.s [new file with mode: 0644]