[cfe-commits] r165558 - in /cfe/trunk: lib/Parse/ParseStmt.cpp test/CodeGen/pragma-weak.c

Eli Friedman eli.friedman at gmail.com
Tue Oct 9 15:46:54 PDT 2012


Author: efriedma
Date: Tue Oct  9 17:46:54 2012
New Revision: 165558

URL: http://llvm.org/viewvc/llvm-project?rev=165558&view=rev
Log:
People put pragmas in crazy places; add more handling.  PR14046.

I think our general framework for parser pragmas needs a bit more work,
but I'm not planning on working on it at the moment.


Modified:
    cfe/trunk/lib/Parse/ParseStmt.cpp
    cfe/trunk/test/CodeGen/pragma-weak.c

Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=165558&r1=165557&r2=165558&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Tue Oct  9 17:46:54 2012
@@ -254,11 +254,31 @@
     HandlePragmaPack();
     return StmtEmpty();
 
+  case tok::annot_pragma_msstruct:
+    ProhibitAttributes(Attrs);
+    HandlePragmaMSStruct();
+    return StmtEmpty();
+
   case tok::annot_pragma_align:
     ProhibitAttributes(Attrs);
     HandlePragmaAlign();
     return StmtEmpty();
 
+  case tok::annot_pragma_weak:
+    ProhibitAttributes(Attrs);
+    HandlePragmaWeak();
+    return StmtEmpty();
+
+  case tok::annot_pragma_weakalias:
+    ProhibitAttributes(Attrs);
+    HandlePragmaWeakAlias();
+    return StmtEmpty();
+
+  case tok::annot_pragma_redefine_extname:
+    ProhibitAttributes(Attrs);
+    HandlePragmaRedefineExtname();
+    return StmtEmpty();
+
   case tok::annot_pragma_fp_contract:
     ProhibitAttributes(Attrs);
     HandlePragmaFPContract();

Modified: cfe/trunk/test/CodeGen/pragma-weak.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pragma-weak.c?rev=165558&r1=165557&r2=165558&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/pragma-weak.c (original)
+++ cfe/trunk/test/CodeGen/pragma-weak.c Tue Oct  9 17:46:54 2012
@@ -157,6 +157,15 @@
 // CHECK: call void @SHA384Pad(i8* null)
 
 
+// PR14046: Parse #pragma weak in function-local context
+extern int PR14046e(void);
+void PR14046f() {
+#pragma weak PR14046e
+  PR14046e();
+}
+// CHECK: declare extern_weak i32 @PR14046e()
+
+
 ///////////// TODO: stuff that still doesn't work
 
 // due to the fact that disparate TopLevelDecls cannot affect each other





More information about the cfe-commits mailing list