Rename Diagnostic to DiagnosticsEngine as per issue 5397


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140478 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/ARCMigrate/ARCMT.cpp b/lib/ARCMigrate/ARCMT.cpp
index 5779b4c..6d44ca6 100644
--- a/lib/ARCMigrate/ARCMT.cpp
+++ b/lib/ARCMigrate/ARCMT.cpp
@@ -38,7 +38,7 @@
            diagLoc.isBeforeInTranslationUnitThan(range.getEnd()))) {
       cleared = true;
       ListTy::iterator eraseS = I++;
-      while (I != List.end() && I->getLevel() == Diagnostic::Note)
+      while (I != List.end() && I->getLevel() == DiagnosticsEngine::Note)
         ++I;
       // Clear the diagnostic and any notes following it.
       List.erase(eraseS, I);
@@ -73,14 +73,14 @@
   return false;
 }
 
-void CapturedDiagList::reportDiagnostics(Diagnostic &Diags) const {
+void CapturedDiagList::reportDiagnostics(DiagnosticsEngine &Diags) const {
   for (ListTy::const_iterator I = List.begin(), E = List.end(); I != E; ++I)
     Diags.Report(*I);
 }
 
 bool CapturedDiagList::hasErrors() const {
   for (ListTy::const_iterator I = List.begin(), E = List.end(); I != E; ++I)
-    if (I->getLevel() >= Diagnostic::Error)
+    if (I->getLevel() >= DiagnosticsEngine::Error)
       return true;
 
   return false;
@@ -89,17 +89,17 @@
 namespace {
 
 class CaptureDiagnosticClient : public DiagnosticClient {
-  Diagnostic &Diags;
+  DiagnosticsEngine &Diags;
   CapturedDiagList &CapturedDiags;
 public:
-  CaptureDiagnosticClient(Diagnostic &diags,
+  CaptureDiagnosticClient(DiagnosticsEngine &diags,
                           CapturedDiagList &capturedDiags)
     : Diags(diags), CapturedDiags(capturedDiags) { }
 
-  virtual void HandleDiagnostic(Diagnostic::Level level,
+  virtual void HandleDiagnostic(DiagnosticsEngine::Level level,
                                 const DiagnosticInfo &Info) {
     if (arcmt::isARCDiagnostic(Info.getID(), Diags) ||
-        level >= Diagnostic::Error || level == Diagnostic::Note) {
+        level >= DiagnosticsEngine::Error || level == DiagnosticsEngine::Note) {
       CapturedDiags.push_back(StoredDiagnostic(level, Info));
       return;
     }
@@ -199,8 +199,8 @@
                                    Preprocessor &PP) {
   TextDiagnosticPrinter printer(llvm::errs(), diagOpts);
   llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-  llvm::IntrusiveRefCntPtr<Diagnostic> Diags(
-                   new Diagnostic(DiagID, &printer, /*ShouldOwnClient=*/false));
+  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
+      new DiagnosticsEngine(DiagID, &printer, /*ShouldOwnClient=*/false));
   Diags->setSourceManager(&PP.getSourceManager());
   
   printer.BeginSourceFile(PP.getLangOptions(), &PP);
@@ -232,8 +232,8 @@
 
   assert(DiagClient);
   llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-  llvm::IntrusiveRefCntPtr<Diagnostic> Diags(
-                 new Diagnostic(DiagID, DiagClient, /*ShouldOwnClient=*/false));
+  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
+      new DiagnosticsEngine(DiagID, DiagClient, /*ShouldOwnClient=*/false));
 
   // Filter of all diagnostics.
   CaptureDiagnosticClient errRec(*Diags, capturedDiags);
@@ -331,8 +331,8 @@
   }
 
   llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-  llvm::IntrusiveRefCntPtr<Diagnostic> Diags(
-                 new Diagnostic(DiagID, DiagClient, /*ShouldOwnClient=*/false));
+  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
+      new DiagnosticsEngine(DiagID, DiagClient, /*ShouldOwnClient=*/false));
 
   if (outputDir.empty()) {
     origCI.getLangOpts().ObjCAutoRefCount = true;
@@ -370,8 +370,8 @@
   assert(!outputDir.empty());
 
   llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-  llvm::IntrusiveRefCntPtr<Diagnostic> Diags(
-                 new Diagnostic(DiagID, DiagClient, /*ShouldOwnClient=*/false));
+  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
+      new DiagnosticsEngine(DiagID, DiagClient, /*ShouldOwnClient=*/false));
 
   FileRemapper remapper;
   bool err = remapper.initFromDisk(outputDir, *Diags,
@@ -473,8 +473,8 @@
   : OrigCI(CI), DiagClient(diagClient) {
   if (!outputDir.empty()) {
     llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-    llvm::IntrusiveRefCntPtr<Diagnostic> Diags(
-                 new Diagnostic(DiagID, DiagClient, /*ShouldOwnClient=*/false));
+    llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
+      new DiagnosticsEngine(DiagID, DiagClient, /*ShouldOwnClient=*/false));
     Remapper.initFromDisk(outputDir, *Diags, /*ignoreIfFilesChanges=*/true);
   }
 }
@@ -492,8 +492,8 @@
 
   assert(DiagClient);
   llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-  llvm::IntrusiveRefCntPtr<Diagnostic> Diags(
-               new Diagnostic(DiagID, DiagClient, /*ShouldOwnClient=*/false));
+  llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
+      new DiagnosticsEngine(DiagID, DiagClient, /*ShouldOwnClient=*/false));
 
   // Filter of all diagnostics.
   CaptureDiagnosticClient errRec(*Diags, capturedDiags);
@@ -571,7 +571,7 @@
 // isARCDiagnostic.
 //===----------------------------------------------------------------------===//
 
-bool arcmt::isARCDiagnostic(unsigned diagID, Diagnostic &Diag) {
+bool arcmt::isARCDiagnostic(unsigned diagID, DiagnosticsEngine &Diag) {
   return Diag.getDiagnosticIDs()->getCategoryNumberForDiag(diagID) ==
            diag::DiagCat_Automatic_Reference_Counting_Issue;
 }
diff --git a/lib/ARCMigrate/FileRemapper.cpp b/lib/ARCMigrate/FileRemapper.cpp
index 604893e..c6e6ce4 100644
--- a/lib/ARCMigrate/FileRemapper.cpp
+++ b/lib/ARCMigrate/FileRemapper.cpp
@@ -48,7 +48,7 @@
   return infoFile.str();
 }
 
-bool FileRemapper::initFromDisk(StringRef outputDir, Diagnostic &Diag,
+bool FileRemapper::initFromDisk(StringRef outputDir, DiagnosticsEngine &Diag,
                                 bool ignoreIfFilesChanged) {
   assert(FromToMappings.empty() &&
          "initFromDisk should be called before any remap calls");
@@ -102,7 +102,7 @@
   return false;
 }
 
-bool FileRemapper::flushToDisk(StringRef outputDir, Diagnostic &Diag) {
+bool FileRemapper::flushToDisk(StringRef outputDir, DiagnosticsEngine &Diag) {
   using namespace llvm::sys;
 
   bool existed;
@@ -154,7 +154,7 @@
   return false;
 }
 
-bool FileRemapper::overwriteOriginal(Diagnostic &Diag,
+bool FileRemapper::overwriteOriginal(DiagnosticsEngine &Diag,
                                      StringRef outputDir) {
   using namespace llvm::sys;
 
@@ -276,7 +276,7 @@
   }
 }
 
-bool FileRemapper::report(const Twine &err, Diagnostic &Diag) {
+bool FileRemapper::report(const Twine &err, DiagnosticsEngine &Diag) {
   llvm::SmallString<128> buf;
   unsigned ID = Diag.getDiagnosticIDs()->getCustomDiagID(DiagnosticIDs::Error,
                                                          err.toStringRef(buf));
diff --git a/lib/ARCMigrate/Internals.h b/lib/ARCMigrate/Internals.h
index 61eeccb..46f3bb6 100644
--- a/lib/ARCMigrate/Internals.h
+++ b/lib/ARCMigrate/Internals.h
@@ -29,7 +29,7 @@
   bool clearDiagnostic(ArrayRef<unsigned> IDs, SourceRange range);
   bool hasDiagnostic(ArrayRef<unsigned> IDs, SourceRange range) const;
 
-  void reportDiagnostics(Diagnostic &diags) const;
+  void reportDiagnostics(DiagnosticsEngine &diags) const;
 
   bool hasErrors() const;
 
@@ -43,13 +43,13 @@
                           SourceManager &SM, const LangOptions &LangOpts);
 
 class TransformActions {
-  Diagnostic &Diags;
+  DiagnosticsEngine &Diags;
   CapturedDiagList &CapturedDiags;
   bool ReportedErrors;
   void *Impl; // TransformActionsImpl.
 
 public:
-  TransformActions(Diagnostic &diag, CapturedDiagList &capturedDiags,
+  TransformActions(DiagnosticsEngine &diag, CapturedDiagList &capturedDiags,
                    ASTContext &ctx, Preprocessor &PP);
   ~TransformActions();
 
@@ -146,7 +146,7 @@
     : Ctx(Ctx), SemaRef(sema), TA(TA), ARCMTMacroLocs(ARCMTMacroLocs) { }
 };
 
-bool isARCDiagnostic(unsigned diagID, Diagnostic &Diag);
+bool isARCDiagnostic(unsigned diagID, DiagnosticsEngine &Diag);
 
 static inline StringRef getARCMTMacroName() {
   return "__IMPL_ARCMT_REMOVED_EXPR__";
diff --git a/lib/ARCMigrate/PlistReporter.cpp b/lib/ARCMigrate/PlistReporter.cpp
index 81b953d..d1bc90f 100644
--- a/lib/ARCMigrate/PlistReporter.cpp
+++ b/lib/ARCMigrate/PlistReporter.cpp
@@ -150,7 +150,7 @@
     
     const StoredDiagnostic &D = *DI;
 
-    if (D.getLevel() == Diagnostic::Ignored)
+    if (D.getLevel() == DiagnosticsEngine::Ignored)
       continue;
 
     o << "  <dict>\n";
@@ -162,9 +162,9 @@
     EmitString(o, DiagIDs.getCategoryNameFromID(
                           DiagIDs.getCategoryNumberForDiag(D.getID()))) << '\n';
     o << "   <key>type</key>";
-    if (D.getLevel() >= Diagnostic::Error)
+    if (D.getLevel() >= DiagnosticsEngine::Error)
       EmitString(o, "error") << '\n';
-    else if (D.getLevel() == Diagnostic::Warning)
+    else if (D.getLevel() == DiagnosticsEngine::Warning)
       EmitString(o, "warning") << '\n';
     else
       EmitString(o, "note") << '\n';
diff --git a/lib/ARCMigrate/TransformActions.cpp b/lib/ARCMigrate/TransformActions.cpp
index 1321686..ec676e9 100644
--- a/lib/ARCMigrate/TransformActions.cpp
+++ b/lib/ARCMigrate/TransformActions.cpp
@@ -595,7 +595,7 @@
 
 TransformActions::RewriteReceiver::~RewriteReceiver() { }
 
-TransformActions::TransformActions(Diagnostic &diag,
+TransformActions::TransformActions(DiagnosticsEngine &diag,
                                    CapturedDiagList &capturedDiags,
                                    ASTContext &ctx, Preprocessor &PP)
   : Diags(diag), CapturedDiags(capturedDiags), ReportedErrors(false) {
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 5e0143d..4d3d88a 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -485,7 +485,7 @@
   InitBuiltinType(NullPtrTy,           BuiltinType::NullPtr);
 }
 
-Diagnostic &ASTContext::getDiagnostics() const {
+DiagnosticsEngine &ASTContext::getDiagnostics() const {
   return SourceMgr.getDiagnostics();
 }
 
diff --git a/lib/AST/ASTDiagnostic.cpp b/lib/AST/ASTDiagnostic.cpp
index f9100c0..4c115d1 100644
--- a/lib/AST/ASTDiagnostic.cpp
+++ b/lib/AST/ASTDiagnostic.cpp
@@ -152,7 +152,7 @@
 /// diagnostic message
 static std::string
 ConvertTypeToDiagnosticString(ASTContext &Context, QualType Ty,
-                              const Diagnostic::ArgumentValue *PrevArgs,
+                              const DiagnosticsEngine::ArgumentValue *PrevArgs,
                               unsigned NumPrevArgs,
                               SmallVectorImpl<intptr_t> &QualTypeVals) {
   // FIXME: Playing with std::string is really slow.
@@ -186,7 +186,7 @@
   bool Repeated = false;
   for (unsigned i = 0; i != NumPrevArgs; ++i) {
     // TODO: Handle ak_declcontext case.
-    if (PrevArgs[i].first == Diagnostic::ak_qualtype) {
+    if (PrevArgs[i].first == DiagnosticsEngine::ak_qualtype) {
       void *Ptr = (void*)PrevArgs[i].second;
       QualType PrevTy(QualType::getFromOpaquePtr(Ptr));
       if (PrevTy == Ty) {
@@ -218,13 +218,13 @@
 }
 
 void clang::FormatASTNodeDiagnosticArgument(
-    Diagnostic::ArgumentKind Kind,
+    DiagnosticsEngine::ArgumentKind Kind,
     intptr_t Val,
     const char *Modifier,
     unsigned ModLen,
     const char *Argument,
     unsigned ArgLen,
-    const Diagnostic::ArgumentValue *PrevArgs,
+    const DiagnosticsEngine::ArgumentValue *PrevArgs,
     unsigned NumPrevArgs,
     SmallVectorImpl<char> &Output,
     void *Cookie,
@@ -236,7 +236,7 @@
   
   switch (Kind) {
     default: llvm_unreachable("unknown ArgumentKind");
-    case Diagnostic::ak_qualtype: {
+    case DiagnosticsEngine::ak_qualtype: {
       assert(ModLen == 0 && ArgLen == 0 &&
              "Invalid modifier for QualType argument");
       
@@ -246,7 +246,7 @@
       NeedQuotes = false;
       break;
     }
-    case Diagnostic::ak_declarationname: {
+    case DiagnosticsEngine::ak_declarationname: {
       DeclarationName N = DeclarationName::getFromOpaqueInteger(Val);
       S = N.getAsString();
       
@@ -260,7 +260,7 @@
                "Invalid modifier for DeclarationName argument");
       break;
     }
-    case Diagnostic::ak_nameddecl: {
+    case DiagnosticsEngine::ak_nameddecl: {
       bool Qualified;
       if (ModLen == 1 && Modifier[0] == 'q' && ArgLen == 0)
         Qualified = true;
@@ -273,14 +273,14 @@
       ND->getNameForDiagnostic(S, Context.PrintingPolicy, Qualified);
       break;
     }
-    case Diagnostic::ak_nestednamespec: {
+    case DiagnosticsEngine::ak_nestednamespec: {
       llvm::raw_string_ostream OS(S);
       reinterpret_cast<NestedNameSpecifier*>(Val)->print(OS,
                                                         Context.PrintingPolicy);
       NeedQuotes = false;
       break;
     }
-    case Diagnostic::ak_declcontext: {
+    case DiagnosticsEngine::ak_declcontext: {
       DeclContext *DC = reinterpret_cast<DeclContext *> (Val);
       assert(DC && "Should never have a null declaration context");
       
diff --git a/lib/AST/ItaniumMangle.cpp b/lib/AST/ItaniumMangle.cpp
index 78f149c..e94cb2d 100644
--- a/lib/AST/ItaniumMangle.cpp
+++ b/lib/AST/ItaniumMangle.cpp
@@ -73,7 +73,7 @@
   
 public:
   explicit ItaniumMangleContext(ASTContext &Context,
-                                Diagnostic &Diags)
+                                DiagnosticsEngine &Diags)
     : MangleContext(Context, Diags) { }
 
   uint64_t getAnonymousStructId(const TagDecl *TD) {
@@ -2249,8 +2249,8 @@
   case Expr::AsTypeExprClass:
   {
     // As bad as this diagnostic is, it's better than crashing.
-    Diagnostic &Diags = Context.getDiags();
-    unsigned DiagID = Diags.getCustomDiagID(Diagnostic::Error,
+    DiagnosticsEngine &Diags = Context.getDiags();
+    unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
                                      "cannot yet mangle expression type %0");
     Diags.Report(E->getExprLoc(), DiagID)
       << E->getStmtClassName() << E->getSourceRange();
@@ -2259,9 +2259,9 @@
 
   // Even gcc-4.5 doesn't mangle this.
   case Expr::BinaryConditionalOperatorClass: {
-    Diagnostic &Diags = Context.getDiags();
+    DiagnosticsEngine &Diags = Context.getDiags();
     unsigned DiagID =
-      Diags.getCustomDiagID(Diagnostic::Error,
+      Diags.getCustomDiagID(DiagnosticsEngine::Error,
                 "?: operator with omitted middle operand cannot be mangled");
     Diags.Report(E->getExprLoc(), DiagID)
       << E->getStmtClassName() << E->getSourceRange();
@@ -2420,8 +2420,8 @@
       Out << 'a';
       break;
     case UETT_VecStep:
-      Diagnostic &Diags = Context.getDiags();
-      unsigned DiagID = Diags.getCustomDiagID(Diagnostic::Error,
+      DiagnosticsEngine &Diags = Context.getDiags();
+      unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
                                      "cannot yet mangle vec_step expression");
       Diags.Report(DiagID);
       return;
@@ -3333,6 +3333,6 @@
 }
 
 MangleContext *clang::createItaniumMangleContext(ASTContext &Context,
-                                                 Diagnostic &Diags) {
+                                                 DiagnosticsEngine &Diags) {
   return new ItaniumMangleContext(Context, Diags);
 }
diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp
index fd99ee1..a5bfd7d 100644
--- a/lib/AST/MicrosoftMangle.cpp
+++ b/lib/AST/MicrosoftMangle.cpp
@@ -78,7 +78,7 @@
 class MicrosoftMangleContext : public MangleContext {
 public:
   MicrosoftMangleContext(ASTContext &Context,
-                         Diagnostic &Diags) : MangleContext(Context, Diags) { }
+                   DiagnosticsEngine &Diags) : MangleContext(Context, Diags) { }
   virtual bool shouldMangleDeclName(const NamedDecl *D);
   virtual void mangleName(const NamedDecl *D, raw_ostream &Out);
   virtual void mangleThunk(const CXXMethodDecl *MD,
@@ -1176,6 +1176,6 @@
 }
 
 MangleContext *clang::createMicrosoftMangleContext(ASTContext &Context,
-                                                   Diagnostic &Diags) {
+                                                   DiagnosticsEngine &Diags) {
   return new MicrosoftMangleContext(Context, Diags);
 }
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp
index 0e4159d..87a3d1c 100644
--- a/lib/Basic/Diagnostic.cpp
+++ b/lib/Basic/Diagnostic.cpp
@@ -20,10 +20,10 @@
 
 using namespace clang;
 
-static void DummyArgToStringFn(Diagnostic::ArgumentKind AK, intptr_t QT,
+static void DummyArgToStringFn(DiagnosticsEngine::ArgumentKind AK, intptr_t QT,
                                const char *Modifier, unsigned ML,
                                const char *Argument, unsigned ArgLen,
-                               const Diagnostic::ArgumentValue *PrevArgs,
+                               const DiagnosticsEngine::ArgumentValue *PrevArgs,
                                unsigned NumPrevArgs,
                                SmallVectorImpl<char> &Output,
                                void *Cookie,
@@ -33,7 +33,8 @@
 }
 
 
-Diagnostic::Diagnostic(const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &diags,
+DiagnosticsEngine::DiagnosticsEngine(
+                       const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &diags,
                        DiagnosticClient *client, bool ShouldOwnClient)
   : Diags(diags), Client(client), OwnsDiagClient(ShouldOwnClient),
     SourceMgr(0) {
@@ -56,12 +57,13 @@
   Reset();
 }
 
-Diagnostic::~Diagnostic() {
+DiagnosticsEngine::~DiagnosticsEngine() {
   if (OwnsDiagClient)
     delete Client;
 }
 
-void Diagnostic::setClient(DiagnosticClient *client, bool ShouldOwnClient) {
+void DiagnosticsEngine::setClient(DiagnosticClient *client,
+                                  bool ShouldOwnClient) {
   if (OwnsDiagClient && Client)
     delete Client;
   
@@ -69,11 +71,11 @@
   OwnsDiagClient = ShouldOwnClient;
 }
 
-void Diagnostic::pushMappings(SourceLocation Loc) {
+void DiagnosticsEngine::pushMappings(SourceLocation Loc) {
   DiagStateOnPushStack.push_back(GetCurDiagState());
 }
 
-bool Diagnostic::popMappings(SourceLocation Loc) {
+bool DiagnosticsEngine::popMappings(SourceLocation Loc) {
   if (DiagStateOnPushStack.empty())
     return false;
 
@@ -85,7 +87,7 @@
   return true;
 }
 
-void Diagnostic::Reset() {
+void DiagnosticsEngine::Reset() {
   ErrorOccurred = false;
   FatalErrorOccurred = false;
   UnrecoverableErrorOccurred = false;
@@ -98,8 +100,8 @@
   
   CurDiagID = ~0U;
   // Set LastDiagLevel to an "unset" state. If we set it to 'Ignored', notes
-  // using a Diagnostic associated to a translation unit that follow
-  // diagnostics from a Diagnostic associated to anoter t.u. will not be
+  // using a DiagnosticsEngine associated to a translation unit that follow
+  // diagnostics from a DiagnosticsEngine associated to anoter t.u. will not be
   // displayed.
   LastDiagLevel = (DiagnosticIDs::Level)-1;
   DelayedDiagID = 0;
@@ -115,7 +117,7 @@
   PushDiagStatePoint(&DiagStates.back(), SourceLocation());
 }
 
-void Diagnostic::SetDelayedDiagnostic(unsigned DiagID, StringRef Arg1,
+void DiagnosticsEngine::SetDelayedDiagnostic(unsigned DiagID, StringRef Arg1,
                                       StringRef Arg2) {
   if (DelayedDiagID)
     return;
@@ -125,15 +127,15 @@
   DelayedDiagArg2 = Arg2.str();
 }
 
-void Diagnostic::ReportDelayed() {
+void DiagnosticsEngine::ReportDelayed() {
   Report(DelayedDiagID) << DelayedDiagArg1 << DelayedDiagArg2;
   DelayedDiagID = 0;
   DelayedDiagArg1.clear();
   DelayedDiagArg2.clear();
 }
 
-Diagnostic::DiagStatePointsTy::iterator
-Diagnostic::GetDiagStatePointForLoc(SourceLocation L) const {
+DiagnosticsEngine::DiagStatePointsTy::iterator
+DiagnosticsEngine::GetDiagStatePointForLoc(SourceLocation L) const {
   assert(!DiagStatePoints.empty());
   assert(DiagStatePoints.front().Loc.isInvalid() &&
          "Should have created a DiagStatePoint for command-line");
@@ -158,7 +160,7 @@
 ///
 /// \param The source location that this change of diagnostic state should
 /// take affect. It can be null if we are setting the latest state.
-void Diagnostic::setDiagnosticMapping(diag::kind Diag, diag::Mapping Map,
+void DiagnosticsEngine::setDiagnosticMapping(diag::kind Diag, diag::Mapping Map,
                                       SourceLocation L) {
   assert(Diag < diag::DIAG_UPPER_LIMIT &&
          "Can only map builtin diagnostics");
@@ -218,7 +220,7 @@
                                                FullSourceLoc(Loc, *SourceMgr)));
 }
 
-void Diagnostic::Report(const StoredDiagnostic &storedDiag) {
+void DiagnosticsEngine::Report(const StoredDiagnostic &storedDiag) {
   assert(CurDiagID == ~0U && "Multiple diagnostics in flight at once!");
 
   CurDiagLoc = storedDiag.getLocation();
@@ -235,7 +237,8 @@
     DiagRanges[i++] = *RI;
 
   NumFixItHints = storedDiag.fixit_size();
-  assert(NumFixItHints < Diagnostic::MaxFixItHints && "Too many fix-it hints!");
+  assert(NumFixItHints < DiagnosticsEngine::MaxFixItHints &&
+      "Too many fix-it hints!");
   i = 0;
   for (StoredDiagnostic::fixit_iterator
          FI = storedDiag.fixit_begin(),
@@ -247,7 +250,7 @@
   DiagnosticInfo Info(this, storedDiag.getMessage());
   Client->HandleDiagnostic(DiagLevel, Info);
   if (Client->IncludeInDiagnosticCounts()) {
-    if (DiagLevel == Diagnostic::Warning)
+    if (DiagLevel == DiagnosticsEngine::Warning)
       ++NumWarnings;
   }
 
@@ -266,7 +269,7 @@
   if (DiagObj == 0) return false;
 
   // When emitting diagnostics, we set the final argument count into
-  // the Diagnostic object.
+  // the DiagnosticsEngine object.
   FlushCounts();
 
   // Process the diagnostic, sending the accumulated information to the
@@ -290,14 +293,14 @@
 
 DiagnosticClient::~DiagnosticClient() {}
 
-void DiagnosticClient::HandleDiagnostic(Diagnostic::Level DiagLevel,
+void DiagnosticClient::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
                                         const DiagnosticInfo &Info) {
   if (!IncludeInDiagnosticCounts())
     return;
 
-  if (DiagLevel == Diagnostic::Warning)
+  if (DiagLevel == DiagnosticsEngine::Warning)
     ++NumWarnings;
-  else if (DiagLevel >= Diagnostic::Error)
+  else if (DiagLevel >= DiagnosticsEngine::Error)
     ++NumErrors;
 }
 
@@ -547,13 +550,13 @@
   /// ConvertArgToString and pass them into subsequent calls to
   /// ConvertArgToString, allowing the implementation to avoid redundancies in
   /// obvious cases.
-  SmallVector<Diagnostic::ArgumentValue, 8> FormattedArgs;
+  SmallVector<DiagnosticsEngine::ArgumentValue, 8> FormattedArgs;
 
   /// QualTypeVals - Pass a vector of arrays so that QualType names can be
   /// compared to see if more information is needed to be printed.
   SmallVector<intptr_t, 2> QualTypeVals;
   for (unsigned i = 0, e = getNumArgs(); i < e; ++i)
-    if (getArgKind(i) == Diagnostic::ak_qualtype)
+    if (getArgKind(i) == DiagnosticsEngine::ak_qualtype)
       QualTypeVals.push_back(getRawArg(i));
 
   while (DiagStr != DiagEnd) {
@@ -603,17 +606,17 @@
     assert(isdigit(*DiagStr) && "Invalid format for argument in diagnostic");
     unsigned ArgNo = *DiagStr++ - '0';
 
-    Diagnostic::ArgumentKind Kind = getArgKind(ArgNo);
+    DiagnosticsEngine::ArgumentKind Kind = getArgKind(ArgNo);
     
     switch (Kind) {
     // ---- STRINGS ----
-    case Diagnostic::ak_std_string: {
+    case DiagnosticsEngine::ak_std_string: {
       const std::string &S = getArgStdStr(ArgNo);
       assert(ModifierLen == 0 && "No modifiers for strings yet");
       OutStr.append(S.begin(), S.end());
       break;
     }
-    case Diagnostic::ak_c_string: {
+    case DiagnosticsEngine::ak_c_string: {
       const char *S = getArgCStr(ArgNo);
       assert(ModifierLen == 0 && "No modifiers for strings yet");
 
@@ -625,7 +628,7 @@
       break;
     }
     // ---- INTEGERS ----
-    case Diagnostic::ak_sint: {
+    case DiagnosticsEngine::ak_sint: {
       int Val = getArgSInt(ArgNo);
 
       if (ModifierIs(Modifier, ModifierLen, "select")) {
@@ -644,7 +647,7 @@
       }
       break;
     }
-    case Diagnostic::ak_uint: {
+    case DiagnosticsEngine::ak_uint: {
       unsigned Val = getArgUInt(ArgNo);
 
       if (ModifierIs(Modifier, ModifierLen, "select")) {
@@ -663,7 +666,7 @@
       break;
     }
     // ---- NAMES and TYPES ----
-    case Diagnostic::ak_identifierinfo: {
+    case DiagnosticsEngine::ak_identifierinfo: {
       const IdentifierInfo *II = getArgIdentifier(ArgNo);
       assert(ModifierLen == 0 && "No modifiers for strings yet");
 
@@ -677,11 +680,11 @@
       llvm::raw_svector_ostream(OutStr) << '\'' << II->getName() << '\'';
       break;
     }
-    case Diagnostic::ak_qualtype:
-    case Diagnostic::ak_declarationname:
-    case Diagnostic::ak_nameddecl:
-    case Diagnostic::ak_nestednamespec:
-    case Diagnostic::ak_declcontext:
+    case DiagnosticsEngine::ak_qualtype:
+    case DiagnosticsEngine::ak_declarationname:
+    case DiagnosticsEngine::ak_nameddecl:
+    case DiagnosticsEngine::ak_nestednamespec:
+    case DiagnosticsEngine::ak_declcontext:
       getDiags()->ConvertArgToString(Kind, getRawArg(ArgNo),
                                      Modifier, ModifierLen,
                                      Argument, ArgumentLen,
@@ -693,10 +696,10 @@
     // Remember this argument info for subsequent formatting operations.  Turn
     // std::strings into a null terminated string to make it be the same case as
     // all the other ones.
-    if (Kind != Diagnostic::ak_std_string)
+    if (Kind != DiagnosticsEngine::ak_std_string)
       FormattedArgs.push_back(std::make_pair(Kind, getRawArg(ArgNo)));
     else
-      FormattedArgs.push_back(std::make_pair(Diagnostic::ak_c_string,
+      FormattedArgs.push_back(std::make_pair(DiagnosticsEngine::ak_c_string,
                                         (intptr_t)getArgStdStr(ArgNo).c_str()));
     
   }
@@ -704,11 +707,11 @@
 
 StoredDiagnostic::StoredDiagnostic() { }
 
-StoredDiagnostic::StoredDiagnostic(Diagnostic::Level Level, unsigned ID,
+StoredDiagnostic::StoredDiagnostic(DiagnosticsEngine::Level Level, unsigned ID,
                                    StringRef Message)
   : ID(ID), Level(Level), Loc(), Message(Message) { }
 
-StoredDiagnostic::StoredDiagnostic(Diagnostic::Level Level, 
+StoredDiagnostic::StoredDiagnostic(DiagnosticsEngine::Level Level, 
                                    const DiagnosticInfo &Info)
   : ID(Info.getID()), Level(Level) 
 {
@@ -729,7 +732,7 @@
     FixIts.push_back(Info.getFixItHint(I));
 }
 
-StoredDiagnostic::StoredDiagnostic(Diagnostic::Level Level, unsigned ID, 
+StoredDiagnostic::StoredDiagnostic(DiagnosticsEngine::Level Level, unsigned ID,
                                    StringRef Message, FullSourceLoc Loc,
                                    ArrayRef<CharSourceRange> Ranges,
                                    ArrayRef<FixItHint> Fixits)
@@ -744,7 +747,7 @@
 /// IncludeInDiagnosticCounts - This method (whose default implementation
 ///  returns true) indicates whether the diagnostics handled by this
 ///  DiagnosticClient should be included in the number of diagnostics
-///  reported by Diagnostic.
+///  reported by DiagnosticsEngine.
 bool DiagnosticClient::IncludeInDiagnosticCounts() const { return true; }
 
 PartialDiagnostic::StorageAllocator::StorageAllocator() {
diff --git a/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp
index dab4663..eda2f8e 100644
--- a/lib/Basic/DiagnosticIDs.cpp
+++ b/lib/Basic/DiagnosticIDs.cpp
@@ -446,12 +446,12 @@
   return CustomDiagInfo->getDescription(DiagID);
 }
 
-/// getDiagnosticLevel - Based on the way the client configured the Diagnostic
-/// object, classify the specified diagnostic ID into a Level, consumable by
-/// the DiagnosticClient.
+/// getDiagnosticLevel - Based on the way the client configured the
+/// DiagnosticsEngine object, classify the specified diagnostic ID into a Level,
+/// by consumable the DiagnosticClient.
 DiagnosticIDs::Level
 DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, SourceLocation Loc,
-                                  const Diagnostic &Diag,
+                                  const DiagnosticsEngine &Diag,
                                   diag::Mapping *mapping) const {
   // Handle custom diagnostics, which cannot be mapped.
   if (DiagID >= diag::DIAG_UPPER_LIMIT)
@@ -471,15 +471,15 @@
 DiagnosticIDs::Level
 DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass,
                                   SourceLocation Loc,
-                                  const Diagnostic &Diag,
+                                  const DiagnosticsEngine &Diag,
                                   diag::Mapping *mapping) const {
   // Specific non-error diagnostics may be mapped to various levels from ignored
   // to error.  Errors can only be mapped to fatal.
   DiagnosticIDs::Level Result = DiagnosticIDs::Fatal;
 
-  Diagnostic::DiagStatePointsTy::iterator
+  DiagnosticsEngine::DiagStatePointsTy::iterator
     Pos = Diag.GetDiagStatePointForLoc(Loc);
-  Diagnostic::DiagState *State = Pos->State;
+  DiagnosticsEngine::DiagState *State = Pos->State;
 
   // Get the mapping information, if unset, compute it lazily.
   unsigned MappingInfo = Diag.getDiagnosticMappingInfo((diag::kind)DiagID,
@@ -508,7 +508,7 @@
     // Otherwise, ignore this diagnostic unless this is an extension diagnostic
     // and we're mapping them onto warnings or errors.
     else if (!isBuiltinExtensionDiag(DiagID) ||  // Not an extension
-             Diag.ExtBehavior == Diagnostic::Ext_Ignore || // Ext ignored
+             Diag.ExtBehavior == DiagnosticsEngine::Ext_Ignore || // Ext ignored
              (MappingInfo & 8) != 0) {           // User explicitly mapped it.
       return DiagnosticIDs::Ignored;
     }
@@ -516,7 +516,7 @@
       Result = DiagnosticIDs::Warning;
     }
 
-    if (Diag.ExtBehavior == Diagnostic::Ext_Error)
+    if (Diag.ExtBehavior == DiagnosticsEngine::Ext_Error)
       Result = DiagnosticIDs::Error;
     if (Result == DiagnosticIDs::Error && Diag.ErrorsAsFatal)
       Result = DiagnosticIDs::Fatal;
@@ -541,7 +541,7 @@
 
     // If this is an extension diagnostic and we're in -pedantic-error mode, and
     // if the user didn't explicitly map it, upgrade to an error.
-    if (Diag.ExtBehavior == Diagnostic::Ext_Error &&
+    if (Diag.ExtBehavior == DiagnosticsEngine::Ext_Error &&
         (MappingInfo & 8) == 0 &&
         isBuiltinExtensionDiag(DiagID))
       Result = DiagnosticIDs::Error;
@@ -628,7 +628,7 @@
 }
 
 static void MapGroupMembers(const WarningOption *Group, diag::Mapping Mapping,
-                            SourceLocation Loc, Diagnostic &Diag) {
+                            SourceLocation Loc, DiagnosticsEngine &Diag) {
   // Option exists, poke all the members of its diagnostic set.
   if (const short *Member = Group->Members) {
     for (; *Member != -1; ++Member)
@@ -648,7 +648,7 @@
 bool DiagnosticIDs::setDiagnosticGroupMapping(StringRef Group,
                                               diag::Mapping Map,
                                               SourceLocation Loc,
-                                              Diagnostic &Diag) const {
+                                              DiagnosticsEngine &Diag) const {
   assert((Loc.isValid() ||
           Diag.DiagStatePoints.empty() ||
           Diag.DiagStatePoints.back().Loc.isInvalid()) &&
@@ -673,7 +673,7 @@
 
 /// ProcessDiag - This is the method used to report a diagnostic that is
 /// finally fully formed.
-bool DiagnosticIDs::ProcessDiag(Diagnostic &Diag) const {
+bool DiagnosticIDs::ProcessDiag(DiagnosticsEngine &Diag) const {
   DiagnosticInfo Info(&Diag);
 
   if (Diag.SuppressAllDiagnostics)
@@ -770,7 +770,7 @@
   }
   
   // Finally, report it.
-  Diag.Client->HandleDiagnostic((Diagnostic::Level)DiagLevel, Info);
+  Diag.Client->HandleDiagnostic((DiagnosticsEngine::Level)DiagLevel, Info);
   if (Diag.Client->IncludeInDiagnosticCounts()) {
     if (DiagLevel == DiagnosticIDs::Warning)
       ++Diag.NumWarnings;
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp
index f15c5dc..410d4df 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/lib/Basic/SourceManager.cpp
@@ -80,7 +80,7 @@
   Buffer.setInt(DoNotFree? DoNotFreeFlag : 0);
 }
 
-const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag,
+const llvm::MemoryBuffer *ContentCache::getBuffer(DiagnosticsEngine &Diag,
                                                   const SourceManager &SM,
                                                   SourceLocation Loc,
                                                   bool *Invalid) const {
@@ -364,7 +364,7 @@
 // Private 'Create' methods.
 //===----------------------------------------------------------------------===//
 
-SourceManager::SourceManager(Diagnostic &Diag, FileManager &FileMgr)
+SourceManager::SourceManager(DiagnosticsEngine &Diag, FileManager &FileMgr)
   : Diag(Diag), FileMgr(FileMgr), OverridenFilesKeepOriginalName(true),
     ExternalSLocEntries(0), LineTable(0), NumLinearScans(0),
     NumBinaryProbes(0), FakeBufferForRecovery(0) {
@@ -971,10 +971,10 @@
 }
 
 static LLVM_ATTRIBUTE_NOINLINE void
-ComputeLineNumbers(Diagnostic &Diag, ContentCache *FI,
+ComputeLineNumbers(DiagnosticsEngine &Diag, ContentCache *FI,
                    llvm::BumpPtrAllocator &Alloc,
                    const SourceManager &SM, bool &Invalid);
-static void ComputeLineNumbers(Diagnostic &Diag, ContentCache *FI, 
+static void ComputeLineNumbers(DiagnosticsEngine &Diag, ContentCache *FI,
                                llvm::BumpPtrAllocator &Alloc,
                                const SourceManager &SM, bool &Invalid) {
   // Note that calling 'getBuffer()' may lazily page in the file.
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 8d30c2c..5ee4408 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -3293,7 +3293,7 @@
 
 /// CreateTargetInfo - Return the target info object for the specified target
 /// triple.
-TargetInfo *TargetInfo::CreateTargetInfo(Diagnostic &Diags,
+TargetInfo *TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags,
                                          TargetOptions &Opts) {
   llvm::Triple Triple(Opts.Triple);
 
diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp
index 9346cf3..b9e3ed9 100644
--- a/lib/CodeGen/BackendUtil.cpp
+++ b/lib/CodeGen/BackendUtil.cpp
@@ -41,7 +41,7 @@
 namespace {
 
 class EmitAssemblyHelper {
-  Diagnostic &Diags;
+  DiagnosticsEngine &Diags;
   const CodeGenOptions &CodeGenOpts;
   const TargetOptions &TargetOpts;
   const LangOptions &LangOpts;
@@ -86,7 +86,7 @@
   bool AddEmitPasses(BackendAction Action, formatted_raw_ostream &OS);
 
 public:
-  EmitAssemblyHelper(Diagnostic &_Diags,
+  EmitAssemblyHelper(DiagnosticsEngine &_Diags,
                      const CodeGenOptions &CGOpts, const TargetOptions &TOpts,
                      const LangOptions &LOpts,
                      Module *M)
@@ -395,7 +395,8 @@
   }
 }
 
-void clang::EmitBackendOutput(Diagnostic &Diags, const CodeGenOptions &CGOpts,
+void clang::EmitBackendOutput(DiagnosticsEngine &Diags,
+                              const CodeGenOptions &CGOpts,
                               const TargetOptions &TOpts,
                               const LangOptions &LOpts,
                               Module *M,
diff --git a/lib/CodeGen/CGCXXABI.cpp b/lib/CodeGen/CGCXXABI.cpp
index 8106507..248448c 100644
--- a/lib/CodeGen/CGCXXABI.cpp
+++ b/lib/CodeGen/CGCXXABI.cpp
@@ -21,8 +21,8 @@
 
 static void ErrorUnsupportedABI(CodeGenFunction &CGF,
                                 StringRef S) {
-  Diagnostic &Diags = CGF.CGM.getDiags();
-  unsigned DiagID = Diags.getCustomDiagID(Diagnostic::Error,
+  DiagnosticsEngine &Diags = CGF.CGM.getDiags();
+  unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
                                           "cannot yet compile %1 in this ABI");
   Diags.Report(CGF.getContext().getFullLoc(CGF.CurCodeDecl->getLocation()),
                DiagID)
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index fed79db..bdb0b57 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -1590,7 +1590,7 @@
   }
   
   assert(Diag && "Fall through without a diagnostic?");
-  unsigned DiagID = CGM.getDiags().getCustomDiagID(Diagnostic::Error,
+  unsigned DiagID = CGM.getDiags().getCustomDiagID(DiagnosticsEngine::Error,
                                "debug information for %0 is not yet supported");
   CGM.getDiags().Report(DiagID)
     << Diag;
diff --git a/lib/CodeGen/CodeGenAction.cpp b/lib/CodeGen/CodeGenAction.cpp
index f266ba9..68dd5c9 100644
--- a/lib/CodeGen/CodeGenAction.cpp
+++ b/lib/CodeGen/CodeGenAction.cpp
@@ -30,7 +30,7 @@
 
 namespace clang {
   class BackendConsumer : public ASTConsumer {
-    Diagnostic &Diags;
+    DiagnosticsEngine &Diags;
     BackendAction Action;
     const CodeGenOptions &CodeGenOpts;
     const TargetOptions &TargetOpts;
@@ -45,7 +45,7 @@
     llvm::OwningPtr<llvm::Module> TheModule;
 
   public:
-    BackendConsumer(BackendAction action, Diagnostic &_Diags,
+    BackendConsumer(BackendAction action, DiagnosticsEngine &_Diags,
                     const CodeGenOptions &compopts,
                     const TargetOptions &targetopts,
                     const LangOptions &langopts,
@@ -328,8 +328,8 @@
       StringRef Msg = Err.getMessage();
       if (Msg.startswith("error: "))
         Msg = Msg.substr(7);
-      unsigned DiagID = CI.getDiagnostics().getCustomDiagID(Diagnostic::Error,
-                                                            Msg);
+      unsigned DiagID = CI.getDiagnostics().getCustomDiagID(
+          DiagnosticsEngine::Error, Msg);
 
       CI.getDiagnostics().Report(Loc, DiagID);
       return;
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index e4633f9..408a870 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -60,7 +60,7 @@
 
 CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO,
                              llvm::Module &M, const llvm::TargetData &TD,
-                             Diagnostic &diags)
+                             DiagnosticsEngine &diags)
   : Context(C), Features(C.getLangOptions()), CodeGenOpts(CGO), TheModule(M),
     TheTargetData(TD), TheTargetCodeGenInfo(0), Diags(diags),
     ABI(createCXXABI(*this)), 
@@ -178,7 +178,7 @@
 }
 
 void CodeGenModule::Error(SourceLocation loc, StringRef error) {
-  unsigned diagID = getDiags().getCustomDiagID(Diagnostic::Error, error);
+  unsigned diagID = getDiags().getCustomDiagID(DiagnosticsEngine::Error, error);
   getDiags().Report(Context.getFullLoc(loc), diagID);
 }
 
@@ -188,7 +188,7 @@
                                      bool OmitOnError) {
   if (OmitOnError && getDiags().hasErrorOccurred())
     return;
-  unsigned DiagID = getDiags().getCustomDiagID(Diagnostic::Error,
+  unsigned DiagID = getDiags().getCustomDiagID(DiagnosticsEngine::Error,
                                                "cannot compile this %0 yet");
   std::string Msg = Type;
   getDiags().Report(Context.getFullLoc(S->getLocStart()), DiagID)
@@ -201,7 +201,7 @@
                                      bool OmitOnError) {
   if (OmitOnError && getDiags().hasErrorOccurred())
     return;
-  unsigned DiagID = getDiags().getCustomDiagID(Diagnostic::Error,
+  unsigned DiagID = getDiags().getCustomDiagID(DiagnosticsEngine::Error,
                                                "cannot compile this %0 yet");
   std::string Msg = Type;
   getDiags().Report(Context.getFullLoc(D->getLocation()), DiagID) << Msg;
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h
index a5938d9..c190fa3 100644
--- a/lib/CodeGen/CodeGenModule.h
+++ b/lib/CodeGen/CodeGenModule.h
@@ -62,7 +62,7 @@
   class VarDecl;
   class LangOptions;
   class CodeGenOptions;
-  class Diagnostic;
+  class DiagnosticsEngine;
   class AnnotateAttr;
   class CXXDestructorDecl;
   class MangleBuffer;
@@ -217,7 +217,7 @@
   llvm::Module &TheModule;
   const llvm::TargetData &TheTargetData;
   mutable const TargetCodeGenInfo *TheTargetCodeGenInfo;
-  Diagnostic &Diags;
+  DiagnosticsEngine &Diags;
   CGCXXABI &ABI;
   CodeGenTypes Types;
   CodeGenTBAA *TBAA;
@@ -342,7 +342,8 @@
   /// @}
 public:
   CodeGenModule(ASTContext &C, const CodeGenOptions &CodeGenOpts,
-                llvm::Module &M, const llvm::TargetData &TD, Diagnostic &Diags);
+                llvm::Module &M, const llvm::TargetData &TD,
+                DiagnosticsEngine &Diags);
 
   ~CodeGenModule();
 
@@ -395,7 +396,7 @@
   llvm::Module &getModule() const { return TheModule; }
   CodeGenTypes &getTypes() { return Types; }
   CodeGenVTables &getVTables() { return VTables; }
-  Diagnostic &getDiags() const { return Diags; }
+  DiagnosticsEngine &getDiags() const { return Diags; }
   const llvm::TargetData &getTargetData() const { return TheTargetData; }
   const TargetInfo &getTarget() const { return Context.getTargetInfo(); }
   llvm::LLVMContext &getLLVMContext() { return VMContext; }
diff --git a/lib/CodeGen/ModuleBuilder.cpp b/lib/CodeGen/ModuleBuilder.cpp
index 24f75f1..793ee91 100644
--- a/lib/CodeGen/ModuleBuilder.cpp
+++ b/lib/CodeGen/ModuleBuilder.cpp
@@ -27,7 +27,7 @@
 
 namespace {
   class CodeGeneratorImpl : public CodeGenerator {
-    Diagnostic &Diags;
+    DiagnosticsEngine &Diags;
     llvm::OwningPtr<const llvm::TargetData> TD;
     ASTContext *Ctx;
     const CodeGenOptions CodeGenOpts;  // Intentionally copied in.
@@ -35,7 +35,7 @@
     llvm::OwningPtr<llvm::Module> M;
     llvm::OwningPtr<CodeGen::CodeGenModule> Builder;
   public:
-    CodeGeneratorImpl(Diagnostic &diags, const std::string& ModuleName,
+    CodeGeneratorImpl(DiagnosticsEngine &diags, const std::string& ModuleName,
                       const CodeGenOptions &CGO, llvm::LLVMContext& C)
       : Diags(diags), CodeGenOpts(CGO), M(new llvm::Module(ModuleName, C)) {}
 
@@ -112,7 +112,7 @@
   };
 }
 
-CodeGenerator *clang::CreateLLVMCodeGen(Diagnostic &Diags,
+CodeGenerator *clang::CreateLLVMCodeGen(DiagnosticsEngine &Diags,
                                         const std::string& ModuleName,
                                         const CodeGenOptions &CGO,
                                         llvm::LLVMContext& C) {
diff --git a/lib/Driver/ArgList.cpp b/lib/Driver/ArgList.cpp
index 6f7cbb6..ca9b944 100644
--- a/lib/Driver/ArgList.cpp
+++ b/lib/Driver/ArgList.cpp
@@ -136,7 +136,7 @@
 }
 
 int ArgList::getLastArgIntValue(OptSpecifier Id, int Default,
-                                clang::Diagnostic &Diags) const {
+                                clang::DiagnosticsEngine &Diags) const {
   int Res = Default;
 
   if (Arg *A = getLastArg(Id)) {
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 5be7e63..121abc8 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -51,7 +51,7 @@
                StringRef DefaultHostTriple,
                StringRef DefaultImageName,
                bool IsProduction, bool CXXIsProduction,
-               Diagnostic &Diags)
+               DiagnosticsEngine &Diags)
   : Opts(createDriverOptTable()), Diags(Diags),
     ClangExecutable(ClangExecutable), UseStdLib(true),
     DefaultHostTriple(DefaultHostTriple), DefaultImageName(DefaultImageName),
@@ -1197,7 +1197,8 @@
     Arg *A = *it;
 
     // FIXME: It would be nice to be able to send the argument to the
-    // Diagnostic, so that extra values, position, and so on could be printed.
+    // DiagnosticsEngine, so that extra values, position, and so on could be
+    // printed.
     if (!A->isClaimed()) {
       if (A->getOption().hasNoArgumentUnused())
         continue;
diff --git a/lib/Frontend/ASTMerge.cpp b/lib/Frontend/ASTMerge.cpp
index 74aa5a6..cb195d1 100644
--- a/lib/Frontend/ASTMerge.cpp
+++ b/lib/Frontend/ASTMerge.cpp
@@ -41,8 +41,8 @@
   llvm::IntrusiveRefCntPtr<DiagnosticIDs>
       DiagIDs(CI.getDiagnostics().getDiagnosticIDs());
   for (unsigned I = 0, N = ASTFiles.size(); I != N; ++I) {
-    llvm::IntrusiveRefCntPtr<Diagnostic>
-        Diags(new Diagnostic(DiagIDs, CI.getDiagnostics().getClient(),
+    llvm::IntrusiveRefCntPtr<DiagnosticsEngine>
+        Diags(new DiagnosticsEngine(DiagIDs, CI.getDiagnostics().getClient(),
                              /*ShouldOwnClient=*/false));
     ASTUnit *Unit = ASTUnit::LoadFromASTFile(ASTFiles[I], Diags,
                                              CI.getFileSystemOpts(), false);
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp
index 19b8ccb..21f6afa 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/lib/Frontend/ASTUnit.cpp
@@ -456,19 +456,19 @@
                           SmallVectorImpl<StoredDiagnostic> &StoredDiags)
     : StoredDiags(StoredDiags) { }
   
-  virtual void HandleDiagnostic(Diagnostic::Level Level,
+  virtual void HandleDiagnostic(DiagnosticsEngine::Level Level,
                                 const DiagnosticInfo &Info);
 };
 
 /// \brief RAII object that optionally captures diagnostics, if
 /// there is no diagnostic client to capture them already.
 class CaptureDroppedDiagnostics {
-  Diagnostic &Diags;
+  DiagnosticsEngine &Diags;
   StoredDiagnosticClient Client;
   DiagnosticClient *PreviousClient;
 
 public:
-  CaptureDroppedDiagnostics(bool RequestCapture, Diagnostic &Diags, 
+  CaptureDroppedDiagnostics(bool RequestCapture, DiagnosticsEngine &Diags,
                           SmallVectorImpl<StoredDiagnostic> &StoredDiags)
     : Diags(Diags), Client(StoredDiags), PreviousClient(0)
   {
@@ -488,7 +488,7 @@
 
 } // anonymous namespace
 
-void StoredDiagnosticClient::HandleDiagnostic(Diagnostic::Level Level,
+void StoredDiagnosticClient::HandleDiagnostic(DiagnosticsEngine::Level Level,
                                               const DiagnosticInfo &Info) {
   // Default implementation (Warnings/errors count).
   DiagnosticClient::HandleDiagnostic(Level, Info);
@@ -507,7 +507,7 @@
 }
 
 /// \brief Configure the diagnostics object for use with ASTUnit.
-void ASTUnit::ConfigureDiags(llvm::IntrusiveRefCntPtr<Diagnostic> &Diags,
+void ASTUnit::ConfigureDiags(llvm::IntrusiveRefCntPtr<DiagnosticsEngine> &Diags,
                              const char **ArgBegin, const char **ArgEnd,
                              ASTUnit &AST, bool CaptureDiagnostics) {
   if (!Diags.getPtr()) {
@@ -525,7 +525,7 @@
 }
 
 ASTUnit *ASTUnit::LoadFromASTFile(const std::string &Filename,
-                                  llvm::IntrusiveRefCntPtr<Diagnostic> Diags,
+                              llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
                                   const FileSystemOptions &FileSystemOpts,
                                   bool OnlyLocalDecls,
                                   RemappedFile *RemappedFiles,
@@ -536,8 +536,8 @@
   // Recover resources if we crash before exiting this method.
   llvm::CrashRecoveryContextCleanupRegistrar<ASTUnit>
     ASTUnitCleanup(AST.get());
-  llvm::CrashRecoveryContextCleanupRegistrar<Diagnostic,
-    llvm::CrashRecoveryContextReleaseRefCleanup<Diagnostic> >
+  llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine,
+    llvm::CrashRecoveryContextReleaseRefCleanup<DiagnosticsEngine> >
     DiagCleanup(Diags.getPtr());
 
   ConfigureDiags(Diags, 0, 0, *AST, CaptureDiagnostics);
@@ -1498,7 +1498,7 @@
 }
 
 ASTUnit *ASTUnit::create(CompilerInvocation *CI,
-                         llvm::IntrusiveRefCntPtr<Diagnostic> Diags) {
+                         llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags) {
   llvm::OwningPtr<ASTUnit> AST;
   AST.reset(new ASTUnit(false));
   ConfigureDiags(Diags, 0, 0, *AST, /*CaptureDiagnostics=*/false);
@@ -1512,7 +1512,7 @@
 }
 
 ASTUnit *ASTUnit::LoadFromCompilerInvocationAction(CompilerInvocation *CI,
-                                   llvm::IntrusiveRefCntPtr<Diagnostic> Diags,
+                              llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
                                              ASTFrontendAction *Action) {
   assert(CI && "A CompilerInvocation is required");
 
@@ -1530,8 +1530,8 @@
   // Recover resources if we crash before exiting this method.
   llvm::CrashRecoveryContextCleanupRegistrar<ASTUnit>
     ASTUnitCleanup(AST.get());
-  llvm::CrashRecoveryContextCleanupRegistrar<Diagnostic,
-    llvm::CrashRecoveryContextReleaseRefCleanup<Diagnostic> >
+  llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine,
+    llvm::CrashRecoveryContextReleaseRefCleanup<DiagnosticsEngine> >
     DiagCleanup(Diags.getPtr());
 
   // We'll manage file buffers ourselves.
@@ -1653,7 +1653,7 @@
 }
 
 ASTUnit *ASTUnit::LoadFromCompilerInvocation(CompilerInvocation *CI,
-                                   llvm::IntrusiveRefCntPtr<Diagnostic> Diags,
+                              llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
                                              bool OnlyLocalDecls,
                                              bool CaptureDiagnostics,
                                              bool PrecompilePreamble,
@@ -1675,8 +1675,8 @@
   // Recover resources if we crash before exiting this method.
   llvm::CrashRecoveryContextCleanupRegistrar<ASTUnit>
     ASTUnitCleanup(AST.get());
-  llvm::CrashRecoveryContextCleanupRegistrar<Diagnostic,
-    llvm::CrashRecoveryContextReleaseRefCleanup<Diagnostic> >
+  llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine,
+    llvm::CrashRecoveryContextReleaseRefCleanup<DiagnosticsEngine> >
     DiagCleanup(Diags.getPtr());
 
   return AST->LoadFromCompilerInvocation(PrecompilePreamble)? 0 : AST.take();
@@ -1684,7 +1684,7 @@
 
 ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin,
                                       const char **ArgEnd,
-                                    llvm::IntrusiveRefCntPtr<Diagnostic> Diags,
+                                    llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
                                       StringRef ResourceFilesPath,
                                       bool OnlyLocalDecls,
                                       bool CaptureDiagnostics,
@@ -1759,8 +1759,8 @@
   llvm::CrashRecoveryContextCleanupRegistrar<CompilerInvocation,
     llvm::CrashRecoveryContextReleaseRefCleanup<CompilerInvocation> >
     CICleanup(CI.getPtr());
-  llvm::CrashRecoveryContextCleanupRegistrar<Diagnostic,
-    llvm::CrashRecoveryContextReleaseRefCleanup<Diagnostic> >
+  llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine,
+    llvm::CrashRecoveryContextReleaseRefCleanup<DiagnosticsEngine> >
     DiagCleanup(Diags.getPtr());
 
   return AST->LoadFromCompilerInvocation(PrecompilePreamble) ? 0 : AST.take();
@@ -2070,7 +2070,7 @@
                            bool IncludeMacros, 
                            bool IncludeCodePatterns,
                            CodeCompleteConsumer &Consumer,
-                           Diagnostic &Diag, LangOptions &LangOpts,
+                           DiagnosticsEngine &Diag, LangOptions &LangOpts,
                            SourceManager &SourceMgr, FileManager &FileMgr,
                    SmallVectorImpl<StoredDiagnostic> &StoredDiagnostics,
              SmallVectorImpl<const llvm::MemoryBuffer *> &OwnedBuffers) {
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index 924864c..ab65c3e 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -53,7 +53,7 @@
   Invocation = Value;
 }
 
-void CompilerInstance::setDiagnostics(Diagnostic *Value) {
+void CompilerInstance::setDiagnostics(DiagnosticsEngine *Value) {
   Diagnostics = Value;
 }
 
@@ -88,7 +88,7 @@
 // Diagnostics
 static void SetUpBuildDumpLog(const DiagnosticOptions &DiagOpts,
                               unsigned argc, const char* const *argv,
-                              Diagnostic &Diags) {
+                              DiagnosticsEngine &Diags) {
   std::string ErrorInfo;
   llvm::OwningPtr<raw_ostream> OS(
     new llvm::raw_fd_ostream(DiagOpts.DumpBuildInformation.c_str(), ErrorInfo));
@@ -111,7 +111,7 @@
 
 static void SetUpDiagnosticLog(const DiagnosticOptions &DiagOpts,
                                const CodeGenOptions *CodeGenOpts,
-                               Diagnostic &Diags) {
+                               DiagnosticsEngine &Diags) {
   std::string ErrorInfo;
   bool OwnsStream = false;
   raw_ostream *OS = &llvm::errs();
@@ -146,14 +146,15 @@
                                   ShouldOwnClient, &getCodeGenOpts());
 }
 
-llvm::IntrusiveRefCntPtr<Diagnostic> 
+llvm::IntrusiveRefCntPtr<DiagnosticsEngine> 
 CompilerInstance::createDiagnostics(const DiagnosticOptions &Opts,
                                     int Argc, const char* const *Argv,
                                     DiagnosticClient *Client,
                                     bool ShouldOwnClient,
                                     const CodeGenOptions *CodeGenOpts) {
   llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-  llvm::IntrusiveRefCntPtr<Diagnostic> Diags(new Diagnostic(DiagID));
+  llvm::IntrusiveRefCntPtr<DiagnosticsEngine>
+      Diags(new DiagnosticsEngine(DiagID));
 
   // Create the diagnostic client for reporting errors or for
   // implementing -verify.
@@ -535,7 +536,7 @@
 }
 
 bool CompilerInstance::InitializeSourceManager(StringRef InputFile,
-                                               Diagnostic &Diags,
+                                               DiagnosticsEngine &Diags,
                                                FileManager &FileMgr,
                                                SourceManager &SourceMgr,
                                                const FrontendOptions &Opts) {
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 03d06e6..3426e19 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -872,7 +872,7 @@
 //
 
 static unsigned getOptimizationLevel(ArgList &Args, InputKind IK,
-                                     Diagnostic &Diags) {
+                                     DiagnosticsEngine &Diags) {
   unsigned DefaultOpt = 0;
   if (IK == IK_OpenCL && !Args.hasArg(OPT_cl_opt_disable))
     DefaultOpt = 2;
@@ -882,7 +882,7 @@
 }
 
 static void ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
-                              Diagnostic &Diags) {
+                              DiagnosticsEngine &Diags) {
   using namespace cc1options;
 
   if (Arg *A = Args.getLastArg(OPT_analyzer_store)) {
@@ -967,7 +967,7 @@
 }
 
 static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
-                             Diagnostic &Diags) {
+                             DiagnosticsEngine &Diags) {
   using namespace cc1options;
 
   Opts.OptimizationLevel = getOptimizationLevel(Args, IK, Diags);
@@ -1069,7 +1069,7 @@
 }
 
 static void ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
-                                Diagnostic &Diags) {
+                                DiagnosticsEngine &Diags) {
   using namespace cc1options;
   Opts.DiagnosticLogFile = Args.getLastArgValue(OPT_diagnostic_log_file);
   Opts.IgnoreWarnings = Args.hasArg(OPT_w);
@@ -1096,9 +1096,9 @@
   StringRef ShowOverloads =
     Args.getLastArgValue(OPT_fshow_overloads_EQ, "all");
   if (ShowOverloads == "best")
-    Opts.ShowOverloads = Diagnostic::Ovl_Best;
+    Opts.ShowOverloads = DiagnosticsEngine::Ovl_Best;
   else if (ShowOverloads == "all")
-    Opts.ShowOverloads = Diagnostic::Ovl_All;
+    Opts.ShowOverloads = DiagnosticsEngine::Ovl_All;
   else
     Diags.Report(diag::err_drv_invalid_value)
       << Args.getLastArg(OPT_fshow_overloads_EQ)->getAsString(Args)
@@ -1158,7 +1158,7 @@
 }
 
 static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
-                                   Diagnostic &Diags) {
+                                   DiagnosticsEngine &Diags) {
   using namespace cc1options;
   Opts.ProgramAction = frontend::ParseSyntaxOnly;
   if (const Arg *A = Args.getLastArg(OPT_Action_Group)) {
@@ -1518,7 +1518,7 @@
 }
 
 static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
-                          Diagnostic &Diags) {
+                          DiagnosticsEngine &Diags) {
   // FIXME: Cleanup per-file based stuff.
   LangStandard::Kind LangStd = LangStandard::lang_unspecified;
   if (const Arg *A = Args.getLastArg(OPT_std_EQ)) {
@@ -1748,7 +1748,7 @@
 
 static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
                                   FileManager &FileMgr,
-                                  Diagnostic &Diags) {
+                                  DiagnosticsEngine &Diags) {
   using namespace cc1options;
   Opts.ImplicitPCHInclude = Args.getLastArgValue(OPT_include_pch);
   Opts.ImplicitPTHInclude = Args.getLastArgValue(OPT_include_pth);
@@ -1879,7 +1879,7 @@
 void CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
                                         const char *const *ArgBegin,
                                         const char *const *ArgEnd,
-                                        Diagnostic &Diags) {
+                                        DiagnosticsEngine &Diags) {
   // Parse the arguments.
   llvm::OwningPtr<OptTable> Opts(createCC1OptTable());
   unsigned MissingArgIndex, MissingArgCount;
diff --git a/lib/Frontend/CreateInvocationFromCommandLine.cpp b/lib/Frontend/CreateInvocationFromCommandLine.cpp
index 8fdc06d..ccfa865 100644
--- a/lib/Frontend/CreateInvocationFromCommandLine.cpp
+++ b/lib/Frontend/CreateInvocationFromCommandLine.cpp
@@ -30,7 +30,7 @@
 /// argument vector.
 CompilerInvocation *
 clang::createInvocationFromCommandLine(ArrayRef<const char *> ArgList,
-                                   llvm::IntrusiveRefCntPtr<Diagnostic> Diags) {
+                            llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags) {
   if (!Diags.getPtr()) {
     // No diagnostics engine was provided, so create our own diagnostics object
     // with the default options.
diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp
index 1bbcedd..ba2d63b 100644
--- a/lib/Frontend/FrontendAction.cpp
+++ b/lib/Frontend/FrontendAction.cpp
@@ -66,7 +66,7 @@
       if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
         if (NamesToCheck.find(ND->getNameAsString()) != NamesToCheck.end()) {
           unsigned DiagID
-            = Ctx.getDiagnostics().getCustomDiagID(Diagnostic::Error,
+            = Ctx.getDiagnostics().getCustomDiagID(DiagnosticsEngine::Error,
                                                    "%0 was deserialized");
           Ctx.getDiagnostics().Report(Ctx.getFullLoc(D->getLocation()), DiagID)
               << ND->getNameAsString();
@@ -142,7 +142,7 @@
     assert(hasASTFileSupport() &&
            "This action does not have AST file support!");
 
-    llvm::IntrusiveRefCntPtr<Diagnostic> Diags(&CI.getDiagnostics());
+    llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(&CI.getDiagnostics());
     std::string Error;
     ASTUnit *AST = ASTUnit::LoadFromASTFile(Filename, Diags,
                                             CI.getFileSystemOpts());
diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp
index ae3152a..4c0c11e 100644
--- a/lib/Frontend/InitPreprocessor.cpp
+++ b/lib/Frontend/InitPreprocessor.cpp
@@ -31,7 +31,7 @@
 // in which case we emit "#define XXX 1" or "XXX=Y z W" in which case we emit
 // "#define XXX Y z W".  To get a #define with no value, use "XXX=".
 static void DefineBuiltinMacro(MacroBuilder &Builder, StringRef Macro,
-                               Diagnostic &Diags) {
+                               DiagnosticsEngine &Diags) {
   std::pair<StringRef, StringRef> MacroPair = Macro.split('=');
   StringRef MacroName = MacroPair.first;
   StringRef MacroBody = MacroPair.second;
@@ -631,7 +631,7 @@
 
 // Initialize the remapping of files to alternative contents, e.g.,
 // those specified through other files.
-static void InitializeFileRemapping(Diagnostic &Diags,
+static void InitializeFileRemapping(DiagnosticsEngine &Diags,
                                     SourceManager &SourceMgr,
                                     FileManager &FileMgr,
                                     const PreprocessorOptions &InitOpts) {
diff --git a/lib/Frontend/LogDiagnosticPrinter.cpp b/lib/Frontend/LogDiagnosticPrinter.cpp
index 52e40ef..00cd85d 100644
--- a/lib/Frontend/LogDiagnosticPrinter.cpp
+++ b/lib/Frontend/LogDiagnosticPrinter.cpp
@@ -26,15 +26,15 @@
     delete &OS;
 }
 
-static StringRef getLevelName(Diagnostic::Level Level) {
+static StringRef getLevelName(DiagnosticsEngine::Level Level) {
   switch (Level) {
   default:
     return "<unknown>";
-  case Diagnostic::Ignored: return "ignored";
-  case Diagnostic::Note:    return "note";
-  case Diagnostic::Warning: return "warning";
-  case Diagnostic::Error:   return "error";
-  case Diagnostic::Fatal:   return "fatal error";
+  case DiagnosticsEngine::Ignored: return "ignored";
+  case DiagnosticsEngine::Note:    return "note";
+  case DiagnosticsEngine::Warning: return "warning";
+  case DiagnosticsEngine::Error:   return "error";
+  case DiagnosticsEngine::Fatal:   return "fatal error";
   }
 }
 
@@ -93,7 +93,7 @@
   this->OS << OS.str();
 }
 
-void LogDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
+void LogDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,
                                             const DiagnosticInfo &Info) {
   // Default implementation (Warnings/errors count).
   DiagnosticClient::HandleDiagnostic(Level, Info);
diff --git a/lib/Frontend/TextDiagnosticBuffer.cpp b/lib/Frontend/TextDiagnosticBuffer.cpp
index f540fca..b615d71 100644
--- a/lib/Frontend/TextDiagnosticBuffer.cpp
+++ b/lib/Frontend/TextDiagnosticBuffer.cpp
@@ -19,7 +19,7 @@
 /// HandleDiagnostic - Store the errors, warnings, and notes that are
 /// reported.
 ///
-void TextDiagnosticBuffer::HandleDiagnostic(Diagnostic::Level Level,
+void TextDiagnosticBuffer::HandleDiagnostic(DiagnosticsEngine::Level Level,
                                             const DiagnosticInfo &Info) {
   // Default implementation (Warnings/errors count).
   DiagnosticClient::HandleDiagnostic(Level, Info);
@@ -29,25 +29,28 @@
   switch (Level) {
   default: llvm_unreachable(
                          "Diagnostic not handled during diagnostic buffering!");
-  case Diagnostic::Note:
+  case DiagnosticsEngine::Note:
     Notes.push_back(std::make_pair(Info.getLocation(), Buf.str()));
     break;
-  case Diagnostic::Warning:
+  case DiagnosticsEngine::Warning:
     Warnings.push_back(std::make_pair(Info.getLocation(), Buf.str()));
     break;
-  case Diagnostic::Error:
-  case Diagnostic::Fatal:
+  case DiagnosticsEngine::Error:
+  case DiagnosticsEngine::Fatal:
     Errors.push_back(std::make_pair(Info.getLocation(), Buf.str()));
     break;
   }
 }
 
-void TextDiagnosticBuffer::FlushDiagnostics(Diagnostic &Diags) const {
+void TextDiagnosticBuffer::FlushDiagnostics(DiagnosticsEngine &Diags) const {
   // FIXME: Flush the diagnostics in order.
   for (const_iterator it = err_begin(), ie = err_end(); it != ie; ++it)
-    Diags.Report(Diags.getCustomDiagID(Diagnostic::Error, it->second.c_str()));
+    Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Error,
+                 it->second.c_str()));
   for (const_iterator it = warn_begin(), ie = warn_end(); it != ie; ++it)
-    Diags.Report(Diags.getCustomDiagID(Diagnostic::Warning,it->second.c_str()));
+    Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Warning,
+                 it->second.c_str()));
   for (const_iterator it = note_begin(), ie = note_end(); it != ie; ++it)
-    Diags.Report(Diags.getCustomDiagID(Diagnostic::Note, it->second.c_str()));
+    Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Note,
+                 it->second.c_str()));
 }
diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp
index 34dad73..53f532e 100644
--- a/lib/Frontend/TextDiagnosticPrinter.cpp
+++ b/lib/Frontend/TextDiagnosticPrinter.cpp
@@ -88,7 +88,7 @@
 /// \param Level The diagnostic level of the message this stack pertains to.
 /// \param Loc   The include location of the current file (not the diagnostic
 ///              location).
-void TextDiagnosticPrinter::PrintIncludeStack(Diagnostic::Level Level,
+void TextDiagnosticPrinter::PrintIncludeStack(DiagnosticsEngine::Level Level,
                                               SourceLocation Loc,
                                               const SourceManager &SM) {
   // Skip redundant include stacks altogether.
@@ -96,7 +96,7 @@
     return;
   LastWarningLoc = Loc;
 
-  if (!DiagOpts->ShowNoteIncludeStack && Level == Diagnostic::Note)
+  if (!DiagOpts->ShowNoteIncludeStack && Level == DiagnosticsEngine::Note)
     return;
 
   PrintIncludeStackRecursively(OS, SM, Loc, DiagOpts->ShowLocation);
@@ -402,7 +402,8 @@
 
       // If this diagnostic is not in the main file, print out the
       // "included from" lines.
-      Printer.PrintIncludeStack(Diagnostic::Note, PLoc.getIncludeLoc(), SM);
+      Printer.PrintIncludeStack(DiagnosticsEngine::Note, PLoc.getIncludeLoc(), 
+                                SM);
 
       if (DiagOpts.ShowLocation) {
         // Emit the file/line/column that this expansion came from.
@@ -956,7 +957,7 @@
 /// This includes extracting as much location information as is present for the
 /// diagnostic and printing it, as well as any include stack or source ranges
 /// necessary.
-void TextDiagnosticPrinter::EmitDiagnosticLoc(Diagnostic::Level Level,
+void TextDiagnosticPrinter::EmitDiagnosticLoc(DiagnosticsEngine::Level Level,
                                               const DiagnosticInfo &Info,
                                               const SourceManager &SM,
                                               PresumedLoc PLoc) {
@@ -1058,7 +1059,7 @@
   OS << ' ';
 }
 
-void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
+void TextDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,
                                              const DiagnosticInfo &Info) {
   // Default implementation (Warnings/errors count).
   DiagnosticClient::HandleDiagnostic(Level, Info);
@@ -1091,20 +1092,20 @@
   if (DiagOpts->ShowColors) {
     // Print diagnostic category in bold and color
     switch (Level) {
-    case Diagnostic::Ignored: llvm_unreachable("Invalid diagnostic type");
-    case Diagnostic::Note:    OS.changeColor(noteColor, true); break;
-    case Diagnostic::Warning: OS.changeColor(warningColor, true); break;
-    case Diagnostic::Error:   OS.changeColor(errorColor, true); break;
-    case Diagnostic::Fatal:   OS.changeColor(fatalColor, true); break;
+    case DiagnosticsEngine::Ignored: llvm_unreachable("Invalid diagnostic type");
+    case DiagnosticsEngine::Note:    OS.changeColor(noteColor, true); break;
+    case DiagnosticsEngine::Warning: OS.changeColor(warningColor, true); break;
+    case DiagnosticsEngine::Error:   OS.changeColor(errorColor, true); break;
+    case DiagnosticsEngine::Fatal:   OS.changeColor(fatalColor, true); break;
     }
   }
 
   switch (Level) {
-  case Diagnostic::Ignored: llvm_unreachable("Invalid diagnostic type");
-  case Diagnostic::Note:    OS << "note: "; break;
-  case Diagnostic::Warning: OS << "warning: "; break;
-  case Diagnostic::Error:   OS << "error: "; break;
-  case Diagnostic::Fatal:   OS << "fatal error: "; break;
+  case DiagnosticsEngine::Ignored: llvm_unreachable("Invalid diagnostic type");
+  case DiagnosticsEngine::Note:    OS << "note: "; break;
+  case DiagnosticsEngine::Warning: OS << "warning: "; break;
+  case DiagnosticsEngine::Error:   OS << "error: "; break;
+  case DiagnosticsEngine::Fatal:   OS << "fatal error: "; break;
   }
 
   if (DiagOpts->ShowColors)
@@ -1123,7 +1124,7 @@
   std::string OptionName;
   if (DiagOpts->ShowOptionNames) {
     // Was this a warning mapped to an error using -Werror or pragma?
-    if (Level == Diagnostic::Error &&
+    if (Level == DiagnosticsEngine::Error &&
         DiagnosticIDs::isBuiltinWarningOrExtension(Info.getID())) {
       diag::Mapping mapping = diag::MAP_IGNORE;
       Info.getDiags()->getDiagnosticLevel(Info.getID(), Info.getLocation(), 
@@ -1183,9 +1184,9 @@
   if (DiagOpts->ShowColors) {
     // Print warnings, errors and fatal errors in bold, no color
     switch (Level) {
-    case Diagnostic::Warning: OS.changeColor(savedColor, true); break;
-    case Diagnostic::Error:   OS.changeColor(savedColor, true); break;
-    case Diagnostic::Fatal:   OS.changeColor(savedColor, true); break;
+    case DiagnosticsEngine::Warning: OS.changeColor(savedColor, true); break;
+    case DiagnosticsEngine::Error:   OS.changeColor(savedColor, true); break;
+    case DiagnosticsEngine::Fatal:   OS.changeColor(savedColor, true); break;
     default: break; //don't bold notes
     }
   }
@@ -1211,11 +1212,11 @@
   // multiple times if one loc has multiple diagnostics.
   if (DiagOpts->ShowCarets && Info.getLocation().isValid() &&
       ((LastLoc != Info.getLocation()) || Info.getNumRanges() ||
-       (LastCaretDiagnosticWasNote && Level != Diagnostic::Note) ||
+       (LastCaretDiagnosticWasNote && Level != DiagnosticsEngine::Note) ||
        Info.getNumFixItHints())) {
     // Cache the LastLoc, it allows us to omit duplicate source/caret spewage.
     LastLoc = FullSourceLoc(Info.getLocation(), Info.getSourceManager());
-    LastCaretDiagnosticWasNote = (Level == Diagnostic::Note);
+    LastCaretDiagnosticWasNote = (Level == DiagnosticsEngine::Note);
 
     // Get the ranges into a local array we can hack on.
     SmallVector<CharSourceRange, 20> Ranges;
diff --git a/lib/Frontend/VerifyDiagnosticsClient.cpp b/lib/Frontend/VerifyDiagnosticsClient.cpp
index 69eb887..aaac282 100644
--- a/lib/Frontend/VerifyDiagnosticsClient.cpp
+++ b/lib/Frontend/VerifyDiagnosticsClient.cpp
@@ -20,7 +20,7 @@
 #include "llvm/Support/raw_ostream.h"
 using namespace clang;
 
-VerifyDiagnosticsClient::VerifyDiagnosticsClient(Diagnostic &_Diags)
+VerifyDiagnosticsClient::VerifyDiagnosticsClient(DiagnosticsEngine &_Diags)
   : Diags(_Diags), PrimaryClient(Diags.getClient()),
     OwnsPrimaryClient(Diags.ownsClient()),
     Buffer(new TextDiagnosticBuffer()), CurrentPreprocessor(0) 
@@ -55,8 +55,8 @@
   CurrentPreprocessor = 0;
 }
 
-void VerifyDiagnosticsClient::HandleDiagnostic(Diagnostic::Level DiagLevel,
-                                              const DiagnosticInfo &Info) {
+void VerifyDiagnosticsClient::HandleDiagnostic(
+      DiagnosticsEngine::Level DiagLevel, const DiagnosticInfo &Info) {
   if (FirstErrorFID.isInvalid() && Info.hasSourceManager()) {
     const SourceManager &SM = Info.getSourceManager();
     FirstErrorFID = SM.getFileID(Info.getLocation());
@@ -364,7 +364,7 @@
 /// happened. Print the map out in a nice format and return "true". If the map
 /// is empty and we're not going to print things, then return "false".
 ///
-static unsigned PrintProblem(Diagnostic &Diags, SourceManager *SourceMgr,
+static unsigned PrintProblem(DiagnosticsEngine &Diags, SourceManager *SourceMgr,
                              const_diag_iterator diag_begin,
                              const_diag_iterator diag_end,
                              const char *Kind, bool Expected) {
@@ -385,7 +385,7 @@
   return std::distance(diag_begin, diag_end);
 }
 
-static unsigned PrintProblem(Diagnostic &Diags, SourceManager *SourceMgr,
+static unsigned PrintProblem(DiagnosticsEngine &Diags, SourceManager *SourceMgr,
                              DirectiveList &DL, const char *Kind,
                              bool Expected) {
   if (DL.empty())
@@ -410,7 +410,7 @@
 /// CheckLists - Compare expected to seen diagnostic lists and return the
 /// the difference between them.
 ///
-static unsigned CheckLists(Diagnostic &Diags, SourceManager &SourceMgr,
+static unsigned CheckLists(DiagnosticsEngine &Diags, SourceManager &SourceMgr,
                            const char *Label,
                            DirectiveList &Left,
                            const_diag_iterator d2_begin,
@@ -453,7 +453,7 @@
 /// were actually reported. It emits any discrepencies. Return "true" if there
 /// were problems. Return "false" otherwise.
 ///
-static unsigned CheckResults(Diagnostic &Diags, SourceManager &SourceMgr,
+static unsigned CheckResults(DiagnosticsEngine &Diags, SourceManager &SourceMgr,
                              const TextDiagnosticBuffer &Buffer,
                              ExpectedData &ED) {
   // We want to capture the delta between what was expected and what was
diff --git a/lib/Frontend/Warnings.cpp b/lib/Frontend/Warnings.cpp
index d24779e..14a7f01 100644
--- a/lib/Frontend/Warnings.cpp
+++ b/lib/Frontend/Warnings.cpp
@@ -31,12 +31,12 @@
 #include <algorithm>
 using namespace clang;
 
-void clang::ProcessWarningOptions(Diagnostic &Diags,
+void clang::ProcessWarningOptions(DiagnosticsEngine &Diags,
                                   const DiagnosticOptions &Opts) {
   Diags.setSuppressSystemWarnings(true);  // Default to -Wno-system-headers
   Diags.setIgnoreAllWarnings(Opts.IgnoreWarnings);
   Diags.setShowOverloads(
-    static_cast<Diagnostic::OverloadsShown>(Opts.ShowOverloads));
+    static_cast<DiagnosticsEngine::OverloadsShown>(Opts.ShowOverloads));
   
   // Handle -ferror-limit
   if (Opts.ErrorLimit)
@@ -48,11 +48,11 @@
   // extension diagnostics onto WARNING or ERROR unless the user has futz'd
   // around with them explicitly.
   if (Opts.PedanticErrors)
-    Diags.setExtensionHandlingBehavior(Diagnostic::Ext_Error);
+    Diags.setExtensionHandlingBehavior(DiagnosticsEngine::Ext_Error);
   else if (Opts.Pedantic)
-    Diags.setExtensionHandlingBehavior(Diagnostic::Ext_Warn);
+    Diags.setExtensionHandlingBehavior(DiagnosticsEngine::Ext_Warn);
   else
-    Diags.setExtensionHandlingBehavior(Diagnostic::Ext_Ignore);
+    Diags.setExtensionHandlingBehavior(DiagnosticsEngine::Ext_Ignore);
 
   for (unsigned i = 0, e = Opts.Warnings.size(); i != e; ++i) {
     StringRef Opt = Opts.Warnings[i];
diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp
index e780d69..ef385a8 100644
--- a/lib/Lex/LiteralSupport.cpp
+++ b/lib/Lex/LiteralSupport.cpp
@@ -53,7 +53,7 @@
 static unsigned ProcessCharEscape(const char *&ThisTokBuf,
                                   const char *ThisTokEnd, bool &HadError,
                                   FullSourceLoc Loc, unsigned CharWidth,
-                                  Diagnostic *Diags) {
+                                  DiagnosticsEngine *Diags) {
   // Skip the '\' char.
   ++ThisTokBuf;
 
@@ -180,7 +180,7 @@
 /// return the UTF32.
 static bool ProcessUCNEscape(const char *&ThisTokBuf, const char *ThisTokEnd,
                              uint32_t &UcnVal, unsigned short &UcnLen,
-                             FullSourceLoc Loc, Diagnostic *Diags, 
+                             FullSourceLoc Loc, DiagnosticsEngine *Diags, 
                              const LangOptions &Features) {
   if (!Features.CPlusPlus && !Features.C99 && Diags)
     Diags->Report(Loc, diag::warn_ucn_not_valid_in_c89);
@@ -234,7 +234,8 @@
 static void EncodeUCNEscape(const char *&ThisTokBuf, const char *ThisTokEnd,
                             char *&ResultBuf, bool &HadError,
                             FullSourceLoc Loc, unsigned CharByteWidth,
-                            Diagnostic *Diags, const LangOptions &Features) {
+                            DiagnosticsEngine *Diags,
+                            const LangOptions &Features) {
   typedef uint32_t UTF32;
   UTF32 UcnVal = 0;
   unsigned short UcnLen = 0;
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp
index 1f54ef5..b242c8b 100644
--- a/lib/Lex/PPDirectives.cpp
+++ b/lib/Lex/PPDirectives.cpp
@@ -1616,7 +1616,7 @@
   // warn-because-unused-macro set. If it gets used it will be removed from set.
   if (isInPrimaryFile() && // don't warn for include'd macros.
       Diags->getDiagnosticLevel(diag::pp_macro_not_used,
-                               MI->getDefinitionLoc()) != Diagnostic::Ignored) {
+          MI->getDefinitionLoc()) != DiagnosticsEngine::Ignored) {
     MI->setIsWarnIfUnused(true);
     WarnUnusedMacroLocs.insert(MI->getDefinitionLoc());
   }
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index cfe9374..5a603b6 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -690,7 +690,8 @@
 
   // If the use of an extension results in an error diagnostic, extensions are
   // effectively unavailable, so just return false here.
-  if (PP.getDiagnostics().getExtensionHandlingBehavior()==Diagnostic::Ext_Error)
+  if (PP.getDiagnostics().getExtensionHandlingBehavior() ==
+      DiagnosticsEngine::Ext_Error)
     return false;
 
   const LangOptions &LangOpts = PP.getLangOptions();
diff --git a/lib/Lex/PTHLexer.cpp b/lib/Lex/PTHLexer.cpp
index 0d48ade..e0c4cf0 100644
--- a/lib/Lex/PTHLexer.cpp
+++ b/lib/Lex/PTHLexer.cpp
@@ -431,11 +431,12 @@
   free(PerIDCache);
 }
 
-static void InvalidPTH(Diagnostic &Diags, const char *Msg) {
-  Diags.Report(Diags.getCustomDiagID(Diagnostic::Error, Msg));
+static void InvalidPTH(DiagnosticsEngine &Diags, const char *Msg) {
+  Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Error, Msg));
 }
 
-PTHManager *PTHManager::Create(const std::string &file, Diagnostic &Diags) {
+PTHManager *PTHManager::Create(const std::string &file,
+                               DiagnosticsEngine &Diags) {
   // Memory map the PTH file.
   llvm::OwningPtr<llvm::MemoryBuffer> File;
 
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index 8c1004b..2937b60 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -49,7 +49,7 @@
 //===----------------------------------------------------------------------===//
 ExternalPreprocessorSource::~ExternalPreprocessorSource() { }
 
-Preprocessor::Preprocessor(Diagnostic &diags, LangOptions &opts,
+Preprocessor::Preprocessor(DiagnosticsEngine &diags, LangOptions &opts,
                            const TargetInfo *target, SourceManager &SM,
                            HeaderSearch &Headers, ModuleLoader &TheModuleLoader,
                            IdentifierInfoLookup* IILookup,
diff --git a/lib/Parse/RAIIObjectsForParser.h b/lib/Parse/RAIIObjectsForParser.h
index 3765f92..ef17aee 100644
--- a/lib/Parse/RAIIObjectsForParser.h
+++ b/lib/Parse/RAIIObjectsForParser.h
@@ -30,9 +30,9 @@
   class ExtensionRAIIObject {
     void operator=(const ExtensionRAIIObject &);     // DO NOT IMPLEMENT
     ExtensionRAIIObject(const ExtensionRAIIObject&); // DO NOT IMPLEMENT
-    Diagnostic &Diags;
+    DiagnosticsEngine &Diags;
   public:
-    ExtensionRAIIObject(Diagnostic &diags) : Diags(diags) {
+    ExtensionRAIIObject(DiagnosticsEngine &diags) : Diags(diags) {
       Diags.IncrementAllExtensionsSilenced();
     }
 
diff --git a/lib/Rewrite/FixItRewriter.cpp b/lib/Rewrite/FixItRewriter.cpp
index 706b6ea..4ef7bc3 100644
--- a/lib/Rewrite/FixItRewriter.cpp
+++ b/lib/Rewrite/FixItRewriter.cpp
@@ -25,7 +25,7 @@
 
 using namespace clang;
 
-FixItRewriter::FixItRewriter(Diagnostic &Diags, SourceManager &SourceMgr,
+FixItRewriter::FixItRewriter(DiagnosticsEngine &Diags, SourceManager &SourceMgr,
                              const LangOptions &LangOpts,
                              FixItOptions *FixItOpts)
   : Diags(Diags),
@@ -78,7 +78,7 @@
   return Client ? Client->IncludeInDiagnosticCounts() : true;
 }
 
-void FixItRewriter::HandleDiagnostic(Diagnostic::Level DiagLevel,
+void FixItRewriter::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
                                      const DiagnosticInfo &Info) {
   // Default implementation (Warnings/errors count).
   DiagnosticClient::HandleDiagnostic(DiagLevel, Info);
@@ -86,7 +86,7 @@
   Client->HandleDiagnostic(DiagLevel, Info);
 
   // Skip over any diagnostics that are ignored or notes.
-  if (DiagLevel <= Diagnostic::Note)
+  if (DiagLevel <= DiagnosticsEngine::Note)
     return;
 
   // Make sure that we can perform all of the modifications we
@@ -107,7 +107,8 @@
       Diag(Info.getLocation(), diag::note_fixit_in_macro);
 
     // If this was an error, refuse to perform any rewriting.
-    if (DiagLevel == Diagnostic::Error || DiagLevel == Diagnostic::Fatal) {
+    if (DiagLevel == DiagnosticsEngine::Error ||
+          DiagLevel == DiagnosticsEngine::Fatal) {
       if (++NumFailures == 1)
         Diag(Info.getLocation(), diag::note_fixit_unfixed_error);
     }
diff --git a/lib/Rewrite/HTMLRewrite.cpp b/lib/Rewrite/HTMLRewrite.cpp
index 3b78158..fae44a3 100644
--- a/lib/Rewrite/HTMLRewrite.cpp
+++ b/lib/Rewrite/HTMLRewrite.cpp
@@ -444,7 +444,7 @@
 /// IgnoringDiagClient - This is a diagnostic client that just ignores all
 /// diags.
 class IgnoringDiagClient : public DiagnosticClient {
-  void HandleDiagnostic(Diagnostic::Level DiagLevel,
+  void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
                         const DiagnosticInfo &Info) {
     // Just ignore it.
   }
@@ -493,14 +493,14 @@
 
   // Temporarily change the diagnostics object so that we ignore any generated
   // diagnostics from this pass.
-  Diagnostic TmpDiags(PP.getDiagnostics().getDiagnosticIDs(),
+  DiagnosticsEngine TmpDiags(PP.getDiagnostics().getDiagnosticIDs(),
                       new IgnoringDiagClient);
 
   // FIXME: This is a huge hack; we reuse the input preprocessor because we want
   // its state, but we aren't actually changing it (we hope). This should really
   // construct a copy of the preprocessor.
   Preprocessor &TmpPP = const_cast<Preprocessor&>(PP);
-  Diagnostic *OldDiags = &TmpPP.getDiagnostics();
+  DiagnosticsEngine *OldDiags = &TmpPP.getDiagnostics();
   TmpPP.setDiagnostics(TmpDiags);
 
   // Inform the preprocessor that we don't want comments.
diff --git a/lib/Rewrite/RewriteObjC.cpp b/lib/Rewrite/RewriteObjC.cpp
index 4f9c174..57d1210 100644
--- a/lib/Rewrite/RewriteObjC.cpp
+++ b/lib/Rewrite/RewriteObjC.cpp
@@ -55,7 +55,7 @@
     };
     
     Rewriter Rewrite;
-    Diagnostic &Diags;
+    DiagnosticsEngine &Diags;
     const LangOptions &LangOpts;
     unsigned RewriteFailedDiag;
     unsigned TryFinallyContainsReturnDiag;
@@ -172,7 +172,7 @@
     void HandleTopLevelSingleDecl(Decl *D);
     void HandleDeclInMainFile(Decl *D);
     RewriteObjC(std::string inFile, raw_ostream *OS,
-                Diagnostic &D, const LangOptions &LOpts,
+                DiagnosticsEngine &D, const LangOptions &LOpts,
                 bool silenceMacroWarn);
 
     ~RewriteObjC() {}
@@ -523,21 +523,22 @@
 }
 
 RewriteObjC::RewriteObjC(std::string inFile, raw_ostream* OS,
-                         Diagnostic &D, const LangOptions &LOpts,
+                         DiagnosticsEngine &D, const LangOptions &LOpts,
                          bool silenceMacroWarn)
       : Diags(D), LangOpts(LOpts), InFileName(inFile), OutFile(OS),
         SilenceRewriteMacroWarning(silenceMacroWarn) {
   IsHeader = IsHeaderFile(inFile);
-  RewriteFailedDiag = Diags.getCustomDiagID(Diagnostic::Warning,
+  RewriteFailedDiag = Diags.getCustomDiagID(DiagnosticsEngine::Warning,
                "rewriting sub-expression within a macro (may not be correct)");
-  TryFinallyContainsReturnDiag = Diags.getCustomDiagID(Diagnostic::Warning,
+  TryFinallyContainsReturnDiag = Diags.getCustomDiagID(
+               DiagnosticsEngine::Warning,
                "rewriter doesn't support user-specified control flow semantics "
                "for @try/@finally (code may not execute properly)");
 }
 
 ASTConsumer *clang::CreateObjCRewriter(const std::string& InFile,
                                        raw_ostream* OS,
-                                       Diagnostic &Diags,
+                                       DiagnosticsEngine &Diags,
                                        const LangOptions &LOpts,
                                        bool SilenceRewriteMacroWarning) {
   return new RewriteObjC(InFile, OS, Diags, LOpts, SilenceRewriteMacroWarning);
diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp
index 15800b3..e42370d 100644
--- a/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/lib/Sema/AnalysisBasedWarnings.cpp
@@ -265,25 +265,25 @@
     return D;
   }
 
-  bool checkDiagnostics(Diagnostic &D, bool ReturnsVoid,
+  bool checkDiagnostics(DiagnosticsEngine &D, bool ReturnsVoid,
                         bool HasNoReturn) const {
     if (funMode) {
       return (ReturnsVoid ||
               D.getDiagnosticLevel(diag::warn_maybe_falloff_nonvoid_function,
-                                   FuncLoc) == Diagnostic::Ignored)
+                                   FuncLoc) == DiagnosticsEngine::Ignored)
         && (!HasNoReturn ||
             D.getDiagnosticLevel(diag::warn_noreturn_function_has_return_expr,
-                                 FuncLoc) == Diagnostic::Ignored)
+                                 FuncLoc) == DiagnosticsEngine::Ignored)
         && (!ReturnsVoid ||
             D.getDiagnosticLevel(diag::warn_suggest_noreturn_block, FuncLoc)
-              == Diagnostic::Ignored);
+              == DiagnosticsEngine::Ignored);
     }
 
     // For blocks.
     return  ReturnsVoid && !HasNoReturn
             && (!ReturnsVoid ||
                 D.getDiagnosticLevel(diag::warn_suggest_noreturn_block, FuncLoc)
-                  == Diagnostic::Ignored);
+                  == DiagnosticsEngine::Ignored);
   }
 };
 
@@ -321,7 +321,7 @@
     }
   }
 
-  Diagnostic &Diags = S.getDiagnostics();
+  DiagnosticsEngine &Diags = S.getDiagnostics();
 
   // Short circuit for compilation speed.
   if (CD.checkDiagnostics(Diags, ReturnsVoid, HasNoReturn))
@@ -723,13 +723,13 @@
     MaxUninitAnalysisVariablesPerFunction(0),
     NumUninitAnalysisBlockVisits(0),
     MaxUninitAnalysisBlockVisitsPerFunction(0) {
-  Diagnostic &D = S.getDiagnostics();
+  DiagnosticsEngine &D = S.getDiagnostics();
   DefaultPolicy.enableCheckUnreachable = (unsigned)
     (D.getDiagnosticLevel(diag::warn_unreachable, SourceLocation()) !=
-        Diagnostic::Ignored);
+        DiagnosticsEngine::Ignored);
   DefaultPolicy.enableThreadSafetyAnalysis = (unsigned)
     (D.getDiagnosticLevel(diag::warn_double_lock, SourceLocation()) !=
-     Diagnostic::Ignored);
+     DiagnosticsEngine::Ignored);
 
 }
 
@@ -754,7 +754,7 @@
   //     don't bother trying.
   // (2) The code already has problems; running the analysis just takes more
   //     time.
-  Diagnostic &Diags = S.getDiagnostics();
+  DiagnosticsEngine &Diags = S.getDiagnostics();
 
   // Do not do any analysis for declarations in system headers if we are
   // going to just ignore them.
@@ -870,9 +870,9 @@
   }
 
   if (Diags.getDiagnosticLevel(diag::warn_uninit_var, D->getLocStart())
-      != Diagnostic::Ignored ||
+      != DiagnosticsEngine::Ignored ||
       Diags.getDiagnosticLevel(diag::warn_maybe_uninit_var, D->getLocStart())
-      != Diagnostic::Ignored) {
+      != DiagnosticsEngine::Ignored) {
     if (CFG *cfg = AC.getCFG()) {
       UninitValsDiagReporter reporter(S);
       UninitVariablesAnalysisStats stats;
diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp
index 7e2f4ad..e4d76c8 100644
--- a/lib/Sema/DeclSpec.cpp
+++ b/lib/Sema/DeclSpec.cpp
@@ -27,7 +27,7 @@
 using namespace clang;
 
 
-static DiagnosticBuilder Diag(Diagnostic &D, SourceLocation Loc,
+static DiagnosticBuilder Diag(DiagnosticsEngine &D, SourceLocation Loc,
                               unsigned DiagID) {
   return D.Report(Loc, DiagID);
 }
@@ -757,7 +757,7 @@
 /// "_Imaginary" (lacking an FP type).  This returns a diagnostic to issue or
 /// diag::NUM_DIAGNOSTICS if there is no error.  After calling this method,
 /// DeclSpec is guaranteed self-consistent, even if an error occurred.
-void DeclSpec::Finish(Diagnostic &D, Preprocessor &PP) {
+void DeclSpec::Finish(DiagnosticsEngine &D, Preprocessor &PP) {
   // Before possibly changing their values, save specs as written.
   SaveWrittenBuiltinSpecs();
   SaveStorageSpecifierAsWritten();
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index a169dd2..39933fd 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -545,7 +545,7 @@
   if (LangOpts.CPlusPlus0x &&
       Diags.getDiagnosticLevel(diag::warn_delegating_ctor_cycle,
                                SourceLocation())
-        != Diagnostic::Ignored)
+        != DiagnosticsEngine::Ignored)
     CheckDelegatingCtorCycles();
 
   // If there were errors, disable 'unused' warnings since they will mostly be
@@ -934,7 +934,7 @@
     // FIXME: Magic number for max shown overloads stolen from
     // OverloadCandidateSet::NoteCandidates.
     if (ShownOverloads >= 4 &&
-        Diags.getShowOverloads() == Diagnostic::Ovl_Best) {
+        Diags.getShowOverloads() == DiagnosticsEngine::Ovl_Best) {
       ++SuppressedOverloads;
       continue;
     }
diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp
index bcad499..583a7fa 100644
--- a/lib/Sema/SemaCXXCast.cpp
+++ b/lib/Sema/SemaCXXCast.cpp
@@ -1374,7 +1374,7 @@
                         diag::warn_undefined_reinterpret_cast;
 
   if (Diags.getDiagnosticLevel(DiagID, Range.getBegin()) ==
-          Diagnostic::Ignored) {
+          DiagnosticsEngine::Ignored) {
     return;
   }
 
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 5de43bb..8339bdd 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -3617,7 +3617,7 @@
   // cast; don't do it if we're ignoring -Wcast_align (as is the default).
   if (getDiagnostics().getDiagnosticLevel(diag::warn_cast_align,
                                           TRange.getBegin())
-        == Diagnostic::Ignored)
+        == DiagnosticsEngine::Ignored)
     return;
 
   // Ignore dependent types.
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index bddefb6..f6bfb3a 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1263,7 +1263,7 @@
       << R;
     if (Context.BuiltinInfo.getHeaderName(BID) &&
         Diags.getDiagnosticLevel(diag::ext_implicit_lib_function_decl, Loc)
-          != Diagnostic::Ignored)
+          != DiagnosticsEngine::Ignored)
       Diag(Loc, diag::note_please_include_header)
         << Context.BuiltinInfo.getHeaderName(BID)
         << Context.BuiltinInfo.GetName(BID);
@@ -3981,7 +3981,7 @@
 void Sema::CheckShadow(Scope *S, VarDecl *D, const LookupResult& R) {
   // Return if warning is ignored.
   if (Diags.getDiagnosticLevel(diag::warn_decl_shadow, R.getNameLoc()) ==
-        Diagnostic::Ignored)
+        DiagnosticsEngine::Ignored)
     return;
 
   // Don't diagnose declarations at file scope.
@@ -4055,7 +4055,7 @@
 /// \brief Check -Wshadow without the advantage of a previous lookup.
 void Sema::CheckShadow(Scope *S, VarDecl *D) {
   if (Diags.getDiagnosticLevel(diag::warn_decl_shadow, D->getLocation()) ==
-        Diagnostic::Ignored)
+        DiagnosticsEngine::Ignored)
     return;
 
   LookupResult R(*this, D->getDeclName(), D->getLocation(),
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 72c7408..e8892fd 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -2567,7 +2567,7 @@
     CXXCtorInitializer *Init = Inits[InitIndex];
     if (SemaRef.Diags.getDiagnosticLevel(diag::warn_initializer_out_of_order,
                                          Init->getSourceLocation())
-          != Diagnostic::Ignored) {
+          != DiagnosticsEngine::Ignored) {
       ShouldCheckOrder = true;
       break;
     }
@@ -4597,7 +4597,7 @@
 /// overriding any.
 void Sema::DiagnoseHiddenVirtualMethods(CXXRecordDecl *DC, CXXMethodDecl *MD) {
   if (Diags.getDiagnosticLevel(diag::warn_overloaded_virtual,
-                               MD->getLocation()) == Diagnostic::Ignored)
+                               MD->getLocation()) == DiagnosticsEngine::Ignored)
     return;
   if (MD->getDeclName().getNameKind() != DeclarationName::Identifier)
     return;
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 5a1ce28..5720180 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -1430,7 +1430,7 @@
             if (!MethodInClass || !MethodInClass->isSynthesized()) {
               unsigned DIAG = diag::warn_unimplemented_protocol_method;
               if (Diags.getDiagnosticLevel(DIAG, ImpLoc)
-                      != Diagnostic::Ignored) {
+                      != DiagnosticsEngine::Ignored) {
                 WarnUndefinedMethod(ImpLoc, method, IncompleteImpl, DIAG);
                 Diag(method->getLocation(), diag::note_method_declared_at);
                 Diag(CDecl->getLocation(), diag::note_required_for_protocol_at)
@@ -1448,7 +1448,8 @@
         !ClsMap.count(method->getSelector()) &&
         (!Super || !Super->lookupClassMethod(method->getSelector()))) {
       unsigned DIAG = diag::warn_unimplemented_protocol_method;
-      if (Diags.getDiagnosticLevel(DIAG, ImpLoc) != Diagnostic::Ignored) {
+      if (Diags.getDiagnosticLevel(DIAG, ImpLoc) !=
+            DiagnosticsEngine::Ignored) {
         WarnUndefinedMethod(ImpLoc, method, IncompleteImpl, DIAG);
         Diag(method->getLocation(), diag::note_method_declared_at);
         Diag(IDecl->getLocation(), diag::note_required_for_protocol_at) <<
@@ -1954,7 +1955,7 @@
       (receiverIdOrClass && warn &&
        (Diags.getDiagnosticLevel(diag::warn_strict_multiple_method_decl,
                                  R.getBegin()) != 
-      Diagnostic::Ignored));
+      DiagnosticsEngine::Ignored));
     if (strictSelectorMatch)
       for (ObjCMethodList *Next = MethList.Next; Next; Next = Next->Next) {
         if (!MatchTwoMethodDeclarations(MethList.Method, Next->Method,
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 209afe3..d30620b 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -9179,7 +9179,7 @@
 
   if (EvalResult.Diag &&
       Diags.getDiagnosticLevel(diag::ext_expr_not_ice, EvalResult.DiagLoc)
-          != Diagnostic::Ignored)
+          != DiagnosticsEngine::Ignored)
     Diag(EvalResult.DiagLoc, EvalResult.Diag);
 
   if (Result)
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index c2bf9d3..185e339 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -7571,7 +7571,8 @@
   bool ReportedAmbiguousConversions = false;
 
   SmallVectorImpl<OverloadCandidate*>::iterator I, E;
-  const Diagnostic::OverloadsShown ShowOverloads = S.Diags.getShowOverloads();
+  const DiagnosticsEngine::OverloadsShown ShowOverloads = 
+      S.Diags.getShowOverloads();
   unsigned CandsShown = 0;
   for (I = Cands.begin(), E = Cands.end(); I != E; ++I) {
     OverloadCandidate *Cand = *I;
@@ -7579,7 +7580,7 @@
     // Set an arbitrary limit on the number of candidate functions we'll spam
     // the user with.  FIXME: This limit should depend on details of the
     // candidate list.
-    if (CandsShown >= 4 && ShowOverloads == Diagnostic::Ovl_Best) {
+    if (CandsShown >= 4 && ShowOverloads == DiagnosticsEngine::Ovl_Best) {
       break;
     }
     ++CandsShown;
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index f390929..95a0493 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -2676,7 +2676,7 @@
 /// file.
 std::string ASTReader::getOriginalSourceFile(const std::string &ASTFileName,
                                              FileManager &FileMgr,
-                                             Diagnostic &Diags) {
+                                             DiagnosticsEngine &Diags) {
   // Open the AST file.
   std::string ErrStr;
   llvm::OwningPtr<llvm::MemoryBuffer> Buffer;
@@ -3072,7 +3072,7 @@
   return HeaderFileInfo();
 }
 
-void ASTReader::ReadPragmaDiagnosticMappings(Diagnostic &Diag) {
+void ASTReader::ReadPragmaDiagnosticMappings(DiagnosticsEngine &Diag) {
   for (ModuleIterator I = ModuleMgr.begin(), E = ModuleMgr.end(); I != E; ++I) {
     Module &F = *(*I);
     unsigned Idx = 0;
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index 494f4aa..5f005a0 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -1803,17 +1803,17 @@
   }
 }
 
-void ASTWriter::WritePragmaDiagnosticMappings(const Diagnostic &Diag) {
+void ASTWriter::WritePragmaDiagnosticMappings(const DiagnosticsEngine &Diag) {
   RecordData Record;
-  for (Diagnostic::DiagStatePointsTy::const_iterator
+  for (DiagnosticsEngine::DiagStatePointsTy::const_iterator
          I = Diag.DiagStatePoints.begin(), E = Diag.DiagStatePoints.end();
          I != E; ++I) {
-    const Diagnostic::DiagStatePoint &point = *I; 
+    const DiagnosticsEngine::DiagStatePoint &point = *I; 
     if (point.Loc.isInvalid())
       continue;
 
     Record.push_back(point.Loc.getRawEncoding());
-    for (Diagnostic::DiagState::iterator
+    for (DiagnosticsEngine::DiagState::iterator
            I = point.State->begin(), E = point.State->end(); I != E; ++I) {
       unsigned diag = I->first, map = I->second;
       if (map & 0x10) { // mapping from a diagnostic pragma.
diff --git a/lib/Serialization/ChainedIncludesSource.cpp b/lib/Serialization/ChainedIncludesSource.cpp
index 04c3f81..5fcf11a 100644
--- a/lib/Serialization/ChainedIncludesSource.cpp
+++ b/lib/Serialization/ChainedIncludesSource.cpp
@@ -87,8 +87,8 @@
     TextDiagnosticPrinter *DiagClient =
       new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions());
     llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-    llvm::IntrusiveRefCntPtr<Diagnostic> Diags(new Diagnostic(DiagID,
-                                                              DiagClient));
+    llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
+        new DiagnosticsEngine(DiagID, DiagClient));
 
     llvm::OwningPtr<CompilerInstance> Clang(new CompilerInstance());
     Clang->setInvocation(CInvok.take());
diff --git a/lib/StaticAnalyzer/Core/AnalysisManager.cpp b/lib/StaticAnalyzer/Core/AnalysisManager.cpp
index 543388e..8c33881 100644
--- a/lib/StaticAnalyzer/Core/AnalysisManager.cpp
+++ b/lib/StaticAnalyzer/Core/AnalysisManager.cpp
@@ -14,7 +14,7 @@
 using namespace clang;
 using namespace ento;
 
-AnalysisManager::AnalysisManager(ASTContext &ctx, Diagnostic &diags, 
+AnalysisManager::AnalysisManager(ASTContext &ctx, DiagnosticsEngine &diags,
                                  const LangOptions &lang, PathDiagnosticClient *pd,
                                  StoreManagerCreator storemgr,
                                  ConstraintManagerCreator constraintmgr, 
diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp
index 6e73b60..0382ff4 100644
--- a/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -1880,7 +1880,7 @@
   // Emit a summary diagnostic to the regular Diagnostics engine.
   BugReport::ranges_iterator Beg, End;
   llvm::tie(Beg, End) = exampleReport->getRanges();
-  Diagnostic &Diag = getDiagnostic();
+  DiagnosticsEngine &Diag = getDiagnostic();
   
   // Search the description for '%', as that will be interpretted as a
   // format character by FormatDiagnostics.
@@ -1896,7 +1896,7 @@
         Out << *I;
     
     Out.flush();
-    ErrorDiag = Diag.getCustomDiagID(Diagnostic::Warning, TmpStr);
+    ErrorDiag = Diag.getCustomDiagID(DiagnosticsEngine::Warning, TmpStr);
   }        
 
   {
diff --git a/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp b/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp
index e91b48d..f38ebcb 100644
--- a/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp
+++ b/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp
@@ -25,10 +25,10 @@
 /// the sequence of events.
 class TextPathDiagnostics : public PathDiagnosticClient {
   const std::string OutputFile;
-  Diagnostic &Diag;
+  DiagnosticsEngine &Diag;
 
 public:
-  TextPathDiagnostics(const std::string& output, Diagnostic &diag)
+  TextPathDiagnostics(const std::string& output, DiagnosticsEngine &diag)
     : OutputFile(output), Diag(diag) {}
 
   void HandlePathDiagnosticImpl(const PathDiagnostic* D);
diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
index c4619e3..e269892 100644
--- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -267,7 +267,7 @@
 void AnalysisConsumer::HandleCode(Decl *D) {
 
   // Don't run the actions if an error has occurred with parsing the file.
-  Diagnostic &Diags = PP.getDiagnostics();
+  DiagnosticsEngine &Diags = PP.getDiagnostics();
   if (Diags.hasErrorOccurred() || Diags.hasFatalErrorOccurred())
     return;
 
diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.h b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.h
index 0265517..5a16bff 100644
--- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.h
+++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.h
@@ -23,7 +23,7 @@
 class AnalyzerOptions;
 class ASTConsumer;
 class Preprocessor;
-class Diagnostic;
+class DiagnosticsEngine;
 
 namespace ento {
 class CheckerManager;
diff --git a/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp b/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
index 89b99f9..a59fcad 100644
--- a/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
+++ b/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
@@ -35,17 +35,18 @@
   typedef void (*RegisterCheckersFn)(CheckerRegistry &);
 
   static bool isCompatibleAPIVersion(const char *versionString);
-  static void warnIncompatible(Diagnostic *diags, StringRef pluginPath,
+  static void warnIncompatible(DiagnosticsEngine *diags, StringRef pluginPath,
                                const char *pluginAPIVersion);
 
 public:
-  ClangCheckerRegistry(ArrayRef<std::string> plugins, Diagnostic *diags = 0);
+  ClangCheckerRegistry(ArrayRef<std::string> plugins,
+                       DiagnosticsEngine *diags = 0);
 };
   
 } // end anonymous namespace
 
 ClangCheckerRegistry::ClangCheckerRegistry(ArrayRef<std::string> plugins,
-                                           Diagnostic *diags) {
+                                           DiagnosticsEngine *diags) {
   registerBuiltinCheckers(*this);
 
   for (ArrayRef<std::string>::iterator i = plugins.begin(), e = plugins.end();
@@ -83,7 +84,7 @@
   return false;
 }
 
-void ClangCheckerRegistry::warnIncompatible(Diagnostic *diags,
+void ClangCheckerRegistry::warnIncompatible(DiagnosticsEngine *diags,
                                             StringRef pluginPath,
                                             const char *pluginAPIVersion) {
   if (!diags)
@@ -102,7 +103,7 @@
 CheckerManager *ento::createCheckerManager(const AnalyzerOptions &opts,
                                            const LangOptions &langOpts,
                                            ArrayRef<std::string> plugins,
-                                           Diagnostic &diags) {
+                                           DiagnosticsEngine &diags) {
   llvm::OwningPtr<CheckerManager> checkerMgr(new CheckerManager(langOpts));
 
   SmallVector<CheckerOptInfo, 8> checkerOpts;