[Reland] [ClangScanDeps] Do not emit warning for P1689 format (#186966) (#188401)

Close https://github.com/llvm/llvm-project/issues/185394

This is only for P1689 format as ClangScanDeps/optimize-vfs-pch.m will
check for warning message. I'll leave this to people who want to change
that.
This commit is contained in:
Chuanqi Xu 2026-03-25 13:42:43 +08:00 committed by GitHub
parent 3b04d26abd
commit 2eae3f3fcf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 0 deletions

View File

@ -412,6 +412,8 @@ void dependencies::initializeScanCompilerInstance(
ScanInstance.setBuildingModule(false);
ScanInstance.createVirtualFileSystem(FS, DiagConsumer);
ScanInstance.createDiagnostics(DiagConsumer, /*ShouldOwnClient=*/false);
if (Service.getOpts().Format == ScanningOutputFormat::P1689)
ScanInstance.getDiagnostics().setIgnoreAllWarnings(true);
ScanInstance.createFileManager();
ScanInstance.createSourceManager();

View File

@ -0,0 +1,23 @@
// Test that P1689 format suppresses warnings during dependency scanning.
// This addresses https://github.com/llvm/llvm-project/issues/185394
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t
// Test P1689 format - should NOT emit warnings
// RUN: clang-scan-deps -format=p1689 -- %clang++ -std=c++20 -I%t -c %t/mylib.cppm -o %t/mylib.o 2>&1 | FileCheck %s
// CHECK-NOT: warning:
// CHECK: {
// CHECK: "revision"
//--- header.h
// Empty header for testing
//--- mylib.cppm
module;
export module mylib;
#include <header.h>