[cfe-commits] r135552 - in /cfe/trunk: lib/Parse/ParsePragma.cpp test/Parser/pragma-visibility2.c
Joerg Sonnenberger
joerg at bec.de
Tue Jul 19 18:03:50 PDT 2011
Author: joerg
Date: Tue Jul 19 20:03:50 2011
New Revision: 135552
URL: http://llvm.org/viewvc/llvm-project?rev=135552&view=rev
Log:
PR10392: "#pragma GCC visibility" must not expand macros in its
arguments.
Added:
cfe/trunk/test/Parser/pragma-visibility2.c
Modified:
cfe/trunk/lib/Parse/ParsePragma.cpp
Modified: cfe/trunk/lib/Parse/ParsePragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=135552&r1=135551&r2=135552&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParsePragma.cpp (original)
+++ cfe/trunk/lib/Parse/ParsePragma.cpp Tue Jul 19 20:03:50 2011
@@ -38,7 +38,7 @@
SourceLocation VisLoc = VisTok.getLocation();
Token Tok;
- PP.Lex(Tok);
+ PP.LexUnexpandedToken(Tok);
const IdentifierInfo *PushPop = Tok.getIdentifierInfo();
@@ -49,20 +49,20 @@
VisType = 0;
} else if (PushPop && PushPop->isStr("push")) {
IsPush = true;
- PP.Lex(Tok);
+ PP.LexUnexpandedToken(Tok);
if (Tok.isNot(tok::l_paren)) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_lparen)
<< "visibility";
return;
}
- PP.Lex(Tok);
+ PP.LexUnexpandedToken(Tok);
VisType = Tok.getIdentifierInfo();
if (!VisType) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_identifier)
<< "visibility";
return;
}
- PP.Lex(Tok);
+ PP.LexUnexpandedToken(Tok);
if (Tok.isNot(tok::r_paren)) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_rparen)
<< "visibility";
@@ -73,7 +73,7 @@
<< "visibility";
return;
}
- PP.Lex(Tok);
+ PP.LexUnexpandedToken(Tok);
if (Tok.isNot(tok::eod)) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
<< "visibility";
Added: cfe/trunk/test/Parser/pragma-visibility2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/pragma-visibility2.c?rev=135552&view=auto
==============================================================================
--- cfe/trunk/test/Parser/pragma-visibility2.c (added)
+++ cfe/trunk/test/Parser/pragma-visibility2.c Tue Jul 19 20:03:50 2011
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -emit-llvm -triple i386-linux-gnu -o %t %s
+// RUN: FileCheck --input-file=%t %s
+// PR10392
+
+#define push(foo) push(default)
+#pragma GCC visibility push(hidden)
+
+int v1;
+// CHECK: @v1 = common hidden global i32 0, align 4
+
+#pragma GCC visibility pop
+
+int v2;
+// CHECK: @v2 = common global i32 0, align 4
+
+_Pragma("GCC visibility push(hidden)");
+
+int v3;
+// CHECK: @v3 = common hidden global i32 0, align 4
More information about the cfe-commits
mailing list