summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPDirectives.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-22 21:12:57 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-22 21:12:57 +0000
commiteb663daeff8f6c30454b754a244ec8dc24ad4eda (patch)
tree69899c7112d88032ad63e80a1127f9906c00b6e5 /clang/lib/Lex/PPDirectives.cpp
parent4f32da1ef5a720426c22a5aa4f17deea2ad85de4 (diff)
downloadbcm5719-llvm-eb663daeff8f6c30454b754a244ec8dc24ad4eda.tar.gz
bcm5719-llvm-eb663daeff8f6c30454b754a244ec8dc24ad4eda.zip
[PCH/Modules] De/Serialize MacroInfos separately than MacroDirectives.
-Serialize the macro directives history into its own section -Get rid of the macro updates section -When de/serializing an identifier from a module, associate only one macro per submodule that defined+exported it. llvm-svn: 177761
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r--clang/lib/Lex/PPDirectives.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 163dbf413e6..7020da39403 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -1119,23 +1119,26 @@ void Preprocessor::HandleMacroPublicDirective(Token &Tok) {
// Check to see if this is the last token on the #__public_macro line.
CheckEndOfDirective("__public_macro");
+ IdentifierInfo *II = MacroNameTok.getIdentifierInfo();
// Okay, we finally have a valid identifier to undef.
- MacroDirective *MD = getMacroDirective(MacroNameTok.getIdentifierInfo());
+ MacroDirective *MD = getMacroDirective(II);
// If the macro is not defined, this is an error.
if (MD == 0) {
- Diag(MacroNameTok, diag::err_pp_visibility_non_macro)
- << MacroNameTok.getIdentifierInfo();
+ Diag(MacroNameTok, diag::err_pp_visibility_non_macro) << II;
return;
}
// Note that this macro has now been exported.
MD->setVisibility(/*IsPublic=*/true, MacroNameTok.getLocation());
- // If this macro definition came from a PCH file, mark it
- // as having changed since serialization.
- if (MD->isImported())
+ // If this macro directive came from a PCH file, mark it as having changed
+ // since serialization.
+ if (MD->isFromPCH()) {
MD->setChangedAfterLoad();
+ assert(II->isFromAST());
+ II->setChangedSinceDeserialization();
+ }
}
/// \brief Handle a #private directive.
@@ -1150,23 +1153,26 @@ void Preprocessor::HandleMacroPrivateDirective(Token &Tok) {
// Check to see if this is the last token on the #__private_macro line.
CheckEndOfDirective("__private_macro");
+ IdentifierInfo *II = MacroNameTok.getIdentifierInfo();
// Okay, we finally have a valid identifier to undef.
- MacroDirective *MD = getMacroDirective(MacroNameTok.getIdentifierInfo());
+ MacroDirective *MD = getMacroDirective(II);
// If the macro is not defined, this is an error.
if (MD == 0) {
- Diag(MacroNameTok, diag::err_pp_visibility_non_macro)
- << MacroNameTok.getIdentifierInfo();
+ Diag(MacroNameTok, diag::err_pp_visibility_non_macro) << II;
return;
}
// Note that this macro has now been marked private.
MD->setVisibility(/*IsPublic=*/false, MacroNameTok.getLocation());
- // If this macro definition came from a PCH file, mark it
- // as having changed since serialization.
- if (MD->isImported())
+ // If this macro directive came from a PCH file, mark it as having changed
+ // since serialization.
+ if (MD->isFromPCH()) {
MD->setChangedAfterLoad();
+ assert(II->isFromAST());
+ II->setChangedSinceDeserialization();
+ }
}
//===----------------------------------------------------------------------===//
@@ -2011,7 +2017,7 @@ void Preprocessor::HandleUndefDirective(Token &UndefTok) {
void Preprocessor::UndefineMacro(IdentifierInfo *II, MacroDirective *MD,
SourceLocation UndefLoc) {
MD->setUndefLoc(UndefLoc);
- if (MD->isImported()) {
+ if (MD->isFromPCH()) {
MD->setChangedAfterLoad();
if (Listener)
Listener->UndefinedMacro(MD);
OpenPOWER on IntegriCloud