[clang-tidy] give dummy path when create ClangTidyContext (#134670)

#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
This commit is contained in:
Congcong Cai 2025-04-08 10:47:39 +08:00 committed by GitHub
parent 499930e38a
commit 5aae0ee660
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -167,8 +167,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;