diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-08-13 00:28:03 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-08-13 00:28:03 +0000 |
commit | 0b17c61e8f143901ce11b4a6e5129ac63aaeee04 (patch) | |
tree | b9b1cfd1fc9c8bbdcf8c5ddc456e0811f3d62dd6 /lib/Frontend/PCHReaderDecl.cpp | |
parent | 8404f670f5bda1efb60076c701613b86b576533d (diff) |
Instead of modifying the ObjC AST to not modify existing declarations, teach chained PCH to overwrite declarations from earlier PCH files in dependent ones. Tell Sema to note when it changes AST nodes so that they have to be reserialized. Finally, the ObjCProtocolDecls created in forward decls, like the ObjCInterfaceDecls in @class forward decls, are not lexically part of the decl context; only the definition is.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110989 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHReaderDecl.cpp')
-rw-r--r-- | lib/Frontend/PCHReaderDecl.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp index 212eaa1332..aa5ce7aad6 100644 --- a/lib/Frontend/PCHReaderDecl.cpp +++ b/lib/Frontend/PCHReaderDecl.cpp @@ -1307,7 +1307,13 @@ static bool isConsumerInterestedIn(Decl *D) { } /// \brief Get the correct cursor and offset for loading a type. -PCHReader::RecordLocation PCHReader::DeclCursorForIndex(unsigned Index) { +PCHReader::RecordLocation +PCHReader::DeclCursorForIndex(unsigned Index, pch::DeclID ID) { + // See if there's an override. + DeclReplacementMap::iterator It = ReplacedDecls.find(ID); + if (It != ReplacedDecls.end()) + return RecordLocation(&It->second.first->DeclsCursor, It->second.second); + PerFileData *F = 0; for (unsigned I = 0, N = Chain.size(); I != N; ++I) { F = Chain[N - I - 1]; @@ -1321,7 +1327,7 @@ PCHReader::RecordLocation PCHReader::DeclCursorForIndex(unsigned Index) { /// \brief Read the declaration at the given offset from the PCH file. Decl *PCHReader::ReadDeclRecord(unsigned Index, pch::DeclID ID) { - RecordLocation Loc = DeclCursorForIndex(Index); + RecordLocation Loc = DeclCursorForIndex(Index, ID); llvm::BitstreamCursor &DeclsCursor = *Loc.first; // Keep track of where we are in the stream, then jump back there // after reading this declaration. |