mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-29 16:29:00 -04:00

We should not deserialize unused declarations from the PCH file. Achieve this by storing the top level declarations during parsing (HandleTopLevelDecl ASTConsumer callback) and analyzing/building a call graph only for those. Tested the patch on a sample ObjC file that uses PCH. With the patch, the analyzes is 17.5% faster and clang consumes 40% less memory. Got about 10% overall build/analyzes time decrease on a large Objective C project. A bit of CallGraph refactoring/cleanup as well.. llvm-svn: 154625
21 lines
441 B
C++
21 lines
441 B
C++
// RUN: %clang_cc1 -emit-pch -o %t %s
|
|
// RUN: %clang_cc1 -error-on-deserialized-decl S1_method -include-pch %t -analyze -analyzer-checker=core %s
|
|
// RUN: %clang_cc1 -include-pch %t -analyze -analyzer-checker=core -verify %s
|
|
|
|
#ifndef HEADER
|
|
#define HEADER
|
|
// Header.
|
|
|
|
void S1_method(); // This should not be deserialized.
|
|
|
|
|
|
#else
|
|
// Using the header.
|
|
|
|
int test() {
|
|
int x = 0;
|
|
return 5/x; //expected-warning {{Division by zero}}
|
|
}
|
|
|
|
#endif
|