From 90073804fb1cf6e6273bce41ecaaa9e1a0c33b8f Mon Sep 17 00:00:00 2001 From: Tanya Lattner Date: Fri, 12 Feb 2010 00:07:30 +0000 Subject: Implementing unused function warning. llvm-svn: 95940 --- clang/lib/Frontend/PCHReader.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'clang/lib/Frontend/PCHReader.cpp') diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp index 2a22132ea84..f6f4a78c13e 100644 --- a/clang/lib/Frontend/PCHReader.cpp +++ b/clang/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(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(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 -- cgit v1.2.3