mirror of https://github.com/microsoft/clang.git
PR10392: "#pragma GCC visibility" must not expand macros in its
arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135552 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
67268d0238
commit
e23af2a86e
|
@ -38,7 +38,7 @@ void PragmaGCCVisibilityHandler::HandlePragma(Preprocessor &PP,
|
|||
SourceLocation VisLoc = VisTok.getLocation();
|
||||
|
||||
Token Tok;
|
||||
PP.Lex(Tok);
|
||||
PP.LexUnexpandedToken(Tok);
|
||||
|
||||
const IdentifierInfo *PushPop = Tok.getIdentifierInfo();
|
||||
|
||||
|
@ -49,20 +49,20 @@ void PragmaGCCVisibilityHandler::HandlePragma(Preprocessor &PP,
|
|||
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 @@ void PragmaGCCVisibilityHandler::HandlePragma(Preprocessor &PP,
|
|||
<< "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";
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue