]> granicus.if.org Git - clang/commit
Extended VerifyDiagnosticConsumer to also verify source file for diagnostic.
authorAndy Gibbs <andyg1001@hotmail.co.uk>
Wed, 17 Apr 2013 08:06:46 +0000 (08:06 +0000)
committerAndy Gibbs <andyg1001@hotmail.co.uk>
Wed, 17 Apr 2013 08:06:46 +0000 (08:06 +0000)
commitb42f200777a66b98989160bf3987ce431540a584
treeae167bf593ba9bbf9edccc05072a2e45314c0fd3
parenta50b57862b99bdd7d056014f429a809647257c8b
Extended VerifyDiagnosticConsumer to also verify source file for diagnostic.

VerifyDiagnosticConsumer previously would not check that the diagnostic and
its matching directive referenced the same source file.  Common practice was
to create directives that referenced other files but only by line number,
and this led to problems such as when the file containing the directive
didn't have enough lines to match the location of the diagnostic in the
other file, leading to bizarre file formatting and other oddities.

This patch causes VerifyDiagnosticConsumer to match source files as well as
line numbers.  Therefore, a new syntax is made available for directives, for
example:

// expected-error@file:line {{diagnostic message}}

This extends the @line feature where "file" is the file where the diagnostic
is generated.  The @line syntax is still available and uses the current file
for the diagnostic.  "file" can be specified either as a relative or absolute
path - although the latter has less usefulness, I think!  The #include search
paths will be used to locate the file and if it is not found an error will be
generated.

The new check is not optional: if the directive is in a different file to the
diagnostic, the file must be specified.  Therefore, a number of test-cases
have been updated with regard to this.

This closes out PR15613.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179677 91177308-0d34-0410-b5e6-96231b3b80d8
37 files changed:
include/clang/Basic/DiagnosticFrontendKinds.td
include/clang/Frontend/VerifyDiagnosticConsumer.h
lib/Frontend/VerifyDiagnosticConsumer.cpp
test/ASTMerge/function.c
test/Analysis/diagnostics/explicit-suppression.cpp
test/Frontend/verify.c
test/Misc/warn-in-system-header.c
test/Modules/auto-module-import.m
test/Modules/decldef.m
test/Modules/decldef.mm
test/Modules/diamond-pch.c
test/Modules/diamond.c
test/Modules/linkage-merge.cpp
test/Modules/linkage-merge.m
test/Modules/lookup.cpp
test/Modules/lookup.m
test/Modules/macros.c
test/Modules/method_pool.m
test/Modules/module-private.cpp
test/Modules/namespaces.cpp
test/Modules/normal-module-map.cpp
test/Modules/objc-categories.m
test/Modules/on-demand-build.m
test/Modules/redecl-merge.m
test/Modules/subframeworks.m
test/PCH/cxx-using.cpp
test/PCH/cxx11-statement-attributes.cpp
test/PCH/functions.c
test/PCH/method_pool.m
test/PCH/nonvisible-external-defs.c
test/PCH/reloc.c
test/PCH/tentative-defs.c
test/PCH/typo.cpp
test/PCH/typo.m
test/Sema/pragma-arc-cf-code-audited.c
test/SemaObjC/arc-system-header.m
test/SemaObjCXX/arc-system-header.mm