aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-01-03 18:24:14 +0000
committerDouglas Gregor <dgregor@apple.com>2012-01-03 18:24:14 +0000
commit94ad28b31433058445a27db722f60402ee820bea (patch)
tree9c60fe2e61231fcf462546f6c922aef0f9f5ff1f /lib/Lex
parent5948ae1021122164b22f74353bb7fe325a64f616 (diff)
Under -fmodules, accept #public <macroname> and #private <macroname>
to make a macro public (the default for headers) or private, respectively. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147455 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex')
-rw-r--r--lib/Lex/PPDirectives.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp
index 2dfae872e2..04d92b8a29 100644
--- a/lib/Lex/PPDirectives.cpp
+++ b/lib/Lex/PPDirectives.cpp
@@ -682,10 +682,15 @@ TryAgain:
//isExtension = true; // FIXME: implement #unassert
break;
- case tok::pp___export_macro__:
- return HandleMacroExportDirective(Result);
- case tok::pp___private_macro__:
- return HandleMacroPrivateDirective(Result);
+ case tok::pp_public:
+ if (getLangOptions().Modules)
+ return HandleMacroPublicDirective(Result);
+ break;
+
+ case tok::pp_private:
+ if (getLangOptions().Modules)
+ return HandleMacroPrivateDirective(Result);
+ break;
}
break;
}
@@ -1038,8 +1043,8 @@ void Preprocessor::HandleIdentSCCSDirective(Token &Tok) {
}
}
-/// \brief Handle a #__export_macro__ directive.
-void Preprocessor::HandleMacroExportDirective(Token &Tok) {
+/// \brief Handle a #public directive.
+void Preprocessor::HandleMacroPublicDirective(Token &Tok) {
Token MacroNameTok;
ReadMacroName(MacroNameTok, 2);
@@ -1047,8 +1052,8 @@ void Preprocessor::HandleMacroExportDirective(Token &Tok) {
if (MacroNameTok.is(tok::eod))
return;
- // Check to see if this is the last token on the #__export_macro__ line.
- CheckEndOfDirective("__export_macro__");
+ // Check to see if this is the last token on the #public line.
+ CheckEndOfDirective("public");
// Okay, we finally have a valid identifier to undef.
MacroInfo *MI = getMacroInfo(MacroNameTok.getIdentifierInfo());
@@ -1069,7 +1074,7 @@ void Preprocessor::HandleMacroExportDirective(Token &Tok) {
MI->setChangedAfterLoad();
}
-/// \brief Handle a #__private_macro__ directive.
+/// \brief Handle a #private directive.
void Preprocessor::HandleMacroPrivateDirective(Token &Tok) {
Token MacroNameTok;
ReadMacroName(MacroNameTok, 2);
@@ -1078,8 +1083,8 @@ void Preprocessor::HandleMacroPrivateDirective(Token &Tok) {
if (MacroNameTok.is(tok::eod))
return;
- // Check to see if this is the last token on the #__private_macro__ line.
- CheckEndOfDirective("__private_macro__");
+ // Check to see if this is the last token on the #private line.
+ CheckEndOfDirective("private");
// Okay, we finally have a valid identifier to undef.
MacroInfo *MI = getMacroInfo(MacroNameTok.getIdentifierInfo());