aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-05-27 23:32:43 +0000
committerChris Lattner <sabre@nondot.org>2008-05-27 23:32:43 +0000
commitaec3a1eb215445e63ba5702f8d6b1e0f2e8c27b9 (patch)
tree71aea4b6e67ae82c4f86f2046e9b7e909a10f531
parent915e972098f1e67c7559613ccde7205cee582e61 (diff)
Fix a couple crashes on invalid input.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51622 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Parse/Parser.cpp3
-rw-r--r--test/Parser/asm.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 936604e870..2296f57afc 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -328,6 +328,7 @@ Parser::DeclTy *Parser::ParseExternalDeclaration() {
if (!Result.isInvalid)
return Actions.ActOnFileScopeAsmDecl(Tok.getLocation(), Result.Val);
+ return 0;
}
case tok::at:
// @ is not a legal token unless objc is enabled, no need to check.
@@ -653,7 +654,7 @@ Parser::ExprResult Parser::ParseSimpleAsm() {
if (Tok.isNot(tok::l_paren)) {
Diag(Tok, diag::err_expected_lparen_after, "asm");
- return 0;
+ return true;
}
ConsumeParen();
diff --git a/test/Parser/asm.c b/test/Parser/asm.c
index 6a19acaaed..c23d31a724 100644
--- a/test/Parser/asm.c
+++ b/test/Parser/asm.c
@@ -8,3 +8,8 @@ void f2() {
asm("foo" : "=r" (a)); // expected-error {{use of undeclared identifier 'a'}}
asm("foo" : : "r" (b)); // expected-error {{use of undeclared identifier 'b'}}
}
+
+
+// rdar://5952468
+__asm ; // expected-error {{expected '(' after 'asm'}}
+