aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/PCHReader.cpp
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2010-02-12 00:07:30 +0000
committerTanya Lattner <tonic@nondot.org>2010-02-12 00:07:30 +0000
commite6bbc01d1c4ec5241df36042e0a4a12a6711934b (patch)
tree97449252d5f834f0ebcea16bffd552b83242330a /lib/Frontend/PCHReader.cpp
parentb84412f587bc9f2f90930cc1c63ba10cb833bd4e (diff)
Implementing unused function warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95940 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHReader.cpp')
-rw-r--r--lib/Frontend/PCHReader.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 2a22132ea8..f6f4a78c13 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -1332,6 +1332,14 @@ PCHReader::ReadPCHBlock() {
TentativeDefinitions.swap(Record);
break;
+ case pch::UNUSED_STATIC_FUNCS:
+ if (!UnusedStaticFuncs.empty()) {
+ Error("duplicate UNUSED_STATIC_FUNCS record in PCH file");
+ return Failure;
+ }
+ UnusedStaticFuncs.swap(Record);
+ break;
+
case pch::LOCALLY_SCOPED_EXTERNAL_DECLS:
if (!LocallyScopedExternalDecls.empty()) {
Error("duplicate LOCALLY_SCOPED_EXTERNAL_DECLS record in PCH file");
@@ -2479,6 +2487,13 @@ void PCHReader::InitializeSema(Sema &S) {
VarDecl *Var = cast<VarDecl>(GetDecl(TentativeDefinitions[I]));
SemaObj->TentativeDefinitions.push_back(Var);
}
+
+ // If there were any unused static functions, deserialize them and add to
+ // Sema's list of unused static functions.
+ for (unsigned I = 0, N = UnusedStaticFuncs.size(); I != N; ++I) {
+ FunctionDecl *FD = cast<FunctionDecl>(GetDecl(UnusedStaticFuncs[I]));
+ SemaObj->UnusedStaticFuncs.push_back(FD);
+ }
// If there were any locally-scoped external declarations,
// deserialize them and add them to Sema's table of locally-scoped