[PATCH] Fix -fno-gnu-inline-asm doesn't catch file scope asm

Steven Wu stevenwu at apple.com
Tue Apr 28 14:52:35 PDT 2015


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9328

Files:
  cfe/trunk/lib/Parse/Parser.cpp
  cfe/trunk/test/Parser/no-gnu-inline-asm.c

Index: cfe/trunk/lib/Parse/Parser.cpp
===================================================================
--- cfe/trunk/lib/Parse/Parser.cpp
+++ cfe/trunk/lib/Parse/Parser.cpp
@@ -1253,6 +1253,10 @@
   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),
Index: cfe/trunk/test/Parser/no-gnu-inline-asm.c
===================================================================
--- cfe/trunk/test/Parser/no-gnu-inline-asm.c
+++ cfe/trunk/test/Parser/no-gnu-inline-asm.c
@@ -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}}

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9328.24578.patch
Type: text/x-patch
Size: 1137 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150428/413025a5/attachment.bin>


More information about the cfe-commits mailing list