[PATCH] D55439: [MC] Do not consider .ifdef/.ifndef as a use
Scott Linder via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 28 09:41:04 PST 2018
scott.linder updated this revision to Diff 179647.
scott.linder added a comment.
Rebase and ping
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55439/new/
https://reviews.llvm.org/D55439
Files:
lib/MC/MCParser/AsmParser.cpp
test/MC/AsmParser/ifdef.s
test/MC/AsmParser/ifndef.s
Index: test/MC/AsmParser/ifndef.s
===================================================================
--- test/MC/AsmParser/ifndef.s
+++ test/MC/AsmParser/ifndef.s
@@ -27,3 +27,13 @@
.else
.byte 0
.endif
+
+# .ifndef directive does not count as a use, so ensure redefinition is permitted
+.set var, 1
+.ifndef var
+ .set var, 2
+.else
+ .set var, 3
+.endif
+# CHECK: .byte 3
+.byte var
Index: test/MC/AsmParser/ifdef.s
===================================================================
--- test/MC/AsmParser/ifdef.s
+++ test/MC/AsmParser/ifdef.s
@@ -27,3 +27,13 @@
.else
.byte 1
.endif
+
+# .ifdef directive does not count as a use, so ensure redefinition is permitted
+.set var, 1
+.ifdef var
+ .set var, 2
+.else
+ .set var, 3
+.endif
+# CHECK: .byte 2
+.byte var
Index: lib/MC/MCParser/AsmParser.cpp
===================================================================
--- lib/MC/MCParser/AsmParser.cpp
+++ lib/MC/MCParser/AsmParser.cpp
@@ -5035,9 +5035,9 @@
MCSymbol *Sym = getContext().lookupSymbol(Name);
if (expect_defined)
- TheCondState.CondMet = (Sym && !Sym->isUndefined());
+ TheCondState.CondMet = (Sym && !Sym->isUndefined(false));
else
- TheCondState.CondMet = (!Sym || Sym->isUndefined());
+ TheCondState.CondMet = (!Sym || Sym->isUndefined(false));
TheCondState.Ignore = !TheCondState.CondMet;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55439.179647.patch
Type: text/x-patch
Size: 1368 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181228/effc41ed/attachment.bin>
More information about the llvm-commits
mailing list