Re-uglify #public and #private to #__public_macro and #__private_macro.

llvm-svn: 147469
This commit is contained in:
Douglas Gregor 2012-01-03 19:48:16 +00:00
parent 3c9707bd90
commit 663b48f13b
8 changed files with 19 additions and 17 deletions

View File

@ -90,8 +90,8 @@ PPKEYWORD(assert)
PPKEYWORD(unassert)
// Clang extensions
PPKEYWORD(public)
PPKEYWORD(private)
PPKEYWORD(__public_macro)
PPKEYWORD(__private_macro)
//===----------------------------------------------------------------------===//
// Language keywords.

View File

@ -217,16 +217,18 @@ tok::PPKeywordKind IdentifierInfo::getPPKeywordID() const {
CASE( 6, 'i', 'n', ifndef);
CASE( 6, 'i', 'p', import);
CASE( 6, 'p', 'a', pragma);
CASE( 6, 'p', 'b', public);
CASE( 7, 'd', 'f', defined);
CASE( 7, 'i', 'c', include);
CASE( 7, 'p', 'i', private);
CASE( 7, 'w', 'r', warning);
CASE( 8, 'u', 'a', unassert);
CASE(12, 'i', 'c', include_next);
CASE(14, '_', 'p', __public_macro);
CASE(15, '_', 'p', __private_macro);
CASE(16, '_', 'i', __include_macros);
#undef CASE
#undef HASH

View File

@ -682,12 +682,12 @@ TryAgain:
//isExtension = true; // FIXME: implement #unassert
break;
case tok::pp_public:
case tok::pp___public_macro:
if (getLangOptions().Modules)
return HandleMacroPublicDirective(Result);
break;
case tok::pp_private:
case tok::pp___private_macro:
if (getLangOptions().Modules)
return HandleMacroPrivateDirective(Result);
break;
@ -1052,8 +1052,8 @@ void Preprocessor::HandleMacroPublicDirective(Token &Tok) {
if (MacroNameTok.is(tok::eod))
return;
// Check to see if this is the last token on the #public line.
CheckEndOfDirective("public");
// Check to see if this is the last token on the #__public_macro line.
CheckEndOfDirective("__public_macro");
// Okay, we finally have a valid identifier to undef.
MacroInfo *MI = getMacroInfo(MacroNameTok.getIdentifierInfo());
@ -1083,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 line.
CheckEndOfDirective("private");
// Check to see if this is the last token on the #__private_macro line.
CheckEndOfDirective("__private_macro");
// Okay, we finally have a valid identifier to undef.
MacroInfo *MI = getMacroInfo(MacroNameTok.getIdentifierInfo());

View File

@ -1,5 +1,5 @@
#include <Module/Module.h> //expected-warning{{treating #include as an import of module 'Module'}}
#define DEPENDS_ON_MODULE 1
#private DEPENDS_ON_MODULE
#__private_macro DEPENDS_ON_MODULE

View File

@ -1,5 +1,5 @@
#ifndef MODULE_SUBFRAMEWORK_H
#define MODULE_SUBFRAMEWORK_H
#private MODULE_SUBFRAMEWORK_H
#__private_macro MODULE_SUBFRAMEWORK_H
char *module_subframework;
#endif

View File

@ -14,7 +14,7 @@ const char *getModuleVersion(void);
@end
#define MODULE_H_MACRO 1
#private MODULE_H_MACRO
#__private_macro MODULE_H_MACRO
#include <Module/Sub.h>
#include <Module/Buried/Treasure.h>

View File

@ -3,8 +3,8 @@
#define FLOAT float
#define DOUBLE double
#public INTEGER
#private FLOAT
#private MODULE
#__public_macro INTEGER
#__private_macro FLOAT
#__private_macro MODULE
int (INTEGER);

View File

@ -22,7 +22,7 @@
double d;
DOUBLE *dp = &d;
#public WIBBLE // expected-error{{no macro named 'WIBBLE'}}
#__public_macro WIBBLE // expected-error{{no macro named 'WIBBLE'}}
void f() {
// CHECK-PREPROCESSED: int i = INTEGER;