[include-cleaner] Merge 2 parseIWYUPragma impls in libToolingInclusions
authorSam McCall <sam.mccall@gmail.com>
Mon, 28 Nov 2022 09:36:13 +0000 (10:36 +0100)
committerSam McCall <sam.mccall@gmail.com>
Mon, 28 Nov 2022 12:20:09 +0000 (13:20 +0100)
commit99b5ec1fd1a70680a8483e5efb86807254e44e0e
tree7cc8175ea2c1e63d1d442c6be5bd1abed8104e3e
parent285d46ef4b60c0919c00661199c1b010996cc2c1
[include-cleaner] Merge 2 parseIWYUPragma impls in libToolingInclusions

Based on include-cleaner's version, but:

- remove assert that can fail for input `/\<newline>* */`
- assert was also checking the wrong condition: that the prefix *differed* from
  either `//` or from `/*`. Avoid use of strncmp where we can.
- add a comment that the brittleness of the text matching is intentional

Differential Revision: https://reviews.llvm.org/D138780
clang-tools-extra/clangd/Headers.cpp
clang-tools-extra/clangd/Headers.h
clang-tools-extra/clangd/unittests/HeadersTests.cpp
clang-tools-extra/include-cleaner/lib/Record.cpp
clang/include/clang/Tooling/Inclusions/HeaderAnalysis.h
clang/lib/Tooling/Inclusions/HeaderAnalysis.cpp
clang/unittests/Tooling/HeaderAnalysisTest.cpp