diff -U 3 -dHrN include/clang/Basic/Diagnostic.h include/clang/Basic/Diagnostic.h
--- include/clang/Basic/Diagnostic.h	2012-06-25 16:55:19.000000000 +0200
+++ include/clang/Basic/Diagnostic.h	2012-06-25 16:36:51.000000000 +0200
@@ -34,6 +34,7 @@
   class Preprocessor;
   class DiagnosticErrorTrap;
   class StoredDiagnostic;
+  class CommentHandler;
 
 /// \brief Annotates a diagnostic with some code that should be
 /// inserted, removed, or replaced to fix the problem.
@@ -1215,6 +1216,11 @@
   virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
                                 const Diagnostic &Info);
   
+  /// \brief Return the CommentHandler for this instance.
+  virtual CommentHandler *getCommentHandler() {
+    return 0;
+  }
+
   /// \brief Clone the diagnostic consumer, producing an equivalent consumer
   /// that can be used in a different context.
   virtual DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const = 0;
diff -U 3 -dHrN include/clang/Frontend/VerifyDiagnosticConsumer.h include/clang/Frontend/VerifyDiagnosticConsumer.h
--- include/clang/Frontend/VerifyDiagnosticConsumer.h	2012-06-25 16:47:43.000000000 +0200
+++ include/clang/Frontend/VerifyDiagnosticConsumer.h	2012-06-25 16:36:51.000000000 +0200
@@ -11,13 +11,16 @@
 #define LLVM_CLANG_FRONTEND_VERIFYDIAGNOSTICSCLIENT_H
 
 #include "clang/Basic/Diagnostic.h"
+#include "clang/Lex/Preprocessor.h"
 #include "llvm/ADT/OwningPtr.h"
 #include <climits>
+#include <set>
 
 namespace clang {
 
 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
@@ -86,7 +89,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.
   ///
@@ -142,13 +146,17 @@
   };
 
 private:
+  typedef std::set<FileID> UnseenSet;
+  typedef std::set<const FileEntry*> SeenSet;
+
   DiagnosticsEngine &Diags;
   DiagnosticConsumer *PrimaryClient;
   bool OwnsPrimaryClient;
   OwningPtr<TextDiagnosticBuffer> Buffer;
   Preprocessor *CurrentPreprocessor;
+  UnseenSet Unseen;
+  SeenSet Seen;
   ExpectedData ED;
-  FileID FirstErrorFID; // FileID of first diagnostic
   void CheckDiagnostics();
 
 public:
@@ -163,9 +171,15 @@
 
   virtual void EndSourceFile();
 
+  virtual bool HandleComment(Preprocessor &PP, SourceRange Comment);
+
   virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
                                 const Diagnostic &Info);
   
+  virtual CommentHandler *getCommentHandler() {
+    return this;
+  }
+
   virtual DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const;
 };
 
diff -U 3 -dHrN lib/Frontend/VerifyDiagnosticConsumer.cpp lib/Frontend/VerifyDiagnosticConsumer.cpp
--- lib/Frontend/VerifyDiagnosticConsumer.cpp	2012-06-25 16:59:16.000000000 +0200
+++ lib/Frontend/VerifyDiagnosticConsumer.cpp	2012-06-25 16:36:53.000000000 +0200
@@ -11,6 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "clang/Basic/FileManager.h"
 #include "clang/Frontend/VerifyDiagnosticConsumer.h"
 #include "clang/Frontend/FrontendDiagnostic.h"
 #include "clang/Frontend/TextDiagnosticBuffer.h"
@@ -47,11 +48,13 @@
   // because it doesn't get reused. It would be better if we could make a copy
   // though.
   CurrentPreprocessor = const_cast<Preprocessor*>(PP);
+  if (CurrentPreprocessor) CurrentPreprocessor->addCommentHandler(this);
 
   PrimaryClient->BeginSourceFile(LangOpts, PP);
 }
 
 void VerifyDiagnosticConsumer::EndSourceFile() {
+  if (CurrentPreprocessor) CurrentPreprocessor->removeCommentHandler(this);
   CheckDiagnostics();
 
   PrimaryClient->EndSourceFile();
@@ -61,9 +64,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());
+    Unseen.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).
@@ -344,6 +347,41 @@
   }
 }
 
+/// HandleComment - Hook into the preprocessor and extract comments containing
+///  expected errors and warnings.
+bool VerifyDiagnosticConsumer::HandleComment(Preprocessor &PP, SourceRange Comment) {
+  SourceManager &SM = PP.getSourceManager();
+  if (const FileEntry *E = SM.getFileEntryForID(SM.getFileID(Comment.getBegin())))
+    Seen.insert(E);
+
+  std::string C(SM.getCharacterData(Comment.getBegin()),
+                SM.getCharacterData(Comment.getEnd()));
+
+  // Fold any "\<EOL>" sequences
+  std::string C2;
+  C2.reserve(C.size());
+
+  for (size_t last = 0, loc = C.find('\\');; loc = C.find('\\', last)) {
+    if (loc == std::string::npos) {
+      C2 += C.substr(last);
+      break;
+    }
+    C2 += C.substr(last, loc-last);
+    if (C[loc+1] == '\n')
+      last = loc+2;
+    else if (C[loc+1] == '\r' && C[loc+2] == '\n')
+      last = loc+3;
+    else {
+      C2 += '\\';
+      last = loc+1;
+    }
+  }
+
+  if (!C2.empty())
+    ParseDirective(&C2[0], C2.size(), ED, PP, Comment.getBegin());
+  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) {
@@ -513,18 +551,18 @@
   // 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();
+    const SeenSet::iterator NotSeen = Seen.end();
+    for (UnseenSet::iterator I = Unseen.begin(),
+                           End = Unseen.end(); I != End; ++I) {
+      const FileEntry *E = SM.getFileEntryForID(*I);
+      if (!E || Seen.find(E) == NotSeen) {
+        if (E) Seen.insert(E);
+        FindExpectedDiags(*CurrentPreprocessor, ED, *I);
+      }
     }
 
     // Check that the expected diagnostics occurred.
