[all-commits] [llvm/llvm-project] 333d66: [analyzer][ctu] Fix wrong 'multiple definitions' e...
Balazs Benics via All-commits
all-commits at lists.llvm.org
Thu Dec 16 08:48:23 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 333d66b09494b7ebc1a89f2befa79128a56f77e3
https://github.com/llvm/llvm-project/commit/333d66b09494b7ebc1a89f2befa79128a56f77e3
Author: Ella Ma <alansnape3058 at gmail.com>
Date: 2021-12-16 (Thu, 16 Dec 2021)
Changed paths:
M clang/docs/analyzer/user-docs/CrossTranslationUnit.rst
M clang/include/clang/Basic/DiagnosticCrossTUKinds.td
M clang/lib/CrossTU/CrossTranslationUnit.cpp
M clang/test/Analysis/Inputs/ctu-import.c.externalDefMap.ast-dump.txt
A clang/test/Analysis/Inputs/ctu-lookup-name-with-space.cpp
M clang/test/Analysis/Inputs/ctu-other.c.externalDefMap.ast-dump.txt
M clang/test/Analysis/Inputs/ctu-other.cpp.externalDefMap.ast-dump.txt
M clang/test/Analysis/Inputs/plist-macros-with-expansion-ctu.c.externalDefMap.txt
M clang/test/Analysis/ctu-inherited-default-ctor.cpp
A clang/test/Analysis/ctu-lookup-name-with-space.cpp
M clang/test/Analysis/func-mapping-test.cpp
M clang/unittests/CrossTU/CrossTranslationUnitTest.cpp
Log Message:
-----------
[analyzer][ctu] Fix wrong 'multiple definitions' errors caused by space characters in lookup names when parsing the ctu index file
This error was found when analyzing MySQL with CTU enabled.
When there are space characters in the lookup name, the current
delimiter searching strategy will make the file path wrongly parsed.
And when two lookup names have the same prefix before their first space
characters, a 'multiple definitions' error will be wrongly reported.
e.g. The lookup names for the two lambda exprs in the test case are
`c:@S at G@F at G#@Sa at F@operator int (*)(char)#1` and
`c:@S at G@F at G#@Sa at F@operator bool (*)(char)#1` respectively. And their
prefixes are both `c:@S at G@F at G#@Sa at F@operator` when using the first space
character as the delimiter.
Solving the problem by adding a length for the lookup name, making the
index items in the format of `USR-Length:USR File-Path`.
Reviewed By: steakhal
Differential Revision: https://reviews.llvm.org/D102669
More information about the All-commits
mailing list