]> granicus.if.org Git - clang/commitdiff
Fix a couple crashes on invalid input.
authorChris Lattner <sabre@nondot.org>
Tue, 27 May 2008 23:32:43 +0000 (23:32 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 27 May 2008 23:32:43 +0000 (23:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51622 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/Parser.cpp
test/Parser/asm.c

index 936604e870b61265d458bf9344284640f6f9e1ec..2296f57afc362da401b14436bf7ddca241651ff7 100644 (file)
@@ -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();
index 6a19acaaed643748e6925689a367cc869279036e..c23d31a7247b606b899989b236bae9d4c6e5608b 100644 (file)
@@ -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'}}
+