From e7c1fe6ab7c1d9d26abde49dcf52b8ccc53e914c Mon Sep 17 00:00:00 2001 From: Sebastian Redl Date: Fri, 13 Aug 2010 00:28:03 +0000 Subject: 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. llvm-svn: 110989 --- clang/lib/Frontend/PCHReader.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'clang/lib/Frontend/PCHReader.cpp') diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp index 16afabbb7e4..e55605b2743 100644 --- a/clang/lib/Frontend/PCHReader.cpp +++ b/clang/lib/Frontend/PCHReader.cpp @@ -1774,6 +1774,17 @@ PCHReader::ReadPCHBlock(PerFileData &F) { F.NumPreallocatedPreprocessingEntities = Record[0]; F.LocalNumMacroDefinitions = Record[1]; break; + + case pch::DECL_REPLACEMENTS: { + if (Record.size() % 2 != 0) { + Error("invalid DECL_REPLACEMENTS block in PCH file"); + return Failure; + } + for (unsigned I = 0, N = Record.size(); I != N; I += 2) + ReplacedDecls[static_cast(Record[I])] = + std::make_pair(&F, Record[I+1]); + break; + } } First = false; } -- cgit v1.2.3