diff options
Diffstat (limited to 'lib/Frontend')
-rw-r--r-- | lib/Frontend/PCHReader.cpp | 20 | ||||
-rw-r--r-- | lib/Frontend/PCHWriter.cpp | 33 |
2 files changed, 26 insertions, 27 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index 137c2d768e..9491770797 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -1637,13 +1637,13 @@ PCHReader::ReadPCHBlock(PerFileData &F) { Record.begin(), Record.end()); break; - case pch::UNUSED_STATIC_FUNCS: + case pch::UNUSED_FILESCOPED_DECLS: // Optimization for the first block. - if (UnusedStaticFuncs.empty()) - UnusedStaticFuncs.swap(Record); + if (UnusedFileScopedDecls.empty()) + UnusedFileScopedDecls.swap(Record); else - UnusedStaticFuncs.insert(UnusedStaticFuncs.end(), - Record.begin(), Record.end()); + UnusedFileScopedDecls.insert(UnusedFileScopedDecls.end(), + Record.begin(), Record.end()); break; case pch::WEAK_UNDECLARED_IDENTIFIERS: @@ -3150,11 +3150,11 @@ void PCHReader::InitializeSema(Sema &S) { 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 unused file scoped decls, deserialize them and add to + // Sema's list of unused file scoped decls. + for (unsigned I = 0, N = UnusedFileScopedDecls.size(); I != N; ++I) { + DeclaratorDecl *D = cast<DeclaratorDecl>(GetDecl(UnusedFileScopedDecls[I])); + SemaObj->UnusedFileScopedDecls.push_back(D); } // If there were any weak undeclared identifiers, deserialize them and add to diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp index a86bdb9278..76fd5528dc 100644 --- a/lib/Frontend/PCHWriter.cpp +++ b/lib/Frontend/PCHWriter.cpp @@ -626,7 +626,7 @@ void PCHWriter::WriteBlockInfoBlock() { RECORD(SPECIAL_TYPES); RECORD(STATISTICS); RECORD(TENTATIVE_DEFINITIONS); - RECORD(UNUSED_STATIC_FUNCS); + RECORD(UNUSED_FILESCOPED_DECLS); RECORD(LOCALLY_SCOPED_EXTERNAL_DECLS); RECORD(SELECTOR_OFFSETS); RECORD(METHOD_POOL); @@ -636,7 +636,6 @@ void PCHWriter::WriteBlockInfoBlock() { RECORD(STAT_CACHE); RECORD(EXT_VECTOR_DECLS); RECORD(VERSION_CONTROL_BRANCH_REVISION); - RECORD(UNUSED_STATIC_FUNCS); RECORD(MACRO_DEFINITION_OFFSETS); RECORD(CHAINED_METADATA); RECORD(REFERENCED_SELECTOR_POOL); @@ -2204,10 +2203,10 @@ void PCHWriter::WritePCHCore(Sema &SemaRef, MemorizeStatCalls *StatCalls, AddDeclRef(SemaRef.TentativeDefinitions[i], TentativeDefinitions); } - // Build a record containing all of the static unused functions in this file. - RecordData UnusedStaticFuncs; - for (unsigned i=0, e = SemaRef.UnusedStaticFuncs.size(); i !=e; ++i) - AddDeclRef(SemaRef.UnusedStaticFuncs[i], UnusedStaticFuncs); + // Build a record containing all of the file scoped decls in this file. + RecordData UnusedFileScopedDecls; + for (unsigned i=0, e = SemaRef.UnusedFileScopedDecls.size(); i !=e; ++i) + AddDeclRef(SemaRef.UnusedFileScopedDecls[i], UnusedFileScopedDecls); RecordData WeakUndeclaredIdentifiers; if (!SemaRef.WeakUndeclaredIdentifiers.empty()) { @@ -2333,9 +2332,9 @@ void PCHWriter::WritePCHCore(Sema &SemaRef, MemorizeStatCalls *StatCalls, if (!TentativeDefinitions.empty()) Stream.EmitRecord(pch::TENTATIVE_DEFINITIONS, TentativeDefinitions); - // Write the record containing unused static functions. - if (!UnusedStaticFuncs.empty()) - Stream.EmitRecord(pch::UNUSED_STATIC_FUNCS, UnusedStaticFuncs); + // Write the record containing unused file scoped decls. + if (!UnusedFileScopedDecls.empty()) + Stream.EmitRecord(pch::UNUSED_FILESCOPED_DECLS, UnusedFileScopedDecls); // Write the record containing weak undeclared identifiers. if (!WeakUndeclaredIdentifiers.empty()) @@ -2436,11 +2435,11 @@ void PCHWriter::WritePCHChain(Sema &SemaRef, MemorizeStatCalls *StatCalls, AddDeclRef(SemaRef.TentativeDefinitions[i], TentativeDefinitions); } - // Build a record containing all of the static unused functions in this file. - RecordData UnusedStaticFuncs; - for (unsigned i=0, e = SemaRef.UnusedStaticFuncs.size(); i !=e; ++i) { - if (SemaRef.UnusedStaticFuncs[i]->getPCHLevel() == 0) - AddDeclRef(SemaRef.UnusedStaticFuncs[i], UnusedStaticFuncs); + // Build a record containing all of the file scoped decls in this file. + RecordData UnusedFileScopedDecls; + for (unsigned i=0, e = SemaRef.UnusedFileScopedDecls.size(); i !=e; ++i) { + if (SemaRef.UnusedFileScopedDecls[i]->getPCHLevel() == 0) + AddDeclRef(SemaRef.UnusedFileScopedDecls[i], UnusedFileScopedDecls); } // We write the entire table, overwriting the tables from the chain. @@ -2558,9 +2557,9 @@ void PCHWriter::WritePCHChain(Sema &SemaRef, MemorizeStatCalls *StatCalls, if (!TentativeDefinitions.empty()) Stream.EmitRecord(pch::TENTATIVE_DEFINITIONS, TentativeDefinitions); - // Write the record containing unused static functions. - if (!UnusedStaticFuncs.empty()) - Stream.EmitRecord(pch::UNUSED_STATIC_FUNCS, UnusedStaticFuncs); + // Write the record containing unused file scoped decls. + if (!UnusedFileScopedDecls.empty()) + Stream.EmitRecord(pch::UNUSED_FILESCOPED_DECLS, UnusedFileScopedDecls); // Write the record containing weak undeclared identifiers. if (!WeakUndeclaredIdentifiers.empty()) |