aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/PCHReader.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-08-05 09:48:08 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-08-05 09:48:08 +0000
commit72b90571b1783b17c3f2204cec5ca440edc38bee (patch)
treea759b482778139e091bdea82a52414247cc30db2 /lib/Frontend/PCHReader.cpp
parent3f95477f28ef3baaf79001a5654785c8b2075710 (diff)
Support #pragma weak for PCH.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110323 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHReader.cpp')
-rw-r--r--lib/Frontend/PCHReader.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 2252fd4729..7229775070 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -1642,6 +1642,15 @@ PCHReader::ReadPCHBlock(PerFileData &F) {
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 @@ void PCHReader::InitializeSema(Sema &S) {
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.