summaryrefslogtreecommitdiffstats
path: root/lib/Sema/SemaStmtAsm.cpp
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan.akhgari@gmail.com>2014-10-08 17:28:34 +0000
committerEhsan Akhgari <ehsan.akhgari@gmail.com>2014-10-08 17:28:34 +0000
commitde87f96e74e19ec13556382f8e461608559ece1a (patch)
tree43f18658f38de98cda56ef03b21b8931e6731c65 /lib/Sema/SemaStmtAsm.cpp
parent1b6fd15322ca8431cd390d66c671f6ca60fbe59a (diff)
ms-inline-asm: Correctly mark MS inline ASM labels as used
Summary: This fixes PR21155. Test Plan: The patch includes a test. Reviewers: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5619 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219322 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmtAsm.cpp')
-rw-r--r--lib/Sema/SemaStmtAsm.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Sema/SemaStmtAsm.cpp b/lib/Sema/SemaStmtAsm.cpp
index 7f79a05b46..a2e436ae7e 100644
--- a/lib/Sema/SemaStmtAsm.cpp
+++ b/lib/Sema/SemaStmtAsm.cpp
@@ -561,7 +561,10 @@ LabelDecl *Sema::GetOrCreateMSAsmLabel(StringRef ExternalLabelName,
LabelDecl* Label = LookupOrCreateLabel(PP.getIdentifierInfo(ExternalLabelName),
Location);
- if (!Label->isMSAsmLabel()) {
+ if (Label->isMSAsmLabel()) {
+ // If we have previously created this label implicitly, mark it as used.
+ Label->markUsed(Context);
+ } else {
// Otherwise, insert it, but only resolve it if we have seen the label itself.
std::string InternalName;
llvm::raw_string_ostream OS(InternalName);