[analyzer][CTU] API for CTU macro expansions
authorBalazs Benics <benicsbalazs@gmail.com>
Mon, 22 Feb 2021 10:12:22 +0000 (11:12 +0100)
committerBalazs Benics <balazsbenics@sigmatechnology.se>
Mon, 22 Feb 2021 10:12:22 +0000 (11:12 +0100)
commit38b185832e04ed0588c43161f5c3a8c0ce267497
tree4888021950044b45f4df3683357592ac6203451b
parent170c67d5b8cc58dd8a4bd0ea7c5ca02290fac39c
[analyzer][CTU] API for CTU macro expansions

Removes `CrossTranslationUnitContext::getImportedFromSourceLocation`
Removes the corresponding unit-test segment.

Introduces the `CrossTranslationUnitContext::getMacroExpansionContextForSourceLocation`
which will return the macro expansion context for an imported TU. Also adds a
few implementation FIXME notes where applicable, since this feature is
not implemented yet. This fact is also noted as Doxygen comments.

Uplifts a few CTU LIT test to match the current **incomplete** behavior.

It is a regression to some extent since now we don't expand any
macros in imported TUs. At least we don't crash anymore.

Note that the introduced function is already covered by LIT tests.
Eg.: Analysis/plist-macros-with-expansion-ctu.c

Reviewed By: balazske, Szelethus

Differential Revision: https://reviews.llvm.org/D94673
clang/include/clang/AST/ASTImporter.h
clang/include/clang/CrossTU/CrossTranslationUnit.h
clang/lib/AST/ASTImporter.cpp
clang/lib/CrossTU/CrossTranslationUnit.cpp
clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
clang/test/Analysis/plist-macros-with-expansion-ctu.c
clang/unittests/CrossTU/CrossTranslationUnitTest.cpp