Support #pragma weak for PCH.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110323 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 2252fd4..7229775 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -1642,6 +1642,15 @@
Record.begin(), Record.end());
break;
+ case pch::WEAK_UNDECLARED_IDENTIFIERS:
+ // Optimization for the first block.
+ if (WeakUndeclaredIdentifiers.empty())
+ WeakUndeclaredIdentifiers.swap(Record);
+ else
+ WeakUndeclaredIdentifiers.insert(WeakUndeclaredIdentifiers.end(),
+ Record.begin(), Record.end());
+ break;
+
case pch::LOCALLY_SCOPED_EXTERNAL_DECLS:
// Optimization for the first block.
if (LocallyScopedExternalDecls.empty())
@@ -3131,6 +3140,21 @@
SemaObj->UnusedStaticFuncs.push_back(FD);
}
+ // If there were any weak undeclared identifiers, deserialize them and add to
+ // Sema's list of weak undeclared identifiers.
+ if (!WeakUndeclaredIdentifiers.empty()) {
+ unsigned Idx = 0;
+ for (unsigned I = 0, N = WeakUndeclaredIdentifiers[Idx++]; I != N; ++I) {
+ IdentifierInfo *WeakId = GetIdentifierInfo(WeakUndeclaredIdentifiers,Idx);
+ IdentifierInfo *AliasId=GetIdentifierInfo(WeakUndeclaredIdentifiers,Idx);
+ SourceLocation Loc = ReadSourceLocation(WeakUndeclaredIdentifiers, Idx);
+ bool Used = WeakUndeclaredIdentifiers[Idx++];
+ Sema::WeakInfo WI(AliasId, Loc);
+ WI.setUsed(Used);
+ SemaObj->WeakUndeclaredIdentifiers.insert(std::make_pair(WeakId, WI));
+ }
+ }
+
// If there were any locally-scoped external declarations,
// deserialize them and add them to Sema's table of locally-scoped
// external declarations.