forked from OSchip/llvm-project
When we make a previously-deserialized module definition visible,
notify the AST deserialization listener so that the AST writer knows that it can write the macro definition. llvm-svn: 146994
This commit is contained in:
parent
a1745c24c4
commit
0abc262b02
|
@ -48,6 +48,9 @@ public:
|
|||
/// \brief A macro definition was read from the AST file.
|
||||
virtual void MacroDefinitionRead(serialization::PreprocessedEntityID,
|
||||
MacroDefinition *MD) { }
|
||||
/// \brief A macro definition that had previously been deserialized
|
||||
/// (and removed via IdentifierRead) has now been made visible.
|
||||
virtual void MacroVisible(IdentifierInfo *II) { }
|
||||
/// \brief A module definition was read from the AST file.
|
||||
virtual void ModuleRead(serialization::SubmoduleID ID, Module *Mod) { }
|
||||
};
|
||||
|
|
|
@ -671,6 +671,7 @@ public:
|
|||
void SelectorRead(serialization::SelectorID ID, Selector Sel);
|
||||
void MacroDefinitionRead(serialization::PreprocessedEntityID ID,
|
||||
MacroDefinition *MD);
|
||||
void MacroVisible(IdentifierInfo *II);
|
||||
void ModuleRead(serialization::SubmoduleID ID, Module *Mod);
|
||||
|
||||
// ASTMutationListener implementation.
|
||||
|
|
|
@ -2487,8 +2487,14 @@ void ASTReader::makeNamesVisible(const HiddenNames &Names) {
|
|||
for (unsigned I = 0, N = Names.size(); I != N; ++I) {
|
||||
if (Decl *D = Names[I].dyn_cast<Decl *>())
|
||||
D->ModulePrivate = false;
|
||||
else
|
||||
Names[I].get<IdentifierInfo *>()->setHasMacroDefinition(true);
|
||||
else {
|
||||
IdentifierInfo *II = Names[I].get<IdentifierInfo *>();
|
||||
if (!II->hasMacroDefinition()) {
|
||||
II->setHasMacroDefinition(true);
|
||||
if (DeserializationListener)
|
||||
DeserializationListener->MacroVisible(II);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1660,8 +1660,9 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP, bool IsModule) {
|
|||
for (Preprocessor::macro_iterator I = PP.macro_begin(Chain == 0),
|
||||
E = PP.macro_end(Chain == 0);
|
||||
I != E; ++I) {
|
||||
const IdentifierInfo *Name = I->first;
|
||||
if (!IsModule || I->second->isPublic()) {
|
||||
MacroDefinitionsSeen.insert(I->first);
|
||||
MacroDefinitionsSeen.insert(Name);
|
||||
MacrosToEmit.push_back(std::make_pair(I->first, I->second));
|
||||
}
|
||||
}
|
||||
|
@ -4262,6 +4263,10 @@ void ASTWriter::MacroDefinitionRead(serialization::PreprocessedEntityID ID,
|
|||
MacroDefinitions[MD] = ID;
|
||||
}
|
||||
|
||||
void ASTWriter::MacroVisible(IdentifierInfo *II) {
|
||||
DeserializedMacroNames.push_back(II);
|
||||
}
|
||||
|
||||
void ASTWriter::ModuleRead(serialization::SubmoduleID ID, Module *Mod) {
|
||||
assert(SubmoduleIDs.find(Mod) == SubmoduleIDs.end());
|
||||
SubmoduleIDs[Mod] = ID;
|
||||
|
|
|
@ -21,3 +21,7 @@ public:
|
|||
void push_back(const T&);
|
||||
};
|
||||
#endif
|
||||
|
||||
int ONE;
|
||||
__import_module__ redecl_merge_top.Explicit;
|
||||
const int one = ONE;
|
||||
|
|
|
@ -3,3 +3,5 @@
|
|||
int *explicit_func(void);
|
||||
|
||||
struct explicit_struct { int member; };
|
||||
|
||||
#define ONE 1
|
||||
|
|
Loading…
Reference in New Issue