aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/PPMacroExpansion.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-08-28 22:34:47 +0000
committerJohn McCall <rjmccall@apple.com>2010-08-28 22:34:47 +0000
commit1ef8a2e7675f3d8b6e8d9963b00378086e1dcdc7 (patch)
tree4602ed23e109e4d876ce7f114409755b8c85ed2f /lib/Lex/PPMacroExpansion.cpp
parentcd05e81e2e2640a0a0097658c660afc6c8a9f4fd (diff)
Add support for Microsoft's __pragma in the preprocessor.
Patch by Francois Pichet! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112391 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PPMacroExpansion.cpp')
-rw-r--r--lib/Lex/PPMacroExpansion.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index 894dc368e4..9654104d4d 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -72,6 +72,12 @@ void Preprocessor::RegisterBuiltinMacros() {
Ident__has_builtin = RegisterBuiltinMacro(*this, "__has_builtin");
Ident__has_include = RegisterBuiltinMacro(*this, "__has_include");
Ident__has_include_next = RegisterBuiltinMacro(*this, "__has_include_next");
+
+ // Microsoft Extensions.
+ if (Features.Microsoft)
+ Ident__pragma = RegisterBuiltinMacro(*this, "__pragma");
+ else
+ Ident__pragma = 0;
}
/// isTrivialSingleTokenExpansion - Return true if MI, which has a single token
@@ -641,10 +647,12 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
IdentifierInfo *II = Tok.getIdentifierInfo();
assert(II && "Can't be a macro without id info!");
- // If this is an _Pragma directive, expand it, invoke the pragma handler, then
- // lex the token after it.
+ // If this is an _Pragma or Microsoft __pragma directive, expand it,
+ // invoke the pragma handler, then lex the token after it.
if (II == Ident_Pragma)
return Handle_Pragma(Tok);
+ else if (II == Ident__pragma) // in non-MS mode this is null
+ return HandleMicrosoft__pragma(Tok);
++NumBuiltinMacroExpanded;