summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PCHReader.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2010-08-02 18:30:12 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2010-08-02 18:30:12 +0000
commit78f5177d3700c024f642fc1d6a3e2cec452cfd30 (patch)
tree0d87df0b35a5d75581a53f2a8f24e7b8c14d42bc /clang/lib/Frontend/PCHReader.cpp
parent9d8854ec6014b3cb9db87f7a385e9000cfa3ef5b (diff)
downloadbcm5719-llvm-78f5177d3700c024f642fc1d6a3e2cec452cfd30.tar.gz
bcm5719-llvm-78f5177d3700c024f642fc1d6a3e2cec452cfd30.zip
Query only the latest version of an identifier in the PCH chain. Make sure this version holds the entire declaration chain. This is a much saner solution than trying to merge the info from all elements, and makes redeclarations work properly. Expand the declarations test case to cover more compliated cases.
llvm-svn: 110052
Diffstat (limited to 'clang/lib/Frontend/PCHReader.cpp')
-rw-r--r--clang/lib/Frontend/PCHReader.cpp23
1 files changed, 5 insertions, 18 deletions
diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp
index 0502e674a9d..d5cf75ce3ba 100644
--- a/clang/lib/Frontend/PCHReader.cpp
+++ b/clang/lib/Frontend/PCHReader.cpp
@@ -689,9 +689,6 @@ public:
uint32_t Offset = ReadUnalignedLE32(d);
Reader.ReadMacroRecord(Stream, Offset);
DataLen -= 4;
- } else if (II->hasMacroDefinition() && !Reader.isBuiltinMacro(II)) {
- // A previous part of the chain added a macro, but this part #undefed it.
- Reader.EraseMacro(II);
}
// Read all of the declarations visible at global scope with this
@@ -1389,15 +1386,6 @@ MacroDefinition *PCHReader::getMacroDefinition(pch::IdentID ID) {
return MacroDefinitionsLoaded[ID];
}
-void PCHReader::EraseMacro(IdentifierInfo *II) {
- PP->setMacroInfo(II, 0);
-}
-
-bool PCHReader::isBuiltinMacro(IdentifierInfo *II) {
- assert(II->hasMacroDefinition() && "Identifier is not a macro");
- return PP->getMacroInfo(II)->isBuiltinMacro();
-}
-
/// \brief If we are loading a relocatable PCH file, and the filename is
/// not an absolute path, add the system root to the beginning of the file
/// name.
@@ -3184,12 +3172,11 @@ void PCHReader::InitializeSema(Sema &S) {
}
IdentifierInfo* PCHReader::get(const char *NameStart, const char *NameEnd) {
- // Try to find this name within our on-disk hash tables. We need to aggregate
- // the info from all of them.
- IdentifierInfo *II = 0;
+ // Try to find this name within our on-disk hash tables. We start with the
+ // most recent one, since that one contains the most up-to-date info.
for (unsigned I = 0, N = Chain.size(); I != N; ++I) {
PCHIdentifierLookupTable *IdTable
- = (PCHIdentifierLookupTable *)Chain[N - I - 1]->IdentifierLookupTable;
+ = (PCHIdentifierLookupTable *)Chain[I]->IdentifierLookupTable;
if (!IdTable)
continue;
std::pair<const char*, unsigned> Key(NameStart, NameEnd - NameStart);
@@ -3200,9 +3187,9 @@ IdentifierInfo* PCHReader::get(const char *NameStart, const char *NameEnd) {
// Dereferencing the iterator has the effect of building the
// IdentifierInfo node and populating it with the various
// declarations it needs.
- II = *Pos;
+ return *Pos;
}
- return II;
+ return 0;
}
std::pair<ObjCMethodList, ObjCMethodList>
OpenPOWER on IntegriCloud