From 5aae0ee660ffdae057d7c5c0e851b5620586d042 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Tue, 8 Apr 2025 10:47:39 +0800 Subject: [PATCH] [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 --- clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp index abd6d7b4cd60..731141a545a4 100644 --- a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp +++ b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp @@ -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;