Skip to content

Commit df22bbe

Browse files
authored
[clang] Stop parsing warning suppression mappings in driver (llvm#125722)
This gets rid of some extra IO from driver startup, and possiblity of emitting warnings twice.
1 parent a6abd0a commit df22bbe

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// RUN: rm -rf %t
2+
// RUN: mkdir -p %t
3+
// RUN: echo '[unknown-warning]' > %t/foo.txt
4+
// RUN: %clang -fdriver-only --warning-suppression-mappings=%t/foo.txt %s | FileCheck -allow-empty %s
5+
// CHECK-NOT: unknown warning option 'unknown-warning'

clang/tools/driver/driver.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,10 @@ int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContext) {
318318

319319
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts =
320320
CreateAndPopulateDiagOpts(Args);
321+
// Driver's diagnostics don't use suppression mappings, so don't bother
322+
// parsing them. CC1 still receives full args, so this doesn't impact other
323+
// actions.
324+
DiagOpts->DiagnosticSuppressionMappingsFile.clear();
321325

322326
TextDiagnosticPrinter *DiagClient
323327
= new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts);

0 commit comments

Comments
 (0)