summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/ms-inline-asm.c
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2013-12-03 00:48:09 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2013-12-03 00:48:09 +0000
commitfc13b8baf10f1c26857ef8eea1386850daf82f44 (patch)
tree86210147d59faf9136faa15655cf664fd8211459 /clang/test/Sema/ms-inline-asm.c
parentbe2513e143a23d5ac20a9c13fd70e0302299770a (diff)
downloadbcm5719-llvm-fc13b8baf10f1c26857ef8eea1386850daf82f44.tar.gz
bcm5719-llvm-fc13b8baf10f1c26857ef8eea1386850daf82f44.zip
MS inline asm: When LLVM called back to Clang to parse a name and do name
lookup, if parsing failed, we did not restore the lexer state properly, and eventually crashed. This change ensures that we always consume all the tokens from the new token stream we started to parse the name from inline asm. llvm-svn: 196182
Diffstat (limited to 'clang/test/Sema/ms-inline-asm.c')
-rw-r--r--clang/test/Sema/ms-inline-asm.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/Sema/ms-inline-asm.c b/clang/test/Sema/ms-inline-asm.c
index 69f234e5e9a..83b80294ff9 100644
--- a/clang/test/Sema/ms-inline-asm.c
+++ b/clang/test/Sema/ms-inline-asm.c
@@ -32,3 +32,21 @@ void f() {
mov eax, TYPE bar // expected-error {{unable to lookup expression}}
}
}
+
+void rdar15318432(void) {
+ // We used to crash on this. When LLVM called back to Clang to parse a name
+ // and do name lookup, if parsing failed, we did not restore the lexer state
+ // properly.
+
+ // expected-error@+2 {{expected identifier}}
+ __asm {
+ and ecx, ~15
+ }
+
+ int x = 0;
+ // expected-error@+3 {{expected identifier}}
+ __asm {
+ and ecx, x
+ and ecx, ~15
+ }
+}
OpenPOWER on IntegriCloud