[cfe-commits] r160068 - in /cfe/trunk: include/clang/Frontend/ lib/Frontend/ test/Frontend/ test/Lexer/ test/Modules/ test/Modules/Inputs/Module.framework/Headers/ test/PCH/ test/Preprocessor/ test/SemaCXX/

Jordan Rose jordan_rose at apple.com
Wed Jul 11 12:58:23 PDT 2012


Author: jrose
Date: Wed Jul 11 14:58:23 2012
New Revision: 160068

URL: http://llvm.org/viewvc/llvm-project?rev=160068&view=rev
Log:
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).

Added:
    cfe/trunk/test/Frontend/verify-directive.h
    cfe/trunk/test/Frontend/verify-fatal.c
    cfe/trunk/test/Frontend/verify.c
Modified:
    cfe/trunk/include/clang/Frontend/VerifyDiagnosticConsumer.h
    cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp
    cfe/trunk/test/Lexer/bcpl-escaped-newline.c
    cfe/trunk/test/Lexer/conflict-marker.c
    cfe/trunk/test/Modules/Inputs/Module.framework/Headers/Module.h
    cfe/trunk/test/Modules/on-demand-build.m
    cfe/trunk/test/PCH/attrs.c
    cfe/trunk/test/PCH/chain-staticvar-instantiation.cpp
    cfe/trunk/test/PCH/cxx-static_assert.cpp
    cfe/trunk/test/PCH/cxx-trailing-return.cpp
    cfe/trunk/test/PCH/cxx0x-default-delete.cpp
    cfe/trunk/test/PCH/cxx0x-delegating-ctors.cpp
    cfe/trunk/test/PCH/cxx11-constexpr.cpp
    cfe/trunk/test/PCH/cxx11-enum-template.cpp
    cfe/trunk/test/PCH/cxx11-user-defined-literals.cpp
    cfe/trunk/test/PCH/ms-if-exists.cpp
    cfe/trunk/test/PCH/replaced-decl.m
    cfe/trunk/test/PCH/typo2.cpp
    cfe/trunk/test/PCH/variables.c
    cfe/trunk/test/Preprocessor/line-directive.c
    cfe/trunk/test/Preprocessor/macro_paste_c_block_comment.c
    cfe/trunk/test/Preprocessor/warning_tests.c
    cfe/trunk/test/SemaCXX/warn-deprecated-header.cpp

Modified: cfe/trunk/include/clang/Frontend/VerifyDiagnosticConsumer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/VerifyDiagnosticConsumer.h?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/VerifyDiagnosticConsumer.h (original)
+++ cfe/trunk/include/clang/Frontend/VerifyDiagnosticConsumer.h Wed Jul 11 14:58:23 2012
@@ -11,7 +11,10 @@
 #define LLVM_CLANG_FRONTEND_VERIFYDIAGNOSTICSCLIENT_H
 
 #include "clang/Basic/Diagnostic.h"
+#include "clang/Lex/Preprocessor.h"
+#include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/OwningPtr.h"
+#include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/STLExtras.h"
 #include <climits>
 
@@ -19,6 +22,7 @@
 
 class DiagnosticsEngine;
 class TextDiagnosticBuffer;
+class FileEntry;
 
 /// VerifyDiagnosticConsumer - Create a diagnostic client which will use
 /// markers in the input source to check that all the emitted diagnostics match
@@ -104,7 +108,8 @@
 ///   // expected-error-re {{variable has has type 'struct (.*)'}}
 ///   // expected-error-re {{variable has has type 'struct[[:space:]](.*)'}}
 ///
-class VerifyDiagnosticConsumer: public DiagnosticConsumer {
+class VerifyDiagnosticConsumer: public DiagnosticConsumer,
+                                public CommentHandler {
 public:
   /// Directive - Abstract class representing a parsed verify directive.
   ///
@@ -162,13 +167,17 @@
   };
 
 private:
+  typedef llvm::DenseSet<FileID> FilesWithDiagnosticsSet;
+  typedef llvm::SmallPtrSet<const FileEntry *, 4> FilesWithDirectivesSet;
+
   DiagnosticsEngine &Diags;
   DiagnosticConsumer *PrimaryClient;
   bool OwnsPrimaryClient;
   OwningPtr<TextDiagnosticBuffer> Buffer;
-  Preprocessor *CurrentPreprocessor;
+  const Preprocessor *CurrentPreprocessor;
+  FilesWithDiagnosticsSet FilesWithDiagnostics;
+  FilesWithDirectivesSet FilesWithDirectives;
   ExpectedData ED;
-  FileID FirstErrorFID; // FileID of first diagnostic
   void CheckDiagnostics();
 
 public:
@@ -183,6 +192,8 @@
 
   virtual void EndSourceFile();
 
+  virtual bool HandleComment(Preprocessor &PP, SourceRange Comment);
+
   virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
                                 const Diagnostic &Info);
   

Modified: cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp (original)
+++ cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp Wed Jul 11 14:58:23 2012
@@ -11,6 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "clang/Basic/FileManager.h"
 #include "clang/Frontend/VerifyDiagnosticConsumer.h"
 #include "clang/Frontend/FrontendDiagnostic.h"
 #include "clang/Frontend/TextDiagnosticBuffer.h"
@@ -43,15 +44,15 @@
 
 void VerifyDiagnosticConsumer::BeginSourceFile(const LangOptions &LangOpts,
                                                const Preprocessor *PP) {
-  // FIXME: Const hack, we screw up the preprocessor but in practice its ok
-  // because it doesn't get reused. It would be better if we could make a copy
-  // though.
-  CurrentPreprocessor = const_cast<Preprocessor*>(PP);
+  CurrentPreprocessor = PP;
+  if (PP) const_cast<Preprocessor*>(PP)->addCommentHandler(this);
 
   PrimaryClient->BeginSourceFile(LangOpts, PP);
 }
 
 void VerifyDiagnosticConsumer::EndSourceFile() {
+  if (CurrentPreprocessor)
+    const_cast<Preprocessor*>(CurrentPreprocessor)->removeCommentHandler(this);
   CheckDiagnostics();
 
   PrimaryClient->EndSourceFile();
@@ -61,9 +62,9 @@
 
 void VerifyDiagnosticConsumer::HandleDiagnostic(
       DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info) {
-  if (FirstErrorFID.isInvalid() && Info.hasSourceManager()) {
+  if (Info.hasSourceManager()) {
     const SourceManager &SM = Info.getSourceManager();
-    FirstErrorFID = SM.getFileID(Info.getLocation());
+    FilesWithDiagnostics.insert(SM.getFileID(Info.getLocation()));
   }
   // Send the diagnostic to the buffer, we will check it once we reach the end
   // of the source file (or are destructed).
@@ -122,8 +123,8 @@
 class ParseHelper
 {
 public:
-  ParseHelper(const char *Begin, const char *End)
-    : Begin(Begin), End(End), C(Begin), P(Begin), PEnd(NULL) { }
+  ParseHelper(StringRef S)
+    : Begin(S.begin()), End(S.end()), C(Begin), P(Begin), PEnd(NULL) { }
 
   // Return true if string literal is next.
   bool Next(StringRef S) {
@@ -190,11 +191,12 @@
 /// ParseDirective - Go through the comment and see if it indicates expected
 /// diagnostics. If so, then put them in the appropriate directive list.
 ///
-static void ParseDirective(const char *CommentStart, unsigned CommentLen,
-                           ExpectedData &ED, SourceManager &SM,
+/// Returns true if any valid directives were found.
+static bool ParseDirective(StringRef S, ExpectedData &ED, SourceManager &SM,
                            SourceLocation Pos, DiagnosticsEngine &Diags) {
   // A single comment may contain multiple directives.
-  for (ParseHelper PH(CommentStart, CommentStart+CommentLen); !PH.Done();) {
+  bool FoundDirective = false;
+  for (ParseHelper PH(S); !PH.Done();) {
     // Search for token: expected
     if (!PH.Search("expected"))
       break;
@@ -329,19 +331,77 @@
     Directive *D = Directive::create(RegexKind, Pos, ExpectedLoc, Text,
                                      Min, Max);
     std::string Error;
-    if (D->isValid(Error))
+    if (D->isValid(Error)) {
       DL->push_back(D);
-    else {
+      FoundDirective = true;
+    } else {
       Diags.Report(Pos.getLocWithOffset(ContentBegin-PH.Begin),
                    diag::err_verify_invalid_content)
         << KindStr << Error;
     }
   }
+
+  return FoundDirective;
+}
+
+/// HandleComment - Hook into the preprocessor and extract comments containing
+///  expected errors and warnings.
+bool VerifyDiagnosticConsumer::HandleComment(Preprocessor &PP,
+                                             SourceRange Comment) {
+  SourceManager &SM = PP.getSourceManager();
+  SourceLocation CommentBegin = Comment.getBegin();
+
+  const char *CommentRaw = SM.getCharacterData(CommentBegin);
+  StringRef C(CommentRaw, SM.getCharacterData(Comment.getEnd()) - CommentRaw);
+
+  if (C.empty())
+    return false;
+
+  // Fold any "\<EOL>" sequences
+  size_t loc = C.find('\\');
+  if (loc == StringRef::npos) {
+    if (ParseDirective(C, ED, SM, CommentBegin, PP.getDiagnostics()))
+      if (const FileEntry *E = SM.getFileEntryForID(SM.getFileID(CommentBegin)))
+        FilesWithDirectives.insert(E);
+    return false;
+  }
+
+  std::string C2;
+  C2.reserve(C.size());
+
+  for (size_t last = 0;; loc = C.find('\\', last)) {
+    if (loc == StringRef::npos || loc == C.size()) {
+      C2 += C.substr(last);
+      break;
+    }
+    C2 += C.substr(last, loc-last);
+    last = loc + 1;
+
+    if (C[last] == '\n' || C[last] == '\r') {
+      ++last;
+
+      // Escape \r\n  or \n\r, but not \n\n.
+      if (last < C.size())
+        if (C[last] == '\n' || C[last] == '\r')
+          if (C[last] != C[last-1])
+            ++last;
+    } else {
+      // This was just a normal backslash.
+      C2 += '\\';
+    }
+  }
+
+  if (!C2.empty())
+    if (ParseDirective(C2, ED, SM, CommentBegin, PP.getDiagnostics()))
+      if (const FileEntry *E = SM.getFileEntryForID(SM.getFileID(CommentBegin)))
+        FilesWithDirectives.insert(E);
+  return false;
 }
 
 /// FindExpectedDiags - Lex the main source file to find all of the
 //   expected errors and warnings.
-static void FindExpectedDiags(Preprocessor &PP, ExpectedData &ED, FileID FID) {
+static void FindExpectedDiags(const Preprocessor &PP, ExpectedData &ED,
+                              FileID FID) {
   // Create a raw lexer to pull all the comments out of FID.
   if (FID.isInvalid())
     return;
@@ -364,8 +424,7 @@
     if (Comment.empty()) continue;
 
     // Find all expected errors/warnings/notes.
-    ParseDirective(&Comment[0], Comment.size(), ED, SM, Tok.getLocation(),
-                   PP.getDiagnostics());
+    ParseDirective(Comment, ED, SM, Tok.getLocation(), PP.getDiagnostics());
   };
 }
 
@@ -497,18 +556,21 @@
   // markers. If not then any diagnostics are unexpected.
   if (CurrentPreprocessor) {
     SourceManager &SM = CurrentPreprocessor->getSourceManager();
-    // Extract expected-error strings from main file.
-    FindExpectedDiags(*CurrentPreprocessor, ED, SM.getMainFileID());
-    // Only check for expectations in other diagnostic locations
-    // if they are not the main file (via ID or FileEntry) - the main
-    // file has already been looked at, and its expectations must not
-    // be added twice.
-    if (!FirstErrorFID.isInvalid() && FirstErrorFID != SM.getMainFileID()
-        && (!SM.getFileEntryForID(FirstErrorFID)
-            || (SM.getFileEntryForID(FirstErrorFID) !=
-                SM.getFileEntryForID(SM.getMainFileID())))) {
-      FindExpectedDiags(*CurrentPreprocessor, ED, FirstErrorFID);
-      FirstErrorFID = FileID();
+    // Only check for expectations in other diagnostic locations not
+    // captured during normal parsing.
+    // FIXME: This check is currently necessary while synthesized files may
+    // not have their expected-* directives captured during parsing.  These
+    // cases should be fixed and the following loop replaced with one which
+    // checks only during a debug build and asserts on a mismatch.
+    for (FilesWithDiagnosticsSet::iterator I = FilesWithDiagnostics.begin(),
+                                         End = FilesWithDiagnostics.end();
+            I != End; ++I) {
+      const FileEntry *E = SM.getFileEntryForID(*I);
+      if (!E || !FilesWithDirectives.count(E)) {
+        if (E)
+          FilesWithDirectives.insert(E);
+        FindExpectedDiags(*CurrentPreprocessor, ED, *I);
+      }
     }
 
     // Check that the expected diagnostics occurred.

Added: cfe/trunk/test/Frontend/verify-directive.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/verify-directive.h?rev=160068&view=auto
==============================================================================
--- cfe/trunk/test/Frontend/verify-directive.h (added)
+++ cfe/trunk/test/Frontend/verify-directive.h Wed Jul 11 14:58:23 2012
@@ -0,0 +1,2 @@
+// Check that directives inside includes are included!
+// expected-error at 1 {{include file test}}

Added: cfe/trunk/test/Frontend/verify-fatal.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/verify-fatal.c?rev=160068&view=auto
==============================================================================
--- cfe/trunk/test/Frontend/verify-fatal.c (added)
+++ cfe/trunk/test/Frontend/verify-fatal.c Wed Jul 11 14:58:23 2012
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -Wfatal-errors -verify %s 2>&1 | FileCheck %s
+
+#error first fatal
+// expected-error at -1 {{first fatal}}
+
+#error second fatal
+// expected-error at -1 {{second fatal}}
+
+
+//      CHECK: error: 'error' diagnostics expected but not seen:
+// CHECK-NEXT:   Line 6 (directive at {{.*}}verify-fatal.c:7): second fatal
+// CHECK-NEXT: 1 error generated.

Added: cfe/trunk/test/Frontend/verify.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/verify.c?rev=160068&view=auto
==============================================================================
--- cfe/trunk/test/Frontend/verify.c (added)
+++ cfe/trunk/test/Frontend/verify.c Wed Jul 11 14:58:23 2012
@@ -0,0 +1,110 @@
+// RUN: %clang_cc1 -DTEST1 -verify %s
+// RUN: %clang_cc1 -DTEST2 -verify %s 2>&1 | FileCheck -check-prefix=CHECK2 %s
+// RUN: %clang_cc1 -DTEST3 -verify %s 2>&1 | FileCheck -check-prefix=CHECK3 %s
+// RUN: %clang_cc1 -DTEST4 -verify %s 2>&1 | FileCheck -check-prefix=CHECK4 %s
+// RUN: %clang_cc1 -DTEST5 -verify %s 2>&1 | FileCheck -check-prefix=CHECK5 %s
+
+// expected-warning@ malformed
+// expected-error at 7 1 {{missing or invalid line number}}
+
+// expected-warning at 0 malformed
+// expected-error at 10 {{missing or invalid line number}}
+
+// expected-warning at -50 malformed
+// expected-error at 13 {{missing or invalid line number}}
+
+// expected-warning malformed
+// expected-error at 16 {{cannot find start}}
+
+// expected-error 0+ {{should also be ignored}}
+
+#ifdef TEST1
+#if 0
+// expected-error {{should be ignored}}
+#endif
+
+#error should not be ignored
+// expected-error at -1 1+ {{should not be ignored}}
+
+#line 90
+unexpected a; // expected-error at +0 + {{unknown type}}
+
+#line 60
+unexpected b; // expected-error at 33 1-1 {{unknown type}}
+
+// expected-error at +2 {{file not found}} check that multi-line handled correctly: \
+
+#include "missing_header_file.include"
+#endif
+
+#ifdef TEST2
+#define MACRO some_value // expected-error {{define_error}}
+#undef MACRO extra_token // expected-warning {{undef_error}}
+#line -2                 // expected-error {{line_error}}
+#error AAA               // expected-error {{BBB}} <- this shall be part of diagnostic
+#warning CCC             // expected-warning {{DDD}} <- this shall be part of diagnostic
+
+#if 0
+// This is encapsulated in "#if 0" so that the expected-* checks below
+// are not inadvertently included in the diagnostic checking!
+
+//      CHECK2: error: 'error' diagnostics expected but not seen:
+// CHECK2-NEXT:   Line 41: define_error
+// CHECK2-NEXT:   Line 43: line_error
+// CHECK2-NEXT: error: 'error' diagnostics seen but not expected:
+// CHECK2-NEXT:   Line 43: #line directive requires a positive integer argument
+// CHECK2-NEXT:   Line 44: AAA // expected-error {{[{][{]BBB[}][}]}} <- this shall be part of diagnostic
+// CHECK2-NEXT: error: 'warning' diagnostics expected but not seen:
+// CHECK2-NEXT:   Line 42: undef_error
+// CHECK2-NEXT: error: 'warning' diagnostics seen but not expected:
+// CHECK2-NEXT:   Line 42: extra tokens at end of #undef directive
+// CHECK2-NEXT:   Line 45: CCC // expected-warning {{[{][{]DDD[}][}]}} <- this shall be part of diagnostic
+// CHECK2-NEXT: 7 errors generated.
+#endif
+#endif
+
+#ifdef TEST3
+#ifndef TEST3         // expected-note {{line_67}}
+                      // expected-note {{line_68_ignored}}
+# ifdef UNDEFINED     // expected-note {{line_69_ignored}}
+# endif               // expected-note {{line_70_ignored}}
+#elif defined(TEST3)  // expected-note {{line_71}}
+# if 1                // expected-note {{line_72}}
+                      // expected-note {{line_73}}
+# else                // expected-note {{line_74}}
+                      // expected-note {{line_75_ignored}}
+#  ifndef TEST3       // expected-note {{line_76_ignored}}
+#  endif              // expected-note {{line_77_ignored}}
+# endif               // expected-note {{line_78}}
+#endif
+
+//      CHECK3: error: 'note' diagnostics expected but not seen:
+// CHECK3-NEXT:   Line 67: line_67
+// CHECK3-NEXT:   Line 71: line_71
+// CHECK3-NEXT:   Line 72: line_72
+// CHECK3-NEXT:   Line 73: line_73
+// CHECK3-NEXT:   Line 74: line_74
+// CHECK3-NEXT:   Line 78: line_78
+// CHECK3-NEXT: 6 errors generated.
+#endif
+
+#ifdef TEST4
+#include "missing_header_file.include" // expected-error {{include_error}}
+
+//      CHECK4: error: 'error' diagnostics expected but not seen:
+// CHECK4-NEXT:   Line 92: include_error
+// CHECK4-NEXT: error: 'error' diagnostics seen but not expected:
+// CHECK4-NEXT:   Line 92: 'missing_header_file.include' file not found
+// CHECK4-NEXT: 2 errors generated.
+#endif
+
+#ifdef TEST5
+#include "verify-directive.h"
+// expected-error at 50 {{source file test}}
+
+//      CHECK5: error: 'error' diagnostics expected but not seen:
+// CHECK5-NEXT:   Line 1 (directive at {{.*}}verify-directive.h:2): include file test
+// CHECK5-NEXT:   Line 50 (directive at {{.*}}verify.c:103): source file test
+// CHECK5-NEXT: 2 errors generated.
+#endif
+

Modified: cfe/trunk/test/Lexer/bcpl-escaped-newline.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/bcpl-escaped-newline.c?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/bcpl-escaped-newline.c (original)
+++ cfe/trunk/test/Lexer/bcpl-escaped-newline.c Wed Jul 11 14:58:23 2012
@@ -5,7 +5,8 @@
 #error bar
 
 //??/
-#error qux // expected-error {{qux}}
+#error qux
+// expected-error at -1 {{qux}}
 
 // Trailing whitespace!
 //\ 

Modified: cfe/trunk/test/Lexer/conflict-marker.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/conflict-marker.c?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/conflict-marker.c (original)
+++ cfe/trunk/test/Lexer/conflict-marker.c Wed Jul 11 14:58:23 2012
@@ -3,8 +3,8 @@
 // Test that we recover gracefully from conflict markers left in input files.
 // PR5238
 
-// diff3 style
-<<<<<<< .mine      // expected-error {{version control conflict marker in file}}
+// diff3 style  expected-error at +1 {{version control conflict marker in file}}
+<<<<<<< .mine
 int x = 4;
 |||||||
 int x = 123;
@@ -12,15 +12,15 @@
 float x = 17;
 >>>>>>> .r91107
 
-// normal style.
-<<<<<<< .mine     // expected-error {{version control conflict marker in file}}
+// normal style  expected-error at +1 {{version control conflict marker in file}}
+<<<<<<< .mine
 typedef int y;
 =======
 typedef struct foo *y;
 >>>>>>> .r91107
 
-// Perforce style.
->>>> ORIGINAL conflict-marker.c#6 // expected-error {{version control conflict marker in file}}
+// Perforce style  expected-error at +1 {{version control conflict marker in file}}
+>>>> ORIGINAL conflict-marker.c#6
 int z = 1;
 ==== THEIRS conflict-marker.c#7
 int z = 0;

Modified: cfe/trunk/test/Modules/Inputs/Module.framework/Headers/Module.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/Module.framework/Headers/Module.h?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/Module.framework/Headers/Module.h (original)
+++ cfe/trunk/test/Modules/Inputs/Module.framework/Headers/Module.h Wed Jul 11 14:58:23 2012
@@ -1,4 +1,8 @@
-// expected-warning{{umbrella header}}
+// expected-warning 0-1 {{umbrella header}}
+
+// FIXME: The "umbrella header" warning should be moved to a separate test.
+// This "0-1" is only here because the warning is only emitted when the
+// module is (otherwise) successfully included.
 
 #ifndef MODULE_H
 #define MODULE_H

Modified: cfe/trunk/test/Modules/on-demand-build.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/on-demand-build.m?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/Modules/on-demand-build.m (original)
+++ cfe/trunk/test/Modules/on-demand-build.m Wed Jul 11 14:58:23 2012
@@ -7,10 +7,7 @@
 @interface OtherClass
 @end
 
-
-
-
-// in module: expected-note{{class method 'alloc' is assumed to return an instance of its receiver type ('Module *')}}
+// in module: expected-note at 17{{class method 'alloc' is assumed to return an instance of its receiver type ('Module *')}}
 void test_getModuleVersion() {
   const char *version = getModuleVersion();
   const char *version2 = [Module version];

Modified: cfe/trunk/test/PCH/attrs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/attrs.c?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/PCH/attrs.c (original)
+++ cfe/trunk/test/PCH/attrs.c Wed Jul 11 14:58:23 2012
@@ -8,10 +8,11 @@
 #ifndef HEADER
 #define HEADER
 
-int f(int) __attribute__((visibility("default"), overloadable)); // expected-note{{previous overload}}
+int f(int) __attribute__((visibility("default"), overloadable));
 
 #else
 
 double f(double); // expected-error{{overloadable}}
+                  // expected-note at 11{{previous overload}}
 
 #endif

Modified: cfe/trunk/test/PCH/chain-staticvar-instantiation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/chain-staticvar-instantiation.cpp?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/PCH/chain-staticvar-instantiation.cpp (original)
+++ cfe/trunk/test/PCH/chain-staticvar-instantiation.cpp Wed Jul 11 14:58:23 2012
@@ -36,7 +36,8 @@
 #else
 //===----------------------------------------------------------------------===//
 
-#warning reached main file // expected-warning {{reached main file}}
+// expected-warning at +1 {{reached main file}}
+#warning reached main file
 
 int g3 = NS::TS<int, 2>::value;
 

Modified: cfe/trunk/test/PCH/cxx-static_assert.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx-static_assert.cpp?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/PCH/cxx-static_assert.cpp (original)
+++ cfe/trunk/test/PCH/cxx-static_assert.cpp Wed Jul 11 14:58:23 2012
@@ -9,11 +9,12 @@
 #define HEADER
 
 template<int N> struct T {
-    static_assert(N == 2, "N is not 2!"); // expected-error {{static_assert failed "N is not 2!"}}
+    static_assert(N == 2, "N is not 2!");
 };
 
 #else
 
+// expected-error at 12 {{static_assert failed "N is not 2!"}}
 T<1> t1; // expected-note {{in instantiation of template class 'T<1>' requested here}}
 T<2> t2;
 

Modified: cfe/trunk/test/PCH/cxx-trailing-return.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx-trailing-return.cpp?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/PCH/cxx-trailing-return.cpp (original)
+++ cfe/trunk/test/PCH/cxx-trailing-return.cpp Wed Jul 11 14:58:23 2012
@@ -4,12 +4,14 @@
 #ifndef HEADER_INCLUDED
 
 #define HEADER_INCLUDED
-typedef auto f() -> int; // expected-note {{here}}
-typedef int g(); // expected-note {{here}}
+typedef auto f() -> int;
+typedef int g();
 
 #else
 
 typedef void f; // expected-error {{typedef redefinition with different types ('void' vs 'auto () -> int')}}
+                // expected-note at 7 {{here}}
 typedef void g; // expected-error {{typedef redefinition with different types ('void' vs 'int ()')}}
+                // expected-note at 8 {{here}}
 
 #endif

Modified: cfe/trunk/test/PCH/cxx0x-default-delete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx0x-default-delete.cpp?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/PCH/cxx0x-default-delete.cpp (original)
+++ cfe/trunk/test/PCH/cxx0x-default-delete.cpp Wed Jul 11 14:58:23 2012
@@ -9,15 +9,15 @@
 
 struct foo {
   foo() = default;
-  void bar() = delete; // expected-note{{deleted here}}
+  void bar() = delete;
 };
 
 struct baz {
-  ~baz() = delete; // expected-note{{deleted here}}
+  ~baz() = delete;
 };
 
 class quux {
-  ~quux() = default; // expected-note{{private here}}
+  ~quux() = default;
 };
 
 #else
@@ -25,10 +25,10 @@
 foo::foo() { } // expected-error{{definition of explicitly defaulted default constructor}}
 foo f;
 void fn() {
-  f.bar(); // expected-error{{deleted function}}
+  f.bar(); // expected-error{{deleted function}} expected-note at 12{{deleted here}}
 }
 
-baz bz; // expected-error{{deleted function}}
-quux qx; // expected-error{{private destructor}}
+baz bz; // expected-error{{deleted function}} expected-note at 16{{deleted here}}
+quux qx; // expected-error{{private destructor}} expected-note at 20{{private here}}
 
 #endif

Modified: cfe/trunk/test/PCH/cxx0x-delegating-ctors.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx0x-delegating-ctors.cpp?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/PCH/cxx0x-delegating-ctors.cpp (original)
+++ cfe/trunk/test/PCH/cxx0x-delegating-ctors.cpp Wed Jul 11 14:58:23 2012
@@ -8,13 +8,17 @@
 #ifndef PASS1
 #define PASS1
 struct foo {
-  foo(int) : foo() { } // expected-note{{it delegates to}}
+  foo(int) : foo() { }
   foo();
-  foo(bool) : foo('c') { } // expected-note{{it delegates to}}
-  foo(char) : foo(true) { } // expected-error{{creates a delegation cycle}} \
-                            // expected-note{{which delegates to}}
+  foo(bool) : foo('c') { }
+  foo(char) : foo(true) { }
 };
 #else
 foo::foo() : foo(1) { } // expected-error{{creates a delegation cycle}} \
                         // expected-note{{which delegates to}}
+
+// expected-note at 11{{it delegates to}}
+// expected-note at 13{{it delegates to}}
+// expected-error at 14{{creates a delegation cycle}}
+// expected-note at 14{{which delegates to}}
 #endif

Modified: cfe/trunk/test/PCH/cxx11-constexpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx11-constexpr.cpp?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/PCH/cxx11-constexpr.cpp (original)
+++ cfe/trunk/test/PCH/cxx11-constexpr.cpp Wed Jul 11 14:58:23 2012
@@ -6,11 +6,11 @@
 #define HEADER_INCLUDED
 
 struct B {
-  B(); // expected-note {{here}}
+  B();
   constexpr B(char) {}
 };
 
-struct C { // expected-note {{not an aggregate and has no constexpr constructors}}
+struct C {
   B b;
   double d = 0.0;
 };
@@ -24,6 +24,8 @@
 
 static_assert(D(4).k == 9, "");
 constexpr int f(C c) { return 0; } // expected-error {{not a literal type}}
+// expected-note at 13 {{not an aggregate and has no constexpr constructors}}
 constexpr B b; // expected-error {{constant expression}} expected-note {{non-constexpr}}
+               // expected-note at 9 {{here}}
 
 #endif

Modified: cfe/trunk/test/PCH/cxx11-enum-template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx11-enum-template.cpp?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/PCH/cxx11-enum-template.cpp (original)
+++ cfe/trunk/test/PCH/cxx11-enum-template.cpp Wed Jul 11 14:58:23 2012
@@ -7,7 +7,7 @@
 
 template<typename T> struct S {
   enum class E {
-    e = T() // expected-error {{conversion from 'double' to 'int'}}
+    e = T()
   };
 };
 
@@ -20,7 +20,7 @@
 
 int k1 = (int)S<int>::E::e;
 int k2 = (int)decltype(b)::e;
-int k3 = (int)decltype(c)::e; // expected-note {{here}}
+int k3 = (int)decltype(c)::e; // expected-error at 10 {{conversion from 'double' to 'int'}} expected-note {{here}}
 int k4 = (int)S<char>::E::e;
 
 #endif

Modified: cfe/trunk/test/PCH/cxx11-user-defined-literals.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx11-user-defined-literals.cpp?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/PCH/cxx11-user-defined-literals.cpp (original)
+++ cfe/trunk/test/PCH/cxx11-user-defined-literals.cpp Wed Jul 11 14:58:23 2012
@@ -8,7 +8,7 @@
 using size_t = decltype(sizeof(int));
 int operator"" _foo(const char *p, size_t);
 
-template<typename T> auto f(T t) -> decltype(t + ""_foo) { return 0; } // expected-note {{substitution failure}}
+template<typename T> auto f(T t) -> decltype(t + ""_foo) { return 0; }
 
 #else
 
@@ -17,5 +17,6 @@
 int *l = f(&k);
 struct S {};
 int m = f(S()); // expected-error {{no matching}}
+                // expected-note at 11 {{substitution failure}}
 
 #endif

Modified: cfe/trunk/test/PCH/ms-if-exists.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/ms-if-exists.cpp?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/PCH/ms-if-exists.cpp (original)
+++ cfe/trunk/test/PCH/ms-if-exists.cpp Wed Jul 11 14:58:23 2012
@@ -11,7 +11,7 @@
   }
 
   __if_not_exists(T::bar) {
-    int *i = t; // expected-error{{no viable conversion from 'HasFoo' to 'int *'}}
+    int *i = t;
     { }
   }
 }
@@ -25,5 +25,6 @@
 };
 
 template void f(HasFoo); // expected-note{{in instantiation of function template specialization 'f<HasFoo>' requested here}}
+                         // expected-error at 14{{no viable conversion from 'HasFoo' to 'int *'}}
 template void f(HasBar);
 #endif

Modified: cfe/trunk/test/PCH/replaced-decl.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/replaced-decl.m?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/PCH/replaced-decl.m (original)
+++ cfe/trunk/test/PCH/replaced-decl.m Wed Jul 11 14:58:23 2012
@@ -12,11 +12,12 @@
 #elif !defined(HEADER2)
 #define HEADER2
 
- at interface I // expected-note {{previous}}
+ at interface I
 @end
 
 #else
 
 typedef int I; // expected-error {{redefinition}}
+               // expected-note at 15 {{previous}}
 
 #endif

Modified: cfe/trunk/test/PCH/typo2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/typo2.cpp?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/PCH/typo2.cpp (original)
+++ cfe/trunk/test/PCH/typo2.cpp Wed Jul 11 14:58:23 2012
@@ -4,10 +4,11 @@
 #ifndef HEADER_INCLUDED
 #define HEADER_INCLUDED
 
-void func(struct Test);  // expected-note{{'Test' declared here}}
+void func(struct Test);
 
 #else
 
 ::Yest *T;  // expected-error{{did you mean 'Test'}}
+            // expected-note at 7{{'Test' declared here}}
 
 #endif

Modified: cfe/trunk/test/PCH/variables.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/variables.c?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/PCH/variables.c (original)
+++ cfe/trunk/test/PCH/variables.c Wed Jul 11 14:58:23 2012
@@ -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 at 14{{previous}}
+int z2 = 18; // expected-error{{redefinition}} expected-note at 16{{previous}}
+double VeryHappy; // expected-error{{redefinition}} expected-note at 19{{previous definition is here}}
 
 int Q = A_MACRO_IN_THE_PCH;
 

Modified: cfe/trunk/test/Preprocessor/line-directive.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/line-directive.c?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/line-directive.c (original)
+++ cfe/trunk/test/Preprocessor/line-directive.c Wed Jul 11 14:58:23 2012
@@ -33,8 +33,11 @@
 
 // These are checked by the RUN line.
 #line 92 "blonk.c"
-#error ABC  // expected-error {{#error ABC}}
-#error DEF  // expected-error {{#error DEF}}
+#error ABC
+#error DEF
+// expected-error at -2 {{ABC}}
+#line 150
+// expected-error at -3 {{DEF}}
 
 
 // Verify that linemarker diddling of the system header flag works.

Modified: cfe/trunk/test/Preprocessor/macro_paste_c_block_comment.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/macro_paste_c_block_comment.c?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/macro_paste_c_block_comment.c (original)
+++ cfe/trunk/test/Preprocessor/macro_paste_c_block_comment.c Wed Jul 11 14:58:23 2012
@@ -1,8 +1,9 @@
 // RUN: %clang_cc1 %s -Eonly -verify
 
+// expected-error at 9 {{EOF}}
 #define COMM / ## *
 COMM // expected-error {{pasting formed '/*', an invalid preprocessing token}}
 
 // Demonstrate that an invalid preprocessing token
 // doesn't swallow the rest of the file...
-#error EOF // expected-error {{EOF}}
+#error EOF

Modified: cfe/trunk/test/Preprocessor/warning_tests.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/warning_tests.c?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/warning_tests.c (original)
+++ cfe/trunk/test/Preprocessor/warning_tests.c Wed Jul 11 14:58:23 2012
@@ -6,14 +6,16 @@
 #if __has_warning("not valid") // expected-warning {{__has_warning expected option name}}
 #endif
 
+// expected-warning at +2 {{Should have -Wparentheses}}
 #if __has_warning("-Wparentheses")
-#warning Should have -Wparentheses // expected-warning {{Should have -Wparentheses}}
+#warning Should have -Wparentheses
 #endif
 
 #if __has_warning(-Wfoo) // expected-error {{builtin warning check macro requires a parenthesized string}}
 #endif
 
+// expected-warning at +3 {{Not a valid warning flag}}
 #if __has_warning("-Wnot-a-valid-warning-flag-at-all")
 #else
-#warning Not a valid warning flag // expected-warning {{Not a valid warning flag}}
-#endif
\ No newline at end of file
+#warning Not a valid warning flag
+#endif

Modified: cfe/trunk/test/SemaCXX/warn-deprecated-header.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-deprecated-header.cpp?rev=160068&r1=160067&r2=160068&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-deprecated-header.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-deprecated-header.cpp Wed Jul 11 14:58:23 2012
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -fsyntax-only -fdeprecated-macro -verify %s
 // RUN: %clang_cc1 -fsyntax-only -Werror %s
 
+// expected-warning at +2 {{This file is deprecated.}}
 #ifdef __DEPRECATED
-#warning This file is deprecated. // expected-warning {{This file is deprecated.}}
+#warning This file is deprecated.
 #endif





More information about the cfe-commits mailing list