[clang-tools-extra] [clang-tidy] give dummy path when create ClangTidyContext (PR #134670)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 7 08:18:36 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tidy
@llvm/pr-subscribers-clang-tools-extra
Author: Congcong Cai (HerrCai0907)
<details>
<summary>Changes</summary>
#<!-- -->121323 changed the way the absolute path is computed. Empty file name will cause absolute path ignore current folder.
This patch add "dummy" file name to avoid this issue
Fixed: #<!-- -->134502
---
Full diff: https://github.com/llvm/llvm-project/pull/134670.diff
1 Files Affected:
- (modified) clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp (+2-2)
``````````diff
diff --git a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
index 71e852545203e..f0c9881a48838 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
@@ -166,8 +166,8 @@ ClangTidyContext::ClangTidyContext(
AllowEnablingAnalyzerAlphaCheckers(AllowEnablingAnalyzerAlphaCheckers),
EnableModuleHeadersParsing(EnableModuleHeadersParsing) {
// Before the first translation unit we can get errors related to command-line
- // parsing, use empty string for the file name in this case.
- setCurrentFile("");
+ // parsing, use dummy string for the file name in this case.
+ setCurrentFile("dummy");
}
ClangTidyContext::~ClangTidyContext() = default;
``````````
</details>
https://github.com/llvm/llvm-project/pull/134670
More information about the cfe-commits
mailing list