Author: steven_wu Date: Tue Apr 28 16:49:09 2015 New Revision: 236044 URL: http://llvm.org/viewvc/llvm-project?rev=236044&view=rev Log: Fix -fno-gnu-inline-asm doesn't catch file scope asm
Summary: FileScopeAsm should be treated the same as funcion level inline asm. -fno-gnu-inline-asm should trigger an error if file scope asm is used. I missed this case from r226340. This should not affect ms-extension because it is not allowed in the file scope. Reviewers: bob.wilson, rnk Reviewed By: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9328 Modified: cfe/trunk/lib/Parse/Parser.cpp cfe/trunk/test/Parser/no-gnu-inline-asm.c Modified: cfe/trunk/lib/Parse/Parser.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=236044&r1=236043&r2=236044&view=diff ============================================================================== --- cfe/trunk/lib/Parse/Parser.cpp (original) +++ cfe/trunk/lib/Parse/Parser.cpp Tue Apr 28 16:49:09 2015 @@ -1253,6 +1253,10 @@ ExprResult Parser::ParseSimpleAsm(Source assert(Tok.is(tok::kw_asm) && "Not an asm!"); SourceLocation Loc = ConsumeToken(); + // Check if GNU-styple InlineAsm is disabled. + if (!getLangOpts().GNUAsm) + Diag(Loc, diag::err_gnu_inline_asm_disabled); + if (Tok.is(tok::kw_volatile)) { // Remove from the end of 'asm' to the end of 'volatile'. SourceRange RemovalRange(PP.getLocForEndOfToken(Loc), Modified: cfe/trunk/test/Parser/no-gnu-inline-asm.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/no-gnu-inline-asm.c?rev=236044&r1=236043&r2=236044&view=diff ============================================================================== --- cfe/trunk/test/Parser/no-gnu-inline-asm.c (original) +++ cfe/trunk/test/Parser/no-gnu-inline-asm.c Tue Apr 28 16:49:09 2015 @@ -1,5 +1,6 @@ // RUN: %clang_cc1 %s -triple i686-apple-darwin -verify -fsyntax-only -fno-gnu-inline-asm +asm ("INST r1, 0"); // expected-error {{GNU-style inline assembly is disabled}} void f (void) { long long foo = 0, bar; asm volatile("INST %0, %1" : "=r"(foo) : "r"(bar)); // expected-error {{GNU-style inline assembly is disabled}} _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
