diff options
Diffstat (limited to 'clang/lib')
62 files changed, 319 insertions, 300 deletions
diff --git a/clang/lib/ARCMigrate/ARCMT.cpp b/clang/lib/ARCMigrate/ARCMT.cpp index 5779b4cbb9f..6d44ca6d1a4 100644 --- a/clang/lib/ARCMigrate/ARCMT.cpp +++ b/clang/lib/ARCMigrate/ARCMT.cpp @@ -38,7 +38,7 @@ bool CapturedDiagList::clearDiagnostic(ArrayRef<unsigned> IDs, 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 @@ bool CapturedDiagList::hasDiagnostic(ArrayRef<unsigned> IDs, 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 @@ bool CapturedDiagList::hasErrors() const { 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 @@ static void emitPremigrationErrors(const CapturedDiagList &arcDiags, 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 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI, 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 @@ static bool applyTransforms(CompilerInvocation &origCI, } 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 @@ bool arcmt::getFileRemappings(std::vector<std::pair<std::string,std::string> > & 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 @@ MigrationProcess::MigrationProcess(const CompilerInvocation &CI, : 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 @@ bool MigrationProcess::applyTransform(TransformFn trans, 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 @@ bool MigrationProcess::applyTransform(TransformFn trans, // 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/clang/lib/ARCMigrate/FileRemapper.cpp b/clang/lib/ARCMigrate/FileRemapper.cpp index 604893e8170..c6e6ce46d17 100644 --- a/clang/lib/ARCMigrate/FileRemapper.cpp +++ b/clang/lib/ARCMigrate/FileRemapper.cpp @@ -48,7 +48,7 @@ std::string FileRemapper::getRemapInfoFile(StringRef outputDir) { 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 @@ bool FileRemapper::initFromDisk(StringRef outputDir, Diagnostic &Diag, 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 @@ bool FileRemapper::flushToDisk(StringRef outputDir, Diagnostic &Diag) { return false; } -bool FileRemapper::overwriteOriginal(Diagnostic &Diag, +bool FileRemapper::overwriteOriginal(DiagnosticsEngine &Diag, StringRef outputDir) { using namespace llvm::sys; @@ -276,7 +276,7 @@ void FileRemapper::resetTarget(Target &targ) { } } -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/clang/lib/ARCMigrate/Internals.h b/clang/lib/ARCMigrate/Internals.h index 61eeccb3a74..46f3bb626f2 100644 --- a/clang/lib/ARCMigrate/Internals.h +++ b/clang/lib/ARCMigrate/Internals.h @@ -29,7 +29,7 @@ public: 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 @@ void writeARCDiagsToPlist(const std::string &outPath, 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 @@ public: : 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/clang/lib/ARCMigrate/PlistReporter.cpp b/clang/lib/ARCMigrate/PlistReporter.cpp index 81b953da9ff..d1bc90fdbe1 100644 --- a/clang/lib/ARCMigrate/PlistReporter.cpp +++ b/clang/lib/ARCMigrate/PlistReporter.cpp @@ -150,7 +150,7 @@ void arcmt::writeARCDiagsToPlist(const std::string &outPath, const StoredDiagnostic &D = *DI; - if (D.getLevel() == Diagnostic::Ignored) + if (D.getLevel() == DiagnosticsEngine::Ignored) continue; o << " <dict>\n"; @@ -162,9 +162,9 @@ void arcmt::writeARCDiagsToPlist(const std::string &outPath, 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/clang/lib/ARCMigrate/TransformActions.cpp b/clang/lib/ARCMigrate/TransformActions.cpp index 1321686ca66..ec676e909a3 100644 --- a/clang/lib/ARCMigrate/TransformActions.cpp +++ b/clang/lib/ARCMigrate/TransformActions.cpp @@ -595,7 +595,7 @@ SourceLocation TransformActionsImpl::getLocForEndOfToken(SourceLocation loc, 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/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 5e0143dc007..4d3d88a18d2 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -485,7 +485,7 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target) { InitBuiltinType(NullPtrTy, BuiltinType::NullPtr); } -Diagnostic &ASTContext::getDiagnostics() const { +DiagnosticsEngine &ASTContext::getDiagnostics() const { return SourceMgr.getDiagnostics(); } diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp index f9100c01108..4c115d116ba 100644 --- a/clang/lib/AST/ASTDiagnostic.cpp +++ b/clang/lib/AST/ASTDiagnostic.cpp @@ -152,7 +152,7 @@ break; \ /// 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 @@ ConvertTypeToDiagnosticString(ASTContext &Context, QualType Ty, 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 @@ ConvertTypeToDiagnosticString(ASTContext &Context, QualType Ty, } 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 @@ void clang::FormatASTNodeDiagnosticArgument( 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 @@ void clang::FormatASTNodeDiagnosticArgument( NeedQuotes = false; break; } - case Diagnostic::ak_declarationname: { + case DiagnosticsEngine::ak_declarationname: { DeclarationName N = DeclarationName::getFromOpaqueInteger(Val); S = N.getAsString(); @@ -260,7 +260,7 @@ void clang::FormatASTNodeDiagnosticArgument( "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 @@ void clang::FormatASTNodeDiagnosticArgument( 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/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index 78f149c2df7..e94cb2d54bc 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -73,7 +73,7 @@ class ItaniumMangleContext : public MangleContext { public: explicit ItaniumMangleContext(ASTContext &Context, - Diagnostic &Diags) + DiagnosticsEngine &Diags) : MangleContext(Context, Diags) { } uint64_t getAnonymousStructId(const TagDecl *TD) { @@ -2249,8 +2249,8 @@ recurse: 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 @@ recurse: // 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 @@ recurse: 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 @@ void ItaniumMangleContext::mangleCXXRTTIName(QualType Ty, } MangleContext *clang::createItaniumMangleContext(ASTContext &Context, - Diagnostic &Diags) { + DiagnosticsEngine &Diags) { return new ItaniumMangleContext(Context, Diags); } diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index fd99ee189bb..a5bfd7d318e 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -78,7 +78,7 @@ private: 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 @@ void MicrosoftMangleContext::mangleReferenceTemporary(const clang::VarDecl *, } MangleContext *clang::createMicrosoftMangleContext(ASTContext &Context, - Diagnostic &Diags) { + DiagnosticsEngine &Diags) { return new MicrosoftMangleContext(Context, Diags); } diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp index 0e4159db8db..87a3d1c9b5e 100644 --- a/clang/lib/Basic/Diagnostic.cpp +++ b/clang/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 @@ static void DummyArgToStringFn(Diagnostic::ArgumentKind AK, intptr_t QT, } -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 @@ Diagnostic::Diagnostic(const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &diags, 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 @@ void Diagnostic::setClient(DiagnosticClient *client, bool ShouldOwnClient) { 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 @@ bool Diagnostic::popMappings(SourceLocation Loc) { return true; } -void Diagnostic::Reset() { +void DiagnosticsEngine::Reset() { ErrorOccurred = false; FatalErrorOccurred = false; UnrecoverableErrorOccurred = false; @@ -98,8 +100,8 @@ void Diagnostic::Reset() { 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 @@ void Diagnostic::Reset() { 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 @@ void Diagnostic::SetDelayedDiagnostic(unsigned DiagID, StringRef Arg1, 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 @@ Diagnostic::GetDiagStatePointForLoc(SourceLocation L) const { /// /// \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 @@ void Diagnostic::setDiagnosticMapping(diag::kind Diag, diag::Mapping Map, 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 @@ void Diagnostic::Report(const StoredDiagnostic &storedDiag) { 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 @@ void Diagnostic::Report(const StoredDiagnostic &storedDiag) { 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 @@ bool DiagnosticBuilder::Emit() { 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 @@ bool DiagnosticBuilder::Emit() { 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 @@ FormatDiagnostic(const char *DiagStr, const char *DiagEnd, /// 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 @@ FormatDiagnostic(const char *DiagStr, const char *DiagEnd, 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 @@ FormatDiagnostic(const char *DiagStr, const char *DiagEnd, break; } // ---- INTEGERS ---- - case Diagnostic::ak_sint: { + case DiagnosticsEngine::ak_sint: { int Val = getArgSInt(ArgNo); if (ModifierIs(Modifier, ModifierLen, "select")) { @@ -644,7 +647,7 @@ FormatDiagnostic(const char *DiagStr, const char *DiagEnd, } break; } - case Diagnostic::ak_uint: { + case DiagnosticsEngine::ak_uint: { unsigned Val = getArgUInt(ArgNo); if (ModifierIs(Modifier, ModifierLen, "select")) { @@ -663,7 +666,7 @@ FormatDiagnostic(const char *DiagStr, const char *DiagEnd, 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 @@ FormatDiagnostic(const char *DiagStr, const char *DiagEnd, 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 @@ FormatDiagnostic(const char *DiagStr, const char *DiagEnd, // 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 @@ FormatDiagnostic(const char *DiagStr, const char *DiagEnd, 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 @@ StoredDiagnostic::StoredDiagnostic(Diagnostic::Level Level, 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 @@ StoredDiagnostic::~StoredDiagnostic() { } /// 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/clang/lib/Basic/DiagnosticIDs.cpp b/clang/lib/Basic/DiagnosticIDs.cpp index dab46636178..eda2f8e19fc 100644 --- a/clang/lib/Basic/DiagnosticIDs.cpp +++ b/clang/lib/Basic/DiagnosticIDs.cpp @@ -446,12 +446,12 @@ StringRef DiagnosticIDs::getDescription(unsigned DiagID) const { 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::getDiagnosticLevel(unsigned DiagID, SourceLocation Loc, 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 @@ DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass, // 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 @@ DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass, 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 @@ DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass, // 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 bool WarningOptionCompare(const WarningOption &LHS, } 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 @@ static void MapGroupMembers(const WarningOption *Group, diag::Mapping Mapping, 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 @@ bool DiagnosticIDs::setDiagnosticGroupMapping(StringRef Group, /// 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 @@ bool DiagnosticIDs::ProcessDiag(Diagnostic &Diag) const { } // 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/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index f15c5dc3345..410d4dfbeb0 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -80,7 +80,7 @@ void ContentCache::replaceBuffer(const llvm::MemoryBuffer *B, 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 @@ LineTableInfo &SourceManager::getLineTable() { // 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 @@ unsigned SourceManager::getPresumedColumnNumber(SourceLocation Loc, } 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/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 8d30c2cd2cb..5ee44080ac1 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -3293,7 +3293,7 @@ static TargetInfo *AllocateTarget(const std::string &T) { /// 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/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 9346cf36990..b9e3ed9edd1 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -41,7 +41,7 @@ using namespace llvm; namespace { class EmitAssemblyHelper { - Diagnostic &Diags; + DiagnosticsEngine &Diags; const CodeGenOptions &CodeGenOpts; const TargetOptions &TargetOpts; const LangOptions &LangOpts; @@ -86,7 +86,7 @@ private: 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 EmitAssemblyHelper::EmitAssembly(BackendAction Action, raw_ostream *OS) { } } -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/clang/lib/CodeGen/CGCXXABI.cpp b/clang/lib/CodeGen/CGCXXABI.cpp index 8106507e0d4..248448ccdc2 100644 --- a/clang/lib/CodeGen/CGCXXABI.cpp +++ b/clang/lib/CodeGen/CGCXXABI.cpp @@ -21,8 +21,8 @@ CGCXXABI::~CGCXXABI() { } 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/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index fed79db9b0b..bdb0b57d0e7 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1590,7 +1590,7 @@ llvm::DIType CGDebugInfo::CreateTypeNode(QualType Ty, } 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/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp index f266ba9d3e8..68dd5c94dc0 100644 --- a/clang/lib/CodeGen/CodeGenAction.cpp +++ b/clang/lib/CodeGen/CodeGenAction.cpp @@ -30,7 +30,7 @@ using namespace llvm; namespace clang { class BackendConsumer : public ASTConsumer { - Diagnostic &Diags; + DiagnosticsEngine &Diags; BackendAction Action; const CodeGenOptions &CodeGenOpts; const TargetOptions &TargetOpts; @@ -45,7 +45,7 @@ namespace clang { 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 @@ void CodeGenAction::ExecuteAction() { 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/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index e4633f9a749..408a870a744 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -60,7 +60,7 @@ static CGCXXABI &createCXXABI(CodeGenModule &CGM) { 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 @@ bool CodeGenModule::isTargetDarwin() const { } 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 @@ void CodeGenModule::ErrorUnsupported(const Stmt *S, const char *Type, 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 @@ void CodeGenModule::ErrorUnsupported(const Decl *D, const char *Type, 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/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index a5938d9032e..c190fa3c56a 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -62,7 +62,7 @@ namespace clang { class VarDecl; class LangOptions; class CodeGenOptions; - class Diagnostic; + class DiagnosticsEngine; class AnnotateAttr; class CXXDestructorDecl; class MangleBuffer; @@ -217,7 +217,7 @@ class CodeGenModule : public CodeGenTypeCache { 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 @@ class CodeGenModule : public CodeGenTypeCache { /// @} 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 @@ public: 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/clang/lib/CodeGen/ModuleBuilder.cpp b/clang/lib/CodeGen/ModuleBuilder.cpp index 24f75f1753c..793ee9192e6 100644 --- a/clang/lib/CodeGen/ModuleBuilder.cpp +++ b/clang/lib/CodeGen/ModuleBuilder.cpp @@ -27,7 +27,7 @@ using namespace clang; 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 @@ namespace { 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 @@ namespace { }; } -CodeGenerator *clang::CreateLLVMCodeGen(Diagnostic &Diags, +CodeGenerator *clang::CreateLLVMCodeGen(DiagnosticsEngine &Diags, const std::string& ModuleName, const CodeGenOptions &CGO, llvm::LLVMContext& C) { diff --git a/clang/lib/Driver/ArgList.cpp b/clang/lib/Driver/ArgList.cpp index 6f7cbb6062d..ca9b944950e 100644 --- a/clang/lib/Driver/ArgList.cpp +++ b/clang/lib/Driver/ArgList.cpp @@ -136,7 +136,7 @@ StringRef ArgList::getLastArgValue(OptSpecifier Id, } 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/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 5be7e630b51..121abc8b8bc 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -51,7 +51,7 @@ Driver::Driver(StringRef ClangExecutable, 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 @@ void Driver::BuildJobs(Compilation &C) const { 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/clang/lib/Frontend/ASTMerge.cpp b/clang/lib/Frontend/ASTMerge.cpp index 74aa5a64a49..cb195d11fbc 100644 --- a/clang/lib/Frontend/ASTMerge.cpp +++ b/clang/lib/Frontend/ASTMerge.cpp @@ -41,8 +41,8 @@ void ASTMergeAction::ExecuteAction() { 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/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index 19b8ccb4c32..21f6afa7aa6 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -456,19 +456,19 @@ public: 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 @@ public: } // 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 @@ llvm::MemoryBuffer *ASTUnit::getBufferForFile(StringRef Filename, } /// \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 @@ void ASTUnit::ConfigureDiags(llvm::IntrusiveRefCntPtr<Diagnostic> &Diags, } 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 @@ ASTUnit *ASTUnit::LoadFromASTFile(const std::string &Filename, // 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 @@ StringRef ASTUnit::getMainFileName() const { } 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::create(CompilerInvocation *CI, } 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 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocationAction(CompilerInvocation *CI, // 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 @@ bool ASTUnit::LoadFromCompilerInvocation(bool PrecompilePreamble) { } ASTUnit *ASTUnit::LoadFromCompilerInvocation(CompilerInvocation *CI, - llvm::IntrusiveRefCntPtr<Diagnostic> Diags, + llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags, bool OnlyLocalDecls, bool CaptureDiagnostics, bool PrecompilePreamble, @@ -1675,8 +1675,8 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocation(CompilerInvocation *CI, // 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::LoadFromCompilerInvocation(CompilerInvocation *CI, 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 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, 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 @@ void ASTUnit::CodeComplete(StringRef File, unsigned Line, unsigned Column, 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/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 924864c8ccd..ab65c3e9739 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -53,7 +53,7 @@ void CompilerInstance::setInvocation(CompilerInvocation *Value) { Invocation = Value; } -void CompilerInstance::setDiagnostics(Diagnostic *Value) { +void CompilerInstance::setDiagnostics(DiagnosticsEngine *Value) { Diagnostics = Value; } @@ -88,7 +88,7 @@ void CompilerInstance::setCodeCompletionConsumer(CodeCompleteConsumer *Value) { // 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 SetUpBuildDumpLog(const DiagnosticOptions &DiagOpts, 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 @@ void CompilerInstance::createDiagnostics(int Argc, const char* const *Argv, 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) { } bool CompilerInstance::InitializeSourceManager(StringRef InputFile, - Diagnostic &Diags, + DiagnosticsEngine &Diags, FileManager &FileMgr, SourceManager &SourceMgr, const FrontendOptions &Opts) { diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 03d06e63d3d..3426e19c0c2 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -872,7 +872,7 @@ using namespace clang::driver::cc1options; // 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 unsigned getOptimizationLevel(ArgList &Args, InputKind IK, } 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 ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args, } 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 ParseDependencyOutputArgs(DependencyOutputOptions &Opts, } 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 @@ static void ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args, 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 void ParseFileSystemArgs(FileSystemOptions &Opts, ArgList &Args) { } 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 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK, } 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 ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, 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 @@ static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args) { 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/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp index 8fdc06db72c..ccfa865233f 100644 --- a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -30,7 +30,7 @@ using namespace clang; /// 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/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index 1bbceddee5a..ba2d63b026d 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -66,7 +66,7 @@ public: 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 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, 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/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index ae3152a5b06..4c0c11e35fd 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -31,7 +31,7 @@ using namespace clang; // 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 @@ static void InitializePredefinedMacros(const TargetInfo &TI, // 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/clang/lib/Frontend/LogDiagnosticPrinter.cpp b/clang/lib/Frontend/LogDiagnosticPrinter.cpp index 52e40efb820..00cd85dca07 100644 --- a/clang/lib/Frontend/LogDiagnosticPrinter.cpp +++ b/clang/lib/Frontend/LogDiagnosticPrinter.cpp @@ -26,15 +26,15 @@ LogDiagnosticPrinter::~LogDiagnosticPrinter() { 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 @@ void LogDiagnosticPrinter::EndSourceFile() { 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/clang/lib/Frontend/TextDiagnosticBuffer.cpp b/clang/lib/Frontend/TextDiagnosticBuffer.cpp index f540fcab973..b615d710adc 100644 --- a/clang/lib/Frontend/TextDiagnosticBuffer.cpp +++ b/clang/lib/Frontend/TextDiagnosticBuffer.cpp @@ -19,7 +19,7 @@ using namespace clang; /// 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 @@ void TextDiagnosticBuffer::HandleDiagnostic(Diagnostic::Level Level, 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/clang/lib/Frontend/TextDiagnosticPrinter.cpp b/clang/lib/Frontend/TextDiagnosticPrinter.cpp index 34dad73e1e0..53f532e24a6 100644 --- a/clang/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/clang/lib/Frontend/TextDiagnosticPrinter.cpp @@ -88,7 +88,7 @@ static void PrintIncludeStackRecursively(raw_ostream &OS, /// \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 @@ void TextDiagnosticPrinter::PrintIncludeStack(Diagnostic::Level Level, 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 @@ public: // 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 @@ static PresumedLoc getDiagnosticPresumedLoc(const SourceManager &SM, /// 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 @@ void TextDiagnosticPrinter::EmitDiagnosticLoc(Diagnostic::Level Level, 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 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, 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 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, 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 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, 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 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, // 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/clang/lib/Frontend/VerifyDiagnosticsClient.cpp b/clang/lib/Frontend/VerifyDiagnosticsClient.cpp index 69eb887843c..aaac282fe60 100644 --- a/clang/lib/Frontend/VerifyDiagnosticsClient.cpp +++ b/clang/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 @@ void VerifyDiagnosticsClient::EndSourceFile() { 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 @@ static void FindExpectedDiags(Preprocessor &PP, ExpectedData &ED, FileID FID) { /// 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 @@ static unsigned PrintProblem(Diagnostic &Diags, SourceManager *SourceMgr, 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 @@ static unsigned PrintProblem(Diagnostic &Diags, SourceManager *SourceMgr, /// 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 @@ static unsigned CheckLists(Diagnostic &Diags, SourceManager &SourceMgr, /// 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/clang/lib/Frontend/Warnings.cpp b/clang/lib/Frontend/Warnings.cpp index d24779e1a98..14a7f01cb18 100644 --- a/clang/lib/Frontend/Warnings.cpp +++ b/clang/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 @@ void clang::ProcessWarningOptions(Diagnostic &Diags, // 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/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp index e780d694ed5..ef385a8aedb 100644 --- a/clang/lib/Lex/LiteralSupport.cpp +++ b/clang/lib/Lex/LiteralSupport.cpp @@ -53,7 +53,7 @@ static unsigned getCharWidth(tok::TokenKind kind, const TargetInfo &Target) { 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 @@ static unsigned ProcessCharEscape(const char *&ThisTokBuf, /// 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 bool ProcessUCNEscape(const char *&ThisTokBuf, const char *ThisTokEnd, 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/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 1f54ef52c3e..b242c8ba7eb 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -1616,7 +1616,7 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok) { // 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/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index cfe9374251e..5a603b63924 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -690,7 +690,8 @@ static bool HasExtension(const Preprocessor &PP, const IdentifierInfo *II) { // 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/clang/lib/Lex/PTHLexer.cpp b/clang/lib/Lex/PTHLexer.cpp index 0d48ade39e4..e0c4cf0c16c 100644 --- a/clang/lib/Lex/PTHLexer.cpp +++ b/clang/lib/Lex/PTHLexer.cpp @@ -431,11 +431,12 @@ PTHManager::~PTHManager() { 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/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 8c1004b5f51..2937b6066ed 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -49,7 +49,7 @@ using namespace clang; //===----------------------------------------------------------------------===// 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/clang/lib/Parse/RAIIObjectsForParser.h b/clang/lib/Parse/RAIIObjectsForParser.h index 3765f92348e..ef17aee3f51 100644 --- a/clang/lib/Parse/RAIIObjectsForParser.h +++ b/clang/lib/Parse/RAIIObjectsForParser.h @@ -30,9 +30,9 @@ namespace clang { 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/clang/lib/Rewrite/FixItRewriter.cpp b/clang/lib/Rewrite/FixItRewriter.cpp index 706b6eafd3a..4ef7bc34795 100644 --- a/clang/lib/Rewrite/FixItRewriter.cpp +++ b/clang/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 @@ bool FixItRewriter::IncludeInDiagnosticCounts() const { 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 @@ void FixItRewriter::HandleDiagnostic(Diagnostic::Level DiagLevel, 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 @@ void FixItRewriter::HandleDiagnostic(Diagnostic::Level DiagLevel, 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/clang/lib/Rewrite/HTMLRewrite.cpp b/clang/lib/Rewrite/HTMLRewrite.cpp index 3b781580bdf..fae44a3d5fc 100644 --- a/clang/lib/Rewrite/HTMLRewrite.cpp +++ b/clang/lib/Rewrite/HTMLRewrite.cpp @@ -444,7 +444,7 @@ namespace { /// 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 @@ void html::HighlightMacros(Rewriter &R, FileID FID, const Preprocessor& PP) { // 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/clang/lib/Rewrite/RewriteObjC.cpp b/clang/lib/Rewrite/RewriteObjC.cpp index 4f9c1748ce8..57d1210f31b 100644 --- a/clang/lib/Rewrite/RewriteObjC.cpp +++ b/clang/lib/Rewrite/RewriteObjC.cpp @@ -55,7 +55,7 @@ namespace { }; Rewriter Rewrite; - Diagnostic &Diags; + DiagnosticsEngine &Diags; const LangOptions &LangOpts; unsigned RewriteFailedDiag; unsigned TryFinallyContainsReturnDiag; @@ -172,7 +172,7 @@ namespace { 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 @@ static bool IsHeaderFile(const std::string &Filename) { } 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/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp index 15800b38c0c..e42370d1a39 100644 --- a/clang/lib/Sema/AnalysisBasedWarnings.cpp +++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp @@ -265,25 +265,25 @@ struct CheckFallThroughDiagnostics { 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 @@ static void CheckFallThroughForBody(Sema &S, const Decl *D, const Stmt *Body, } } - Diagnostic &Diags = S.getDiagnostics(); + DiagnosticsEngine &Diags = S.getDiagnostics(); // Short circuit for compilation speed. if (CD.checkDiagnostics(Diags, ReturnsVoid, HasNoReturn)) @@ -723,13 +723,13 @@ clang::sema::AnalysisBasedWarnings::AnalysisBasedWarnings(Sema &s) 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 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P, // 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 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P, } 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/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp index 7e2f4ad281f..e4d76c8fd56 100644 --- a/clang/lib/Sema/DeclSpec.cpp +++ b/clang/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 @@ void DeclSpec::SaveStorageSpecifierAsWritten() { /// "_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/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index a169dd270e7..39933fde5f5 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -545,7 +545,7 @@ void Sema::ActOnEndOfTranslationUnit() { 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 @@ void Sema::NoteOverloads(const UnresolvedSetImpl &Overloads, // 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/clang/lib/Sema/SemaCXXCast.cpp b/clang/lib/Sema/SemaCXXCast.cpp index bcad4995a8e..583a7fa3dd0 100644 --- a/clang/lib/Sema/SemaCXXCast.cpp +++ b/clang/lib/Sema/SemaCXXCast.cpp @@ -1374,7 +1374,7 @@ void Sema::CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType, diag::warn_undefined_reinterpret_cast; if (Diags.getDiagnosticLevel(DiagID, Range.getBegin()) == - Diagnostic::Ignored) { + DiagnosticsEngine::Ignored) { return; } diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 5de43bb619d..8339bddf873 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -3617,7 +3617,7 @@ void Sema::CheckCastAlign(Expr *Op, QualType T, SourceRange TRange) { // 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/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index bddefb66935..f6bfb3a2f20 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1263,7 +1263,7 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid, << 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 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, 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 @@ void Sema::CheckShadow(Scope *S, VarDecl *D, const LookupResult& R) { /// \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/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 72c74084b27..e8892fd323f 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -2567,7 +2567,7 @@ DiagnoseBaseOrMemInitializerOrder(Sema &SemaRef, 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 @@ static bool FindHiddenVirtualMethod(const CXXBaseSpecifier *Specifier, /// 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/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 5a1ce281936..57201809f01 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -1430,7 +1430,7 @@ void Sema::CheckProtocolMethodDefs(SourceLocation ImpLoc, 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 @@ void Sema::CheckProtocolMethodDefs(SourceLocation ImpLoc, !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 @@ ObjCMethodDecl *Sema::LookupMethodInGlobalPool(Selector Sel, SourceRange R, (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/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 209afe330dc..d30620b816f 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -9179,7 +9179,7 @@ bool Sema::VerifyIntegerConstantExpression(const Expr *E, llvm::APSInt *Result){ 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/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index c2bf9d3848f..185e339db38 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -7571,7 +7571,8 @@ void OverloadCandidateSet::NoteCandidates(Sema &S, 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 @@ void OverloadCandidateSet::NoteCandidates(Sema &S, // 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/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index f390929d4b3..95a04937ec9 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -2676,7 +2676,7 @@ void ASTReader::InitializeContext() { /// 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 @@ HeaderFileInfo ASTReader::GetHeaderFileInfo(const FileEntry *FE) { 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/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 494f4aa3546..5f005a01062 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -1803,17 +1803,17 @@ void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec) { } } -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/clang/lib/Serialization/ChainedIncludesSource.cpp b/clang/lib/Serialization/ChainedIncludesSource.cpp index 04c3f81e9b8..5fcf11a36e3 100644 --- a/clang/lib/Serialization/ChainedIncludesSource.cpp +++ b/clang/lib/Serialization/ChainedIncludesSource.cpp @@ -87,8 +87,8 @@ ChainedIncludesSource *ChainedIncludesSource::create(CompilerInstance &CI) { 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/clang/lib/StaticAnalyzer/Core/AnalysisManager.cpp b/clang/lib/StaticAnalyzer/Core/AnalysisManager.cpp index 543388e4fbc..8c338814586 100644 --- a/clang/lib/StaticAnalyzer/Core/AnalysisManager.cpp +++ b/clang/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/clang/lib/StaticAnalyzer/Core/BugReporter.cpp b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp index 6e73b60abf9..0382ff43e61 100644 --- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -1880,7 +1880,7 @@ void BugReporter::FlushReport(BugReportEquivClass& EQ) { // 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 @@ void BugReporter::FlushReport(BugReportEquivClass& EQ) { Out << *I; Out.flush(); - ErrorDiag = Diag.getCustomDiagID(Diagnostic::Warning, TmpStr); + ErrorDiag = Diag.getCustomDiagID(DiagnosticsEngine::Warning, TmpStr); } { diff --git a/clang/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp index e91b48d9fe3..f38ebcb8b0d 100644 --- a/clang/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp +++ b/clang/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp @@ -25,10 +25,10 @@ namespace { /// 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/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index c4619e369d5..e2698921153 100644 --- a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -267,7 +267,7 @@ static void RunPathSensitiveChecks(AnalysisConsumer &C, AnalysisManager &mgr, 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/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.h b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.h index 0265517affb..5a16bffeacf 100644 --- a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.h +++ b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.h @@ -23,7 +23,7 @@ namespace clang { class AnalyzerOptions; class ASTConsumer; class Preprocessor; -class Diagnostic; +class DiagnosticsEngine; namespace ento { class CheckerManager; diff --git a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp b/clang/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp index 89b99f98079..a59fcad6f81 100644 --- a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp +++ b/clang/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp @@ -35,17 +35,18 @@ class ClangCheckerRegistry : public CheckerRegistry { 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 @@ bool ClangCheckerRegistry::isCompatibleAPIVersion(const char *versionString) { return false; } -void ClangCheckerRegistry::warnIncompatible(Diagnostic *diags, +void ClangCheckerRegistry::warnIncompatible(DiagnosticsEngine *diags, StringRef pluginPath, const char *pluginAPIVersion) { if (!diags) @@ -102,7 +103,7 @@ void ClangCheckerRegistry::warnIncompatible(Diagnostic *diags, 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; |