[analyzer] Enable analysis of WebKit "unified sources".
authorArtem Dergachev <artem.dergachev@gmail.com>
Wed, 25 Apr 2018 21:51:26 +0000 (21:51 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Wed, 25 Apr 2018 21:51:26 +0000 (21:51 +0000)
commit516837f2a1585d4a2a620162cc996ca763046e7d
tree36746602110594383e4ea0fc4bcdd7c9e49cb686
parent75fda2e0a5530b72443712bd9606bbd48f884817
[analyzer] Enable analysis of WebKit "unified sources".

Normally the analyzer begins path-sensitive analysis from functions within
the main file, even though the path is allowed to go through any functions
within the translation unit.

When a recent version of WebKit is compiled, the "unified sources" technique
is used, that assumes #including multiple code files into a single main file.
Such file would have no functions defined in it, so the analyzer wouldn't be
able to find any entry points for path-sensitive analysis.

This patch pattern-matches unified file names that are similar to those
used by WebKit and allows the analyzer to find entry points in the included
code files. A more aggressive/generic approach is being planned as well.

Differential Revision: https://reviews.llvm.org/D45839

llvm-svn: 330876
clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
clang/lib/StaticAnalyzer/Core/CallEvent.cpp
clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
clang/test/Analysis/unified-sources/UnifiedSource-1.cpp [new file with mode: 0644]
clang/test/Analysis/unified-sources/container.h [new file with mode: 0644]
clang/test/Analysis/unified-sources/source1.cpp [new file with mode: 0644]
clang/test/Analysis/unified-sources/source2.cpp [new file with mode: 0644]