Allow -verify directives to be filtered by preprocessing.
This is accomplished by making VerifyDiagnosticsConsumer a CommentHandler,
which then only reads the -verify directives that are actually in live
blocks of code. It also makes it simpler to handle -verify directives that
appear in header files, though we still have to manually reparse some files
depending on how they are generated.
This requires some test changes. In particular, all PCH tests now have their
-verify directives outside the "header" portion of the file, using the @line
syntax added in r159978. Other tests have been modified mostly to make it
clear what is being tested, and to prevent polluting the expected output with
the directives themselves.
Patch by Andy Gibbs! (with slight modifications)
The new Frontend/verify-* tests exercise the functionality of this commit,
as well as r159978, r159979, and r160053 (Andy's other -verify enhancements).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160068 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/PCH/variables.c b/test/PCH/variables.c
index 9f90b37..2c8c136 100644
--- a/test/PCH/variables.c
+++ b/test/PCH/variables.c
@@ -11,12 +11,12 @@
extern float y;
extern int *ip, x;
-float z; // expected-note{{previous}}
+float z;
-int z2 = 17; // expected-note{{previous}}
+int z2 = 17;
#define MAKE_HAPPY(X) X##Happy
-int MAKE_HAPPY(Very); // expected-note{{previous definition is here}}
+int MAKE_HAPPY(Very);
#define A_MACRO_IN_THE_PCH 492
#define FUNCLIKE_MACRO(X, Y) X ## Y
@@ -32,9 +32,9 @@
int *ip2 = &x;
float *fp = &ip; // expected-warning{{incompatible pointer types}}
-double z; // expected-error{{redefinition}}
-int z2 = 18; // expected-error{{redefinition}}
-double VeryHappy; // expected-error{{redefinition}}
+double z; // expected-error{{redefinition}} expected-note@14{{previous}}
+int z2 = 18; // expected-error{{redefinition}} expected-note@16{{previous}}
+double VeryHappy; // expected-error{{redefinition}} expected-note@19{{previous definition is here}}
int Q = A_MACRO_IN_THE_PCH;