clang-1/test/Frontend
Andy Gibbs b42f200777 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
2013-04-17 08:06:46 +00:00
..
Inputs rewrite-includes: Rewrite __has_include(_next) to get rid of a host dependency. 2013-04-16 19:08:41 +00:00
Weverything.c Basic/Diagnostics: Rewrite DiagnosticIDs::getDiagnosticLevel completely to be straighter line code, use the new DiagnosticMappingInfo flags, and eliminate the odd MAP_WARNING_NO_WERROR and friend mappings. 2011-09-29 01:58:05 +00:00
Wno-everything.c Add test for -Wno-everything. 2012-01-27 07:10:14 +00:00
ast-codegen.c A number of test cases assume that an "int" parameter or return value 2012-10-24 12:22:56 +00:00
ast-main.c Update tests to use %clang instead of 'clang', and forcibly disable use of ' 2009-12-15 22:01:24 +00:00
ast-main.cpp Delayed template parsing is not supported by the AST serialization system yet, so turning it off. This fixes a test breakage caused by r177336. 2013-03-21 19:38:59 +00:00
cpp-output.c Update tests to use %clang instead of 'clang', and forcibly disable use of ' 2009-12-15 22:01:24 +00:00
darwin-version.c rename -ccc-host-triple into -target 2012-01-20 22:01:23 +00:00
dependency-gen-escaping.c Escape # and $ in dependency files. 2013-04-02 13:38:48 +00:00
dependency-gen.c test/Frontend/dependency-gen.c: Relax expressions for Win32 host (mingw msys). 2011-11-17 07:21:33 +00:00
dependency-generation-crash.c Fixes a crash when generating dependency file stuff 2011-04-15 18:49:23 +00:00
diagnostics-option-names.c Basic/Diagnostics: Add an isDefaultMappingAsError method, and switch TextDiagnosticPrinter to use that instead of extracting the current mapping via getDiagnosticLevel, which fixes one class of corner cases w.r.t. printing the "-Werror" diagnostic option marker. 2011-09-29 01:01:08 +00:00
hexagon-target-basic.c hexagon-target-basic.c test: add REQUIRES line for hexagon target 2013-01-02 22:30:14 +00:00
iframework.c Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
ir-support-codegen.ll These tests require particular registered targets. Declared as such. 2011-06-04 04:38:16 +00:00
ir-support-errors.ll Escape % in diagnostic message when compiling LLVM IR. 2012-03-16 22:31:42 +00:00
lit.local.cfg tests: Update Frontend config to actually run ir-support tests. 2010-06-16 20:04:36 +00:00
macros.c Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
output-failures.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
preprocessed-output-macro-first-token.c add a testcase, from Michael Spencer 2010-06-15 18:56:20 +00:00
print-header-includes.c Frontend: Add basic -H support. 2010-08-24 22:44:13 +00:00
rewrite-includes-invalid-hasinclude.c rewrite-includes: Rewrite __has_include(_next) to get rid of a host dependency. 2013-04-16 19:08:41 +00:00
rewrite-includes-missing.c [frontend] -frewrite-includes: if there was no inclusion, don't add lineinfo that indicates return from another file. 2013-04-10 01:53:37 +00:00
rewrite-includes-modules.c [frontend] -frewrite-includes: turn implicit module imports into @imports. 2013-04-10 01:53:50 +00:00
rewrite-includes.c rewrite-includes: Rewrite __has_include(_next) to get rid of a host dependency. 2013-04-16 19:08:41 +00:00
rewrite-macros.c Follow Jordan's advice and use {{^}} and {{$}} for this test 2013-04-11 18:39:10 +00:00
stdin.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
system-header-prefix.c Add -isystem-prefix and -ino-system-prefix arguments, which can be used to 2012-06-13 20:27:03 +00:00
undef.c The macros defined by the language standard are still available even when the 2011-06-07 06:07:12 +00:00
unknown-pragmas.c Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
verify-directive.h Allow -verify directives to be filtered by preprocessing. 2012-07-11 19:58:23 +00:00
verify-fatal.c Allow -verify directives to be filtered by preprocessing. 2012-07-11 19:58:23 +00:00
verify.c Extended VerifyDiagnosticConsumer to also verify source file for diagnostic. 2013-04-17 08:06:46 +00:00
verify2.c Change VerifyDiagnosticConsumer so that it *must* contain at least one "expected-*" directive. As a result, for test-cases that are not expected to generate any diagnostics, an additional directive "expected-no-diagnostics" has been implemented which can then be included in such test-cases. This new directive may not be used in conjunction with any other "expected-*" directive. 2012-10-19 12:49:32 +00:00
verify2.h Update VerifyDiagnosticConsumer to only get directives during parsing. 2012-08-10 01:06:16 +00:00
verify3.c Change VerifyDiagnosticConsumer so that it *must* contain at least one "expected-*" directive. As a result, for test-cases that are not expected to generate any diagnostics, an additional directive "expected-no-diagnostics" has been implemented which can then be included in such test-cases. This new directive may not be used in conjunction with any other "expected-*" directive. 2012-10-19 12:49:32 +00:00
warning-mapping-1.c Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
warning-mapping-2.c Basic/Diagnostics: Rewrite DiagnosticIDs::getDiagnosticLevel completely to be straighter line code, use the new DiagnosticMappingInfo flags, and eliminate the odd MAP_WARNING_NO_WERROR and friend mappings. 2011-09-29 01:58:05 +00:00
warning-mapping-3.c tests: Add some more tests for warning mappings. 2011-09-29 01:37:40 +00:00
warning-mapping-4.c Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
warning-mapping-5.c Basic/Diagnostics: Apparently, #pragma ... diagnostic is intended to override 2011-10-04 21:17:24 +00:00
warning-options.cpp [driver] Warnings for warning options are handled by the frontend. The driver needs to process the 2013-01-15 01:21:53 +00:00