[PATCH] Fix crash when handling an argument parsing-related warning.
Alexander Kornienko
alexfh at google.com
Mon Feb 3 08:01:06 PST 2014
Moved end of line comment before the statement.
Hi djasper, klimek,
http://llvm-reviews.chandlerc.com/D2676
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D2676?vs=6827&id=6828#toc
BRANCH
svn
ARCANIST PROJECT
clang-tools-extra
Files:
clang-tidy/ClangTidyDiagnosticConsumer.cpp
test/clang-tidy/diagnostic.cpp
Index: clang-tidy/ClangTidyDiagnosticConsumer.cpp
===================================================================
--- clang-tidy/ClangTidyDiagnosticConsumer.cpp
+++ clang-tidy/ClangTidyDiagnosticConsumer.cpp
@@ -82,7 +82,9 @@
// 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(
Index: test/clang-tidy/diagnostic.cpp
===================================================================
--- /dev/null
+++ test/clang-tidy/diagnostic.cpp
@@ -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'
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2676.2.patch
Type: text/x-patch
Size: 1065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140203/ddd8354b/attachment.bin>
More information about the cfe-commits
mailing list