forked from OSchip/llvm-project
Fix crash when handling an argument parsing-related warning.
Summary: Don't crash on warnings coming before the translation unit starts. Reviewers: klimek, djasper Reviewed By: djasper CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2676 llvm-svn: 200702
This commit is contained in:
parent
8d58767b34
commit
6d129d5454
|
@ -82,7 +82,9 @@ void ClangTidyDiagnosticConsumer::HandleDiagnostic(
|
|||
// FIXME: Demultiplex diagnostics.
|
||||
// FIXME: Ensure that we don't get notes from user code related to errors
|
||||
// from non-user code.
|
||||
if (Diags->getSourceManager().isInSystemHeader(Info.getLocation()))
|
||||
// Let argument parsing-related warnings through.
|
||||
if (Diags->hasSourceManager() &&
|
||||
Diags->getSourceManager().isInSystemHeader(Info.getLocation()))
|
||||
return;
|
||||
if (DiagLevel != DiagnosticsEngine::Note) {
|
||||
Errors.push_back(
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
|
||||
// RUN: clang-tidy %t.cpp -- -fan-unknown-option > %t2.cpp
|
||||
// RUN: FileCheck -input-file=%t2.cpp %s
|
||||
|
||||
// CHECK: warning: unknown argument: '-fan-unknown-option'
|
Loading…
Reference in New Issue