Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/lib/DependencyScanning/DependencyScannerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
23 changes: 23 additions & 0 deletions clang/test/ClangScanDeps/p1689-suppress-warnings.cppm
Original file line number Diff line number Diff line change
@@ -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>