[PATCH] D153271: [include-cleaner] Bailout on invalid code for the command-line tool
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 20 00:07:55 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGab32cc6c02f5: [include-cleaner] Bailout on invalid code for the command-line tool (authored by hokein).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153271/new/
https://reviews.llvm.org/D153271
Files:
clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
Index: clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
===================================================================
--- clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
+++ clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
@@ -108,10 +108,18 @@
}
void EndSourceFile() override {
+ const auto &SM = getCompilerInstance().getSourceManager();
+ if (SM.getDiagnostics().hasUncompilableErrorOccurred()) {
+ llvm::errs()
+ << "Skipping file " << getCurrentFile()
+ << " due to compiler errors. clang-include-cleaner expects to "
+ "work on compilable source code.\n";
+ return;
+ }
+
if (!HTMLReportPath.empty())
writeHTML();
- const auto &SM = getCompilerInstance().getSourceManager();
auto &HS = getCompilerInstance().getPreprocessor().getHeaderSearchInfo();
llvm::StringRef Path =
SM.getFileEntryForID(SM.getMainFileID())->tryGetRealPathName();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153271.532802.patch
Type: text/x-patch
Size: 969 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230620/497af27f/attachment.bin>
More information about the cfe-commits
mailing list