diff options
119 files changed, 557 insertions, 530 deletions
diff --git a/include/clang/ARCMigrate/FileRemapper.h b/include/clang/ARCMigrate/FileRemapper.h index 181e130add..9a0b690ad6 100644 --- a/include/clang/ARCMigrate/FileRemapper.h +++ b/include/clang/ARCMigrate/FileRemapper.h @@ -23,7 +23,7 @@ namespace llvm { namespace clang { class FileManager; class FileEntry; - class Diagnostic; + class DiagnosticsEngine; class CompilerInvocation; namespace arcmt { @@ -42,11 +42,11 @@ public: FileRemapper(); ~FileRemapper(); - bool initFromDisk(StringRef outputDir, Diagnostic &Diag, + bool initFromDisk(StringRef outputDir, DiagnosticsEngine &Diag, bool ignoreIfFilesChanged); - bool flushToDisk(StringRef outputDir, Diagnostic &Diag); + bool flushToDisk(StringRef outputDir, DiagnosticsEngine &Diag); - bool overwriteOriginal(Diagnostic &Diag, + bool overwriteOriginal(DiagnosticsEngine &Diag, StringRef outputDir = StringRef()); void remap(StringRef filePath, llvm::MemoryBuffer *memBuf); @@ -65,7 +65,7 @@ private: const FileEntry *getOriginalFile(StringRef filePath); void resetTarget(Target &targ); - bool report(const Twine &err, Diagnostic &Diag); + bool report(const Twine &err, DiagnosticsEngine &Diag); std::string getRemapInfoFile(StringRef outputDir); }; diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index e1a89b35df..9d8aa537a3 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -44,7 +44,7 @@ namespace clang { class ASTRecordLayout; class BlockExpr; class CharUnits; - class Diagnostic; + class DiagnosticsEngine; class Expr; class ExternalASTSource; class ASTMutationListener; @@ -374,7 +374,7 @@ public: const LangOptions& getLangOptions() const { return LangOpts; } - Diagnostic &getDiagnostics() const; + DiagnosticsEngine &getDiagnostics() const; FullSourceLoc getFullLoc(SourceLocation Loc) const { return FullSourceLoc(Loc,SourceMgr); diff --git a/include/clang/AST/ASTDiagnostic.h b/include/clang/AST/ASTDiagnostic.h index ffd5e1e2eb..846321bd39 100644 --- a/include/clang/AST/ASTDiagnostic.h +++ b/include/clang/AST/ASTDiagnostic.h @@ -24,23 +24,23 @@ namespace clang { }; } // end namespace diag - /// \brief Diagnostic argument formatting function for diagnostics that + /// \brief DiagnosticsEngine argument formatting function for diagnostics that /// involve AST nodes. /// /// This function formats diagnostic arguments for various AST nodes, /// including types, declaration names, nested name specifiers, and /// declaration contexts, into strings that can be printed as part of /// diagnostics. It is meant to be used as the argument to - /// \c Diagnostic::SetArgToStringFn(), where the cookie is an \c ASTContext - /// pointer. + /// \c DiagnosticsEngine::SetArgToStringFn(), where the cookie is an \c + /// ASTContext pointer. void 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, diff --git a/include/clang/AST/ASTImporter.h b/include/clang/AST/ASTImporter.h index a0bd9c6997..b583fbf906 100644 --- a/include/clang/AST/ASTImporter.h +++ b/include/clang/AST/ASTImporter.h @@ -25,7 +25,7 @@ namespace clang { class ASTContext; class Decl; class DeclContext; - class Diagnostic; + class DiagnosticsEngine; class Expr; class FileManager; class IdentifierInfo; diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index c28242d118..841aa3b59c 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -3043,7 +3043,8 @@ public: /// into a diagnostic with <<. inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, const NamedDecl* ND) { - DB.AddTaggedVal(reinterpret_cast<intptr_t>(ND), Diagnostic::ak_nameddecl); + DB.AddTaggedVal(reinterpret_cast<intptr_t>(ND), + DiagnosticsEngine::ak_nameddecl); return DB; } diff --git a/include/clang/AST/DeclarationName.h b/include/clang/AST/DeclarationName.h index 7c670c4741..2170f2b1ef 100644 --- a/include/clang/AST/DeclarationName.h +++ b/include/clang/AST/DeclarationName.h @@ -520,7 +520,7 @@ public: inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, DeclarationName N) { DB.AddTaggedVal(N.getAsOpaqueInteger(), - Diagnostic::ak_declarationname); + DiagnosticsEngine::ak_declarationname); return DB; } @@ -529,7 +529,7 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, DeclarationName N) { PD.AddTaggedVal(N.getAsOpaqueInteger(), - Diagnostic::ak_declarationname); + DiagnosticsEngine::ak_declarationname); return PD; } diff --git a/include/clang/AST/Mangle.h b/include/clang/AST/Mangle.h index fcb7ebdba5..f58a83b54b 100644 --- a/include/clang/AST/Mangle.h +++ b/include/clang/AST/Mangle.h @@ -65,21 +65,21 @@ private: /// calls to the C++ name mangler. class MangleContext { ASTContext &Context; - Diagnostic &Diags; + DiagnosticsEngine &Diags; llvm::DenseMap<const BlockDecl*, unsigned> GlobalBlockIds; llvm::DenseMap<const BlockDecl*, unsigned> LocalBlockIds; public: explicit MangleContext(ASTContext &Context, - Diagnostic &Diags) + DiagnosticsEngine &Diags) : Context(Context), Diags(Diags) { } virtual ~MangleContext() { } ASTContext &getASTContext() const { return Context; } - Diagnostic &getDiags() const { return Diags; } + DiagnosticsEngine &getDiags() const { return Diags; } virtual void startNewFunction() { LocalBlockIds.clear(); } @@ -141,9 +141,9 @@ public: }; MangleContext *createItaniumMangleContext(ASTContext &Context, - Diagnostic &Diags); + DiagnosticsEngine &Diags); MangleContext *createMicrosoftMangleContext(ASTContext &Context, - Diagnostic &Diags); + DiagnosticsEngine &Diags); } diff --git a/include/clang/AST/NestedNameSpecifier.h b/include/clang/AST/NestedNameSpecifier.h index d1d6e72ca7..c81c06e332 100644 --- a/include/clang/AST/NestedNameSpecifier.h +++ b/include/clang/AST/NestedNameSpecifier.h @@ -465,7 +465,7 @@ public: inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, NestedNameSpecifier *NNS) { DB.AddTaggedVal(reinterpret_cast<intptr_t>(NNS), - Diagnostic::ak_nestednamespec); + DiagnosticsEngine::ak_nestednamespec); return DB; } diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index a33a806f60..90e29ba741 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -4761,7 +4761,7 @@ inline const Type *Type::getBaseElementTypeUnsafe() const { inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, QualType T) { DB.AddTaggedVal(reinterpret_cast<intptr_t>(T.getAsOpaquePtr()), - Diagnostic::ak_qualtype); + DiagnosticsEngine::ak_qualtype); return DB; } @@ -4770,7 +4770,7 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, QualType T) { PD.AddTaggedVal(reinterpret_cast<intptr_t>(T.getAsOpaquePtr()), - Diagnostic::ak_qualtype); + DiagnosticsEngine::ak_qualtype); return PD; } diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index ca0197b14c..5015f64876 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -100,12 +100,12 @@ public: } }; -/// Diagnostic - This concrete class is used by the front-end to report +/// DiagnosticsEngine - This concrete class is used by the front-end to report /// problems and issues. It massages the diagnostics (e.g. handling things like /// "report warnings as errors" and passes them off to the DiagnosticClient for -/// reporting to the user. Diagnostic is tied to one translation unit and +/// reporting to the user. DiagnosticsEngine is tied to one translation unit and /// one SourceManager. -class Diagnostic : public llvm::RefCountedBase<Diagnostic> { +class DiagnosticsEngine : public llvm::RefCountedBase<DiagnosticsEngine> { public: /// Level - The level of the diagnostic, after it has been through mapping. enum Level { @@ -303,10 +303,11 @@ private: std::string DelayedDiagArg2; public: - explicit Diagnostic(const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &Diags, + explicit DiagnosticsEngine( + const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &Diags, DiagnosticClient *client = 0, bool ShouldOwnClient = true); - ~Diagnostic(); + ~DiagnosticsEngine(); const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &getDiagnosticIDs() const { return Diags; @@ -315,7 +316,7 @@ public: DiagnosticClient *getClient() { return Client; } const DiagnosticClient *getClient() const { return Client; } - /// \brief Determine whether this \c Diagnostic object own its client. + /// \brief Determine whether this \c DiagnosticsEngine object own its client. bool ownsClient() const { return OwnsDiagClient; } /// \brief Return the current diagnostic client along with ownership of that @@ -333,8 +334,8 @@ public: void setSourceManager(SourceManager *SrcMgr) { SourceMgr = SrcMgr; } //===--------------------------------------------------------------------===// - // Diagnostic characterization methods, used by a client to customize how - // diagnostics are emitted. + // DiagnosticsEngine characterization methods, used by a client to customize + // how diagnostics are emitted. // /// pushMappings - Copies the current DiagMappings and pushes the new copy @@ -495,10 +496,10 @@ public: void Reset(); //===--------------------------------------------------------------------===// - // Diagnostic classification and reporting interfaces. + // DiagnosticsEngine classification and reporting interfaces. // - /// \brief Based on the way the client configured the Diagnostic + /// \brief Based on the way the client configured the DiagnosticsEngine /// object, classify the specified diagnostic ID into a Level, consumable by /// the DiagnosticClient. /// @@ -538,11 +539,11 @@ public: /// /// \param Arg1 A string argument that will be provided to the /// diagnostic. A copy of this string will be stored in the - /// Diagnostic object itself. + /// DiagnosticsEngine object itself. /// /// \param Arg2 A string argument that will be provided to the /// diagnostic. A copy of this string will be stored in the - /// Diagnostic object itself. + /// DiagnosticsEngine object itself. void SetDelayedDiagnostic(unsigned DiagID, StringRef Arg1 = "", StringRef Arg2 = ""); @@ -648,12 +649,12 @@ private: /// between the time the instance was created and the time it was /// queried. class DiagnosticErrorTrap { - Diagnostic &Diag; + DiagnosticsEngine &Diag; unsigned NumErrors; unsigned NumUnrecoverableErrors; public: - explicit DiagnosticErrorTrap(Diagnostic &Diag) + explicit DiagnosticErrorTrap(DiagnosticsEngine &Diag) : Diag(Diag) { reset(); } /// \brief Determine whether any errors have occurred since this @@ -680,9 +681,9 @@ public: //===----------------------------------------------------------------------===// /// DiagnosticBuilder - This is a little helper class used to produce -/// diagnostics. This is constructed by the Diagnostic::Report method, and -/// allows insertion of extra information (arguments and source ranges) into the -/// currently "in flight" diagnostic. When the temporary for the builder is +/// diagnostics. This is constructed by the DiagnosticsEngine::Report method, +/// and allows insertion of extra information (arguments and source ranges) into +/// the currently "in flight" diagnostic. When the temporary for the builder is /// destroyed, the diagnostic is issued. /// /// Note that many of these will be created as temporary objects (many call @@ -691,12 +692,12 @@ public: /// the common fields to registers, eliminating increments of the NumArgs field, /// for example. class DiagnosticBuilder { - mutable Diagnostic *DiagObj; + mutable DiagnosticsEngine *DiagObj; mutable unsigned NumArgs, NumRanges, NumFixItHints; void operator=(const DiagnosticBuilder&); // DO NOT IMPLEMENT - friend class Diagnostic; - explicit DiagnosticBuilder(Diagnostic *diagObj) + friend class DiagnosticsEngine; + explicit DiagnosticBuilder(DiagnosticsEngine *diagObj) : DiagObj(diagObj), NumArgs(0), NumRanges(0), NumFixItHints(0) {} friend class PartialDiagnostic; @@ -744,7 +745,7 @@ public: /// /// \pre \c isActive() unsigned getDiagID() const { - assert(isActive() && "Diagnostic is inactive"); + assert(isActive() && "DiagnosticsEngine is inactive"); return DiagObj->CurDiagID; } @@ -757,16 +758,16 @@ public: operator bool() const { return true; } void AddString(StringRef S) const { - assert(NumArgs < Diagnostic::MaxArguments && + assert(NumArgs < DiagnosticsEngine::MaxArguments && "Too many arguments to diagnostic!"); if (DiagObj) { - DiagObj->DiagArgumentsKind[NumArgs] = Diagnostic::ak_std_string; + DiagObj->DiagArgumentsKind[NumArgs] = DiagnosticsEngine::ak_std_string; DiagObj->DiagArgumentsStr[NumArgs++] = S; } } - void AddTaggedVal(intptr_t V, Diagnostic::ArgumentKind Kind) const { - assert(NumArgs < Diagnostic::MaxArguments && + void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const { + assert(NumArgs < DiagnosticsEngine::MaxArguments && "Too many arguments to diagnostic!"); if (DiagObj) { DiagObj->DiagArgumentsKind[NumArgs] = Kind; @@ -783,7 +784,7 @@ public: } void AddFixItHint(const FixItHint &Hint) const { - assert(NumFixItHints < Diagnostic::MaxFixItHints && + assert(NumFixItHints < DiagnosticsEngine::MaxFixItHints && "Too many fix-it hints!"); if (DiagObj) DiagObj->FixItHints[NumFixItHints++] = Hint; @@ -799,30 +800,30 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, const char *Str) { DB.AddTaggedVal(reinterpret_cast<intptr_t>(Str), - Diagnostic::ak_c_string); + DiagnosticsEngine::ak_c_string); return DB; } inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, int I) { - DB.AddTaggedVal(I, Diagnostic::ak_sint); + DB.AddTaggedVal(I, DiagnosticsEngine::ak_sint); return DB; } inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,bool I) { - DB.AddTaggedVal(I, Diagnostic::ak_sint); + DB.AddTaggedVal(I, DiagnosticsEngine::ak_sint); return DB; } inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, unsigned I) { - DB.AddTaggedVal(I, Diagnostic::ak_uint); + DB.AddTaggedVal(I, DiagnosticsEngine::ak_uint); return DB; } inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, const IdentifierInfo *II) { DB.AddTaggedVal(reinterpret_cast<intptr_t>(II), - Diagnostic::ak_identifierinfo); + DiagnosticsEngine::ak_identifierinfo); return DB; } @@ -836,7 +837,7 @@ typename llvm::enable_if<llvm::is_same<T, DeclContext>, const DiagnosticBuilder &>::type operator<<(const DiagnosticBuilder &DB, T *DC) { DB.AddTaggedVal(reinterpret_cast<intptr_t>(DC), - Diagnostic::ak_declcontext); + DiagnosticsEngine::ak_declcontext); return DB; } @@ -861,14 +862,14 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, /// Report - Issue the message to the client. DiagID is a member of the /// diag::kind enum. This actually returns a new instance of DiagnosticBuilder /// which emits the diagnostics (through ProcessDiag) when it is destroyed. -inline DiagnosticBuilder Diagnostic::Report(SourceLocation Loc, +inline DiagnosticBuilder DiagnosticsEngine::Report(SourceLocation Loc, unsigned DiagID){ assert(CurDiagID == ~0U && "Multiple diagnostics in flight at once!"); CurDiagLoc = Loc; CurDiagID = DiagID; return DiagnosticBuilder(this); } -inline DiagnosticBuilder Diagnostic::Report(unsigned DiagID) { +inline DiagnosticBuilder DiagnosticsEngine::Report(unsigned DiagID) { return Report(SourceLocation(), DiagID); } @@ -877,17 +878,17 @@ inline DiagnosticBuilder Diagnostic::Report(unsigned DiagID) { //===----------------------------------------------------------------------===// /// DiagnosticInfo - This is a little helper class (which is basically a smart -/// pointer that forward info from Diagnostic) that allows clients to enquire -/// about the currently in-flight diagnostic. +/// pointer that forward info from DiagnosticsEngine) that allows clients to +/// enquire about the currently in-flight diagnostic. class DiagnosticInfo { - const Diagnostic *DiagObj; + const DiagnosticsEngine *DiagObj; StringRef StoredDiagMessage; public: - explicit DiagnosticInfo(const Diagnostic *DO) : DiagObj(DO) {} - DiagnosticInfo(const Diagnostic *DO, StringRef storedDiagMessage) + explicit DiagnosticInfo(const DiagnosticsEngine *DO) : DiagObj(DO) {} + DiagnosticInfo(const DiagnosticsEngine *DO, StringRef storedDiagMessage) : DiagObj(DO), StoredDiagMessage(storedDiagMessage) {} - const Diagnostic *getDiags() const { return DiagObj; } + const DiagnosticsEngine *getDiags() const { return DiagObj; } unsigned getID() const { return DiagObj->CurDiagID; } const SourceLocation &getLocation() const { return DiagObj->CurDiagLoc; } bool hasSourceManager() const { return DiagObj->hasSourceManager(); } @@ -897,49 +898,49 @@ public: /// getArgKind - Return the kind of the specified index. Based on the kind /// of argument, the accessors below can be used to get the value. - Diagnostic::ArgumentKind getArgKind(unsigned Idx) const { + DiagnosticsEngine::ArgumentKind getArgKind(unsigned Idx) const { assert(Idx < getNumArgs() && "Argument index out of range!"); - return (Diagnostic::ArgumentKind)DiagObj->DiagArgumentsKind[Idx]; + return (DiagnosticsEngine::ArgumentKind)DiagObj->DiagArgumentsKind[Idx]; } /// getArgStdStr - Return the provided argument string specified by Idx. const std::string &getArgStdStr(unsigned Idx) const { - assert(getArgKind(Idx) == Diagnostic::ak_std_string && + assert(getArgKind(Idx) == DiagnosticsEngine::ak_std_string && "invalid argument accessor!"); return DiagObj->DiagArgumentsStr[Idx]; } /// getArgCStr - Return the specified C string argument. const char *getArgCStr(unsigned Idx) const { - assert(getArgKind(Idx) == Diagnostic::ak_c_string && + assert(getArgKind(Idx) == DiagnosticsEngine::ak_c_string && "invalid argument accessor!"); return reinterpret_cast<const char*>(DiagObj->DiagArgumentsVal[Idx]); } /// getArgSInt - Return the specified signed integer argument. int getArgSInt(unsigned Idx) const { - assert(getArgKind(Idx) == Diagnostic::ak_sint && + assert(getArgKind(Idx) == DiagnosticsEngine::ak_sint && "invalid argument accessor!"); return (int)DiagObj->DiagArgumentsVal[Idx]; } /// getArgUInt - Return the specified unsigned integer argument. unsigned getArgUInt(unsigned Idx) const { - assert(getArgKind(Idx) == Diagnostic::ak_uint && + assert(getArgKind(Idx) == DiagnosticsEngine::ak_uint && "invalid argument accessor!"); return (unsigned)DiagObj->DiagArgumentsVal[Idx]; } /// getArgIdentifier - Return the specified IdentifierInfo argument. const IdentifierInfo *getArgIdentifier(unsigned Idx) const { - assert(getArgKind(Idx) == Diagnostic::ak_identifierinfo && + assert(getArgKind(Idx) == DiagnosticsEngine::ak_identifierinfo && "invalid argument accessor!"); return reinterpret_cast<IdentifierInfo*>(DiagObj->DiagArgumentsVal[Idx]); } /// getRawArg - Return the specified non-string argument in an opaque form. intptr_t getRawArg(unsigned Idx) const { - assert(getArgKind(Idx) != Diagnostic::ak_std_string && + assert(getArgKind(Idx) != DiagnosticsEngine::ak_std_string && "invalid argument accessor!"); return DiagObj->DiagArgumentsVal[Idx]; } @@ -986,7 +987,7 @@ public: */ class StoredDiagnostic { unsigned ID; - Diagnostic::Level Level; + DiagnosticsEngine::Level Level; FullSourceLoc Loc; std::string Message; std::vector<CharSourceRange> Ranges; @@ -994,10 +995,10 @@ class StoredDiagnostic { public: StoredDiagnostic(); - StoredDiagnostic(Diagnostic::Level Level, const DiagnosticInfo &Info); - StoredDiagnostic(Diagnostic::Level Level, unsigned ID, + StoredDiagnostic(DiagnosticsEngine::Level Level, const DiagnosticInfo &Info); + StoredDiagnostic(DiagnosticsEngine::Level Level, unsigned ID, StringRef Message); - StoredDiagnostic(Diagnostic::Level Level, unsigned ID, + StoredDiagnostic(DiagnosticsEngine::Level Level, unsigned ID, StringRef Message, FullSourceLoc Loc, ArrayRef<CharSourceRange> Ranges, ArrayRef<FixItHint> Fixits); @@ -1007,7 +1008,7 @@ public: operator bool() const { return Message.size() > 0; } unsigned getID() const { return ID; } - Diagnostic::Level getLevel() const { return Level; } + DiagnosticsEngine::Level getLevel() const { return Level; } const FullSourceLoc &getLocation() const { return Loc; } StringRef getMessage() const { return Message; } @@ -1061,7 +1062,7 @@ public: /// 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. + /// by DiagnosticsEngine. virtual bool IncludeInDiagnosticCounts() const; /// HandleDiagnostic - Handle this diagnostic, reporting it to the user or @@ -1069,7 +1070,7 @@ public: /// /// Default implementation just keeps track of the total number of warnings /// and errors. - virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, + virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const DiagnosticInfo &Info); }; diff --git a/include/clang/Basic/DiagnosticIDs.h b/include/clang/Basic/DiagnosticIDs.h index 76fe54f1ef..1169f9ce3f 100644 --- a/include/clang/Basic/DiagnosticIDs.h +++ b/include/clang/Basic/DiagnosticIDs.h @@ -19,7 +19,7 @@ #include "clang/Basic/LLVM.h" namespace clang { - class Diagnostic; + class DiagnosticsEngine; class SourceLocation; // Import the diagnostic enums themselves. @@ -220,16 +220,17 @@ private: /// "unknown-pragmas" to have the specified mapping. This returns true and /// ignores the request if "Group" was unknown, false otherwise. bool setDiagnosticGroupMapping(StringRef Group, diag::Mapping Map, - SourceLocation Loc, Diagnostic &Diag) const; + SourceLocation Loc, + DiagnosticsEngine &Diag) const; - /// \brief Based on the way the client configured the Diagnostic + /// \brief Based on the way the client configured the DiagnosticsEngine /// object, classify the specified diagnostic ID into a Level, consumable by /// the DiagnosticClient. /// /// \param Loc The source location we are interested in finding out the /// diagnostic state. Can be null in order to query the latest state. DiagnosticIDs::Level getDiagnosticLevel(unsigned DiagID, SourceLocation Loc, - const Diagnostic &Diag, + const DiagnosticsEngine &Diag, diag::Mapping *mapping = 0) const; /// getDiagnosticLevel - This is an internal implementation helper used when @@ -237,7 +238,7 @@ private: DiagnosticIDs::Level getDiagnosticLevel(unsigned DiagID, unsigned DiagClass, SourceLocation Loc, - const Diagnostic &Diag, + const DiagnosticsEngine &Diag, diag::Mapping *mapping = 0) const; /// ProcessDiag - This is the method used to report a diagnostic that is @@ -245,13 +246,13 @@ private: /// /// \returns true if the diagnostic was emitted, false if it was /// suppressed. - bool ProcessDiag(Diagnostic &Diag) const; + bool ProcessDiag(DiagnosticsEngine &Diag) const; /// \brief Whether the diagnostic may leave the AST in a state where some /// invariants can break. bool isUnrecoverable(unsigned DiagID) const; - friend class Diagnostic; + friend class DiagnosticsEngine; }; } // end namespace clang diff --git a/include/clang/Basic/PartialDiagnostic.h b/include/clang/Basic/PartialDiagnostic.h index 489b64e6f8..fac5580f85 100644 --- a/include/clang/Basic/PartialDiagnostic.h +++ b/include/clang/Basic/PartialDiagnostic.h @@ -195,7 +195,7 @@ public: { // Copy arguments. for (unsigned I = 0, N = Other.getNumArgs(); I != N; ++I) { - if (Other.getArgKind(I) == Diagnostic::ak_std_string) + if (Other.getArgKind(I) == DiagnosticsEngine::ak_std_string) AddString(Other.getArgStdStr(I)); else AddTaggedVal(Other.getRawArg(I), Other.getArgKind(I)); @@ -230,7 +230,7 @@ public: unsigned getDiagID() const { return DiagID; } - void AddTaggedVal(intptr_t V, Diagnostic::ArgumentKind Kind) const { + void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const { if (!DiagStorage) DiagStorage = getStorage(); @@ -247,7 +247,7 @@ public: assert(DiagStorage->NumDiagArgs < Storage::MaxArguments && "Too many arguments to diagnostic!"); DiagStorage->DiagArgumentsKind[DiagStorage->NumDiagArgs] - = Diagnostic::ak_std_string; + = DiagnosticsEngine::ak_std_string; DiagStorage->DiagArgumentsStr[DiagStorage->NumDiagArgs++] = V; } @@ -257,12 +257,12 @@ public: // Add all arguments. for (unsigned i = 0, e = DiagStorage->NumDiagArgs; i != e; ++i) { - if ((Diagnostic::ArgumentKind)DiagStorage->DiagArgumentsKind[i] - == Diagnostic::ak_std_string) + if ((DiagnosticsEngine::ArgumentKind)DiagStorage->DiagArgumentsKind[i] + == DiagnosticsEngine::ak_std_string) DB.AddString(DiagStorage->DiagArgumentsStr[i]); else DB.AddTaggedVal(DiagStorage->DiagArgumentsVal[i], - (Diagnostic::ArgumentKind)DiagStorage->DiagArgumentsKind[i]); + (DiagnosticsEngine::ArgumentKind)DiagStorage->DiagArgumentsKind[i]); } // Add all ranges. @@ -285,19 +285,20 @@ public: friend const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, unsigned I) { - PD.AddTaggedVal(I, Diagnostic::ak_uint); + PD.AddTaggedVal(I, DiagnosticsEngine::ak_uint); return PD; } friend const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, int I) { - PD.AddTaggedVal(I, Diagnostic::ak_sint); + PD.AddTaggedVal(I, DiagnosticsEngine::ak_sint); return PD; } friend inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, const char *S) { - PD.AddTaggedVal(reinterpret_cast<intptr_t>(S), Diagnostic::ak_c_string); + PD.AddTaggedVal(reinterpret_cast<intptr_t>(S), + DiagnosticsEngine::ak_c_string); return PD; } diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index 46fdbe5066..9178447a72 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -29,7 +29,7 @@ namespace clang { -class Diagnostic; +class DiagnosticsEngine; class SourceManager; class FileManager; class FileEntry; @@ -118,7 +118,7 @@ namespace SrcMgr { /// will be emitted at. /// /// \param Invalid If non-NULL, will be set \c true if an error occurred. - const llvm::MemoryBuffer *getBuffer(Diagnostic &Diag, + const llvm::MemoryBuffer *getBuffer(DiagnosticsEngine &Diag, const SourceManager &SM, SourceLocation Loc = SourceLocation(), bool *Invalid = 0) const; @@ -479,8 +479,8 @@ public: /// where the expanded token came from and the expansion location specifies /// where it was expanded. class SourceManager : public llvm::RefCountedBase<SourceManager> { - /// \brief Diagnostic object. - Diagnostic &Diag; + /// \brief DiagnosticsEngine object. + DiagnosticsEngine &Diag; FileManager &FileMgr; @@ -575,12 +575,12 @@ class SourceManager : public llvm::RefCountedBase<SourceManager> { explicit SourceManager(const SourceManager&); void operator=(const SourceManager&); public: - SourceManager(Diagnostic &Diag, FileManager &FileMgr); + SourceManager(DiagnosticsEngine &Diag, FileManager &FileMgr); ~SourceManager(); void clearIDTables(); - Diagnostic &getDiagnostics() const { return Diag; } + DiagnosticsEngine &getDiagnostics() const { return Diag; } FileManager &getFileManager() const { return FileMgr; } diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index aad72e35be..fbca54d6f1 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -32,7 +32,7 @@ struct fltSemantics; } namespace clang { -class Diagnostic; +class DiagnosticsEngine; class LangOptions; class MacroBuilder; class SourceLocation; @@ -98,7 +98,8 @@ public: /// \param Opts - The options to use to initialize the target. The target may /// modify the options to canonicalize the target feature information to match /// what the backend expects. - static TargetInfo* CreateTargetInfo(Diagnostic &Diags, TargetOptions &Opts); + static TargetInfo* CreateTargetInfo(DiagnosticsEngine &Diags, + TargetOptions &Opts); virtual ~TargetInfo(); diff --git a/include/clang/CodeGen/BackendUtil.h b/include/clang/CodeGen/BackendUtil.h index 5003d675b6..135b6a927f 100644 --- a/include/clang/CodeGen/BackendUtil.h +++ b/include/clang/CodeGen/BackendUtil.h @@ -17,7 +17,7 @@ namespace llvm { } namespace clang { - class Diagnostic; + class DiagnosticsEngine; class CodeGenOptions; class TargetOptions; class LangOptions; @@ -31,7 +31,7 @@ namespace clang { Backend_EmitObj ///< Emit native object files }; - void EmitBackendOutput(Diagnostic &Diags, const CodeGenOptions &CGOpts, + void EmitBackendOutput(DiagnosticsEngine &Diags, const CodeGenOptions &CGOpts, const TargetOptions &TOpts, const LangOptions &LOpts, llvm::Module *M, BackendAction Action, raw_ostream *OS); diff --git a/include/clang/CodeGen/ModuleBuilder.h b/include/clang/CodeGen/ModuleBuilder.h index c45ad08716..38aba89002 100644 --- a/include/clang/CodeGen/ModuleBuilder.h +++ b/include/clang/CodeGen/ModuleBuilder.h @@ -23,7 +23,7 @@ namespace llvm { } namespace clang { - class Diagnostic; + class DiagnosticsEngine; class LangOptions; class CodeGenOptions; @@ -36,7 +36,7 @@ namespace clang { /// CreateLLVMCodeGen - Create a CodeGenerator instance. /// It is the responsibility of the caller to call delete on /// the allocated CodeGenerator instance. - CodeGenerator *CreateLLVMCodeGen(Diagnostic &Diags, + CodeGenerator *CreateLLVMCodeGen(DiagnosticsEngine &Diags, const std::string &ModuleName, const CodeGenOptions &CGO, llvm::LLVMContext& C); diff --git a/include/clang/Driver/ArgList.h b/include/clang/Driver/ArgList.h index b31eea5b5b..04faf64dc5 100644 --- a/include/clang/Driver/ArgList.h +++ b/include/clang/Driver/ArgList.h @@ -21,7 +21,7 @@ #include <vector> namespace clang { - class Diagnostic; + class DiagnosticsEngine; namespace driver { class Arg; @@ -205,7 +205,7 @@ namespace driver { /// getLastArgValue - Return the value of the last argument as an integer, /// or a default. Emits an error if the argument is given, but non-integral. int getLastArgIntValue(OptSpecifier Id, int Default, - Diagnostic &Diags) const; + DiagnosticsEngine &Diags) const; /// getAllArgValues - Get the values of all instances of the given argument /// as strings. diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h index bcb75b3a28..549893e6bf 100644 --- a/include/clang/Driver/Driver.h +++ b/include/clang/Driver/Driver.h @@ -47,7 +47,7 @@ namespace driver { class Driver { OptTable *Opts; - Diagnostic &Diags; + DiagnosticsEngine &Diags; public: // Diag - Forwarding function for diagnostics. @@ -190,7 +190,7 @@ public: StringRef _DefaultHostTriple, StringRef _DefaultImageName, bool IsProduction, bool CXXIsProduction, - Diagnostic &_Diags); + DiagnosticsEngine &_Diags); ~Driver(); /// @name Accessors @@ -202,7 +202,7 @@ public: const OptTable &getOpts() const { return *Opts; } - const Diagnostic &getDiags() const { return Diags; } + const DiagnosticsEngine &getDiags() const { return Diags; } bool getCheckInputsExist() const { return CheckInputsExist; } diff --git a/include/clang/Frontend/ASTConsumers.h b/include/clang/Frontend/ASTConsumers.h index dd6dd9ddb6..cef9509a97 100644 --- a/include/clang/Frontend/ASTConsumers.h +++ b/include/clang/Frontend/ASTConsumers.h @@ -23,7 +23,7 @@ namespace clang { class ASTConsumer; class CodeGenOptions; -class Diagnostic; +class DiagnosticsEngine; class FileManager; class LangOptions; class Preprocessor; diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h index 37ae4e2932..86f9b0670e 100644 --- a/include/clang/Frontend/ASTUnit.h +++ b/include/clang/Frontend/ASTUnit.h @@ -46,7 +46,7 @@ class ASTReader; class CodeCompleteConsumer; class CompilerInvocation; class Decl; -class Diagnostic; +class DiagnosticsEngine; class FileEntry; class FileManager; class HeaderSearch; @@ -69,13 +69,13 @@ class GlobalCodeCompletionAllocator /// class ASTUnit : public ModuleLoader { private: - llvm::IntrusiveRefCntPtr<Diagnostic> Diagnostics; - llvm::IntrusiveRefCntPtr<FileManager> FileMgr; - llvm::IntrusiveRefCntPtr<SourceManager> SourceMgr; - llvm::OwningPtr<HeaderSearch> HeaderInfo; - llvm::IntrusiveRefCntPtr<TargetInfo> Target; - llvm::IntrusiveRefCntPtr<Preprocessor> PP; - llvm::IntrusiveRefCntPtr<ASTContext> Ctx; + llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics; + llvm::IntrusiveRefCntPtr<FileManager> FileMgr; + llvm::IntrusiveRefCntPtr<SourceManager> SourceMgr; + llvm::OwningPtr<HeaderSearch> HeaderInfo; + llvm::IntrusiveRefCntPtr<TargetInfo> Target; + llvm::IntrusiveRefCntPtr<Preprocessor> PP; + llvm::IntrusiveRefCntPtr<ASTContext> Ctx; FileSystemOptions FileSystemOpts; @@ -240,8 +240,8 @@ private: /// \brief The number of warnings that occurred while parsing the preamble. /// - /// This value will be used to restore the state of the \c Diagnostic object - /// when re-using the precompiled preamble. Note that only the + /// This value will be used to restore the state of the \c DiagnosticsEngine + /// object when re-using the precompiled preamble. Note that only the /// number of warnings matters, since we will not save the preamble /// when any errors are present. unsigned NumWarningsInPreamble; @@ -260,7 +260,7 @@ private: /// \brief The language options used when we load an AST file. LangOptions ASTFileLangOpts; - static void ConfigureDiags(llvm::IntrusiveRefCntPtr<Diagnostic> &Diags, + static void ConfigureDiags(llvm::IntrusiveRefCntPtr<DiagnosticsEngine> &Diags, const char **ArgBegin, const char **ArgEnd, ASTUnit &AST, bool CaptureDiagnostics); @@ -420,8 +420,8 @@ public: bool isUnsafeToFree() const { return UnsafeToFree; } void setUnsafeToFree(bool Value) { UnsafeToFree = Value; } - const Diagnostic &getDiagnostics() const { return *Diagnostics; } - Diagnostic &getDiagnostics() { return *Diagnostics; } + const DiagnosticsEngine &getDiagnostics() const { return *Diagnostics; } + DiagnosticsEngine &getDiagnostics() { return *Diagnostics; } const SourceManager &getSourceManager() const { return *SourceMgr; } SourceManager &getSourceManager() { return *SourceMgr; } @@ -563,7 +563,7 @@ public: /// \brief Create a ASTUnit. Gets ownership of the passed CompilerInvocation. static ASTUnit *create(CompilerInvocation *CI, - llvm::IntrusiveRefCntPtr<Diagnostic> Diags); + llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags); /// \brief Create a ASTUnit from an AST file. /// @@ -574,7 +574,7 @@ public: /// /// \returns - The initialized ASTUnit or null if the AST failed to load. static ASTUnit *LoadFromASTFile(const std::string &Filename, - llvm::IntrusiveRefCntPtr<Diagnostic> Diags, + llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags, const FileSystemOptions &FileSystemOpts, bool OnlyLocalDecls = false, RemappedFile *RemappedFiles = 0, @@ -606,7 +606,7 @@ public: /// \param Action - The ASTFrontendAction to invoke. Its ownership is not /// transfered. static ASTUnit *LoadFromCompilerInvocationAction(CompilerInvocation *CI, - llvm::IntrusiveRefCntPtr<Diagnostic> Diags, + llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags, ASTFrontendAction *Action = 0); /// LoadFromCompilerInvocation - Create an ASTUnit from a source file, via a @@ -621,7 +621,7 @@ public: // FIXME: Move OnlyLocalDecls, UseBumpAllocator to setters on the ASTUnit, we // shouldn't need to specify them at construction time. static ASTUnit *LoadFromCompilerInvocation(CompilerInvocation *CI, - llvm::IntrusiveRefCntPtr<Diagnostic> Diags, + llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags, bool OnlyLocalDecls = false, bool CaptureDiagnostics = false, bool PrecompilePreamble = false, @@ -645,7 +645,7 @@ public: // shouldn't need to specify them at construction time. static ASTUnit *LoadFromCommandLine(const char **ArgBegin, const char **ArgEnd, - llvm::IntrusiveRefCntPtr<Diagnostic> Diags, + llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags, StringRef ResourceFilesPath, bool OnlyLocalDecls = false, bool CaptureDiagnostics = false, @@ -686,7 +686,7 @@ public: RemappedFile *RemappedFiles, unsigned NumRemappedFiles, 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/include/clang/Frontend/AnalyzerOptions.h b/include/clang/Frontend/AnalyzerOptions.h index b2da2c4891..20e4156ad6 100644 --- a/include/clang/Frontend/AnalyzerOptions.h +++ b/include/clang/Frontend/AnalyzerOptions.h @@ -20,7 +20,7 @@ namespace clang { class ASTConsumer; -class Diagnostic; +class DiagnosticsEngine; class Preprocessor; class LangOptions; diff --git a/include/clang/Frontend/ChainedDiagnosticClient.h b/include/clang/Frontend/ChainedDiagnosticClient.h index 70f21901db..cd513dc8a1 100644 --- a/include/clang/Frontend/ChainedDiagnosticClient.h +++ b/include/clang/Frontend/ChainedDiagnosticClient.h @@ -46,7 +46,7 @@ public: return Primary->IncludeInDiagnosticCounts(); } - virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, + virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const DiagnosticInfo &Info) { // Default implementation (Warnings/errors count). DiagnosticClient::HandleDiagnostic(DiagLevel, Info); diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index c61d6df196..1d204335f1 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -29,7 +29,7 @@ class ASTContext; class ASTConsumer; class ASTReader; class CodeCompleteConsumer; -class Diagnostic; +class DiagnosticsEngine; class DiagnosticClient; class ExternalASTSource; class FileManager; @@ -62,7 +62,7 @@ class CompilerInstance : public ModuleLoader { llvm::IntrusiveRefCntPtr<CompilerInvocation> Invocation; /// The diagnostics engine instance. - llvm::IntrusiveRefCntPtr<Diagnostic> Diagnostics; + llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics; /// The target being compiled for. llvm::IntrusiveRefCntPtr<TargetInfo> Target; @@ -252,13 +252,13 @@ public: bool hasDiagnostics() const { return Diagnostics != 0; } /// Get the current diagnostics engine. - Diagnostic &getDiagnostics() const { + DiagnosticsEngine &getDiagnostics() const { assert(Diagnostics && "Compiler instance has no diagnostics!"); return *Diagnostics; } /// setDiagnostics - Replace the current diagnostics engine. - void setDiagnostics(Diagnostic *Value); + void setDiagnostics(DiagnosticsEngine *Value); DiagnosticClient &getDiagnosticClient() const { assert(Diagnostics && Diagnostics->getClient() && @@ -455,7 +455,7 @@ public: /// allocating one if one is not provided. /// /// \param Client If non-NULL, a diagnostic client that will be - /// attached to (and, then, owned by) the Diagnostic inside this AST + /// attached to (and, then, owned by) the DiagnosticsEngine inside this AST /// unit. /// /// \param ShouldOwnClient If Client is non-NULL, specifies whether @@ -464,7 +464,7 @@ public: DiagnosticClient *Client = 0, bool ShouldOwnClient = true); - /// Create a Diagnostic object with a the TextDiagnosticPrinter. + /// Create a DiagnosticsEngine object with a the TextDiagnosticPrinter. /// /// The \arg Argc and \arg Argv arguments are used only for logging purposes, /// when the diagnostic options indicate that the compiler should output @@ -473,21 +473,21 @@ public: /// If no diagnostic client is provided, this creates a /// DiagnosticClient that is owned by the returned diagnostic /// object, if using directly the caller is responsible for - /// releasing the returned Diagnostic's client eventually. + /// releasing the returned DiagnosticsEngine's client eventually. /// /// \param Opts - The diagnostic options; note that the created text /// diagnostic object contains a reference to these options and its lifetime /// must extend past that of the diagnostic engine. /// /// \param Client If non-NULL, a diagnostic client that will be - /// attached to (and, then, owned by) the returned Diagnostic + /// attached to (and, then, owned by) the returned DiagnosticsEngine /// object. /// /// \param CodeGenOpts If non-NULL, the code gen options in use, which may be /// used by some diagnostics printers (for logging purposes only). /// /// \return The new object on success, or null on failure. - static llvm::IntrusiveRefCntPtr<Diagnostic> + static llvm::IntrusiveRefCntPtr<DiagnosticsEngine> createDiagnostics(const DiagnosticOptions &Opts, int Argc, const char* const *Argv, DiagnosticClient *Client = 0, @@ -612,7 +612,7 @@ public: /// /// \return True on success. static bool InitializeSourceManager(StringRef InputFile, - Diagnostic &Diags, + DiagnosticsEngine &Diags, FileManager &FileMgr, SourceManager &SourceMgr, const FrontendOptions &Opts); diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h index f09c97ec3f..47c70311dd 100644 --- a/include/clang/Frontend/CompilerInvocation.h +++ b/include/clang/Frontend/CompilerInvocation.h @@ -30,7 +30,7 @@ namespace clang { -class Diagnostic; +class DiagnosticsEngine; /// CompilerInvocation - Helper class for holding the data necessary to invoke /// the compiler. @@ -88,7 +88,7 @@ public: static void CreateFromArgs(CompilerInvocation &Res, const char* const *ArgBegin, const char* const *ArgEnd, - Diagnostic &Diags); + DiagnosticsEngine &Diags); /// GetBuiltinIncludePath - Get the directory where the compiler headers /// reside, relative to the compiler binary (found by the passed in diff --git a/include/clang/Frontend/DiagnosticOptions.h b/include/clang/Frontend/DiagnosticOptions.h index 5ae8eb3677..319abeb4fb 100644 --- a/include/clang/Frontend/DiagnosticOptions.h +++ b/include/clang/Frontend/DiagnosticOptions.h @@ -43,7 +43,7 @@ public: unsigned ShowColors : 1; /// Show diagnostics with ANSI color sequences. unsigned ShowOverloads : 1; /// Overload candidates to show. Values from - /// Diagnostic::OverloadsShown + /// DiagnosticsEngine::OverloadsShown unsigned VerifyDiagnostics: 1; /// Check that diagnostics match the expected /// diagnostics, indicated by markers in the /// input source file. @@ -82,7 +82,7 @@ public: PedanticErrors = 0; ShowCarets = 1; ShowColors = 0; - ShowOverloads = Diagnostic::Ovl_All; + ShowOverloads = DiagnosticsEngine::Ovl_All; ShowColumn = 1; ShowFixits = 1; ShowLocation = 1; diff --git a/include/clang/Frontend/LogDiagnosticPrinter.h b/include/clang/Frontend/LogDiagnosticPrinter.h index ee53a71d2f..7631bedf8c 100644 --- a/include/clang/Frontend/LogDiagnosticPrinter.h +++ b/include/clang/Frontend/LogDiagnosticPrinter.h @@ -37,7 +37,7 @@ class LogDiagnosticPrinter : public DiagnosticClient { unsigned DiagnosticID; /// The level of the diagnostic. - Diagnostic::Level DiagnosticLevel; + DiagnosticsEngine::Level DiagnosticLevel; }; raw_ostream &OS; @@ -68,7 +68,7 @@ public: void EndSourceFile(); - virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, + virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const DiagnosticInfo &Info); }; diff --git a/include/clang/Frontend/TextDiagnosticBuffer.h b/include/clang/Frontend/TextDiagnosticBuffer.h index 380a1dd224..11564f6688 100644 --- a/include/clang/Frontend/TextDiagnosticBuffer.h +++ b/include/clang/Frontend/TextDiagnosticBuffer.h @@ -39,12 +39,12 @@ public: const_iterator note_begin() const { return Notes.begin(); } const_iterator note_end() const { return Notes.end(); } - virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, + virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const DiagnosticInfo &Info); /// FlushDiagnostics - Flush the buffered diagnostics to an given /// diagnostic engine. - void FlushDiagnostics(Diagnostic &Diags) const; + void FlushDiagnostics(DiagnosticsEngine &Diags) const; }; } // end namspace clang diff --git a/include/clang/Frontend/TextDiagnosticPrinter.h b/include/clang/Frontend/TextDiagnosticPrinter.h index 52c95c9c2d..8369c7df58 100644 --- a/include/clang/Frontend/TextDiagnosticPrinter.h +++ b/include/clang/Frontend/TextDiagnosticPrinter.h @@ -53,14 +53,14 @@ public: LangOpts = 0; } - void PrintIncludeStack(Diagnostic::Level Level, SourceLocation Loc, + void PrintIncludeStack(DiagnosticsEngine::Level Level, SourceLocation Loc, const SourceManager &SM); - virtual void HandleDiagnostic(Diagnostic::Level Level, + virtual void HandleDiagnostic(DiagnosticsEngine::Level Level, const DiagnosticInfo &Info); private: - void EmitDiagnosticLoc(Diagnostic::Level Level, + void EmitDiagnosticLoc(DiagnosticsEngine::Level Level, const DiagnosticInfo &Info, const SourceManager &SM, PresumedLoc PLoc); diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h index b3ecb363ba..929beb079e 100644 --- a/include/clang/Frontend/Utils.h +++ b/include/clang/Frontend/Utils.h @@ -31,7 +31,7 @@ class CompilerInstance; class CompilerInvocation; class Decl; class DependencyOutputOptions; -class Diagnostic; +class DiagnosticsEngine; class DiagnosticOptions; class FileManager; class HeaderSearch; @@ -66,7 +66,7 @@ void InitializePreprocessor(Preprocessor &PP, /// ProcessWarningOptions - Initialize the diagnostic client and process the /// warning options specified on the command line. -void ProcessWarningOptions(Diagnostic &Diags, const DiagnosticOptions &Opts); +void ProcessWarningOptions(DiagnosticsEngine &Diags, const DiagnosticOptions &Opts); /// DoPrintPreprocessedInput - Implement -E mode. void DoPrintPreprocessedInput(Preprocessor &PP, raw_ostream* OS, @@ -101,8 +101,8 @@ void CacheTokens(Preprocessor &PP, llvm::raw_fd_ostream* OS); /// argument vector. CompilerInvocation * createInvocationFromCommandLine(ArrayRef<const char *> Args, - llvm::IntrusiveRefCntPtr<Diagnostic> Diags = - llvm::IntrusiveRefCntPtr<Diagnostic>()); + llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags = + llvm::IntrusiveRefCntPtr<DiagnosticsEngine>()); } // end namespace clang diff --git a/include/clang/Frontend/VerifyDiagnosticsClient.h b/include/clang/Frontend/VerifyDiagnosticsClient.h index 0c789ff86d..df84ab46cb 100644 --- a/include/clang/Frontend/VerifyDiagnosticsClient.h +++ b/include/clang/Frontend/VerifyDiagnosticsClient.h @@ -15,7 +15,7 @@ namespace clang { -class Diagnostic; +class DiagnosticsEngine; class TextDiagnosticBuffer; /// VerifyDiagnosticsClient - Create a diagnostic client which will use markers @@ -64,7 +64,7 @@ class TextDiagnosticBuffer; /// class VerifyDiagnosticsClient : public DiagnosticClient { public: - Diagnostic &Diags; + DiagnosticsEngine &Diags; DiagnosticClient *PrimaryClient; bool OwnsPrimaryClient; llvm::OwningPtr<TextDiagnosticBuffer> Buffer; @@ -78,7 +78,7 @@ public: /// Create a new verifying diagnostic client, which will issue errors to \arg /// the currently-attached diagnostic client when a diagnostic does not match /// what is expected (as indicated in the source file). - VerifyDiagnosticsClient(Diagnostic &Diags); + VerifyDiagnosticsClient(DiagnosticsEngine &Diags); ~VerifyDiagnosticsClient(); virtual void BeginSourceFile(const LangOptions &LangOpts, @@ -86,7 +86,7 @@ public: virtual void EndSourceFile(); - virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, + virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const DiagnosticInfo &Info); }; diff --git a/include/clang/Index/TranslationUnit.h b/include/clang/Index/TranslationUnit.h index 0099d630f1..ba5d48d373 100644 --- a/include/clang/Index/TranslationUnit.h +++ b/include/clang/Index/TranslationUnit.h @@ -16,7 +16,7 @@ namespace clang { class ASTContext; - class Diagnostic; + class DiagnosticsEngine; class Preprocessor; namespace idx { @@ -29,7 +29,7 @@ public: virtual ~TranslationUnit(); virtual ASTContext &getASTContext() = 0; virtual Preprocessor &getPreprocessor() = 0; - virtual Diagnostic &getDiagnostic() = 0; + virtual DiagnosticsEngine &getDiagnostic() = 0; virtual DeclReferenceMap &getDeclReferenceMap() = 0; virtual SelectorMap &getSelectorMap() = 0; }; diff --git a/include/clang/Lex/Lexer.h b/include/clang/Lex/Lexer.h index 65ade1f360..e67013c10e 100644 --- a/include/clang/Lex/Lexer.h +++ b/include/clang/Lex/Lexer.h @@ -21,7 +21,7 @@ #include <cassert> namespace clang { -class Diagnostic; +class DiagnosticsEngine; class SourceManager; class Preprocessor; class DiagnosticBuilder; diff --git a/include/clang/Lex/LiteralSupport.h b/include/clang/Lex/LiteralSupport.h index 5d7feb3a1a..b33092c753 100644 --- a/include/clang/Lex/LiteralSupport.h +++ b/include/clang/Lex/LiteralSupport.h @@ -24,7 +24,7 @@ namespace clang { -class Diagnostic; +class DiagnosticsEngine; class Preprocessor; class Token; class SourceLocation; @@ -149,7 +149,7 @@ class StringLiteralParser { const SourceManager &SM; const LangOptions &Features; const TargetInfo &Target; - Diagnostic *Diags; + DiagnosticsEngine *Diags; unsigned MaxTokenLength; unsigned SizeBound; @@ -162,7 +162,7 @@ public: Preprocessor &PP, bool Complain = true); StringLiteralParser(const Token *StringToks, unsigned NumStringToks, const SourceManager &sm, const LangOptions &features, - const TargetInfo &target, Diagnostic *diags = 0) + const TargetInfo &target, DiagnosticsEngine *diags = 0) : SM(sm), Features(features), Target(target), Diags(diags), MaxTokenLength(0), SizeBound(0), CharByteWidth(0), Kind(tok::unknown), ResultPtr(ResultBuf.data()), hadError(false), Pascal(false) { diff --git a/include/clang/Lex/PTHManager.h b/include/clang/Lex/PTHManager.h index c6242112d0..25a49038a8 100644 --- a/include/clang/Lex/PTHManager.h +++ b/include/clang/Lex/PTHManager.h @@ -30,7 +30,7 @@ namespace clang { class FileEntry; class PTHLexer; -class Diagnostic; +class DiagnosticsEngine; class FileSystemStatCache; class PTHManager : public IdentifierInfoLookup { @@ -119,7 +119,7 @@ public: /// Create - This method creates PTHManager objects. The 'file' argument /// is the name of the PTH file. This method returns NULL upon failure. - static PTHManager *Create(const std::string& file, Diagnostic &Diags); + static PTHManager *Create(const std::string& file, DiagnosticsEngine &Diags); void setPreprocessor(Preprocessor *pp) { PP = pp; } diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index fc0e98b8b8..8123f57726 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -57,7 +57,7 @@ class ModuleLoader; /// like the #include stack, token expansion, etc. /// class Preprocessor : public llvm::RefCountedBase<Preprocessor> { - Diagnostic *Diags; + DiagnosticsEngine *Diags; LangOptions &Features; const TargetInfo *Target; FileManager &FileMgr; @@ -322,7 +322,7 @@ private: // Cached tokens state. MacroInfo *getInfoForMacro(IdentifierInfo *II) const; public: - Preprocessor(Diagnostic &diags, LangOptions &opts, + Preprocessor(DiagnosticsEngine &diags, LangOptions &opts, const TargetInfo *target, SourceManager &SM, HeaderSearch &Headers, ModuleLoader &TheModuleLoader, @@ -338,8 +338,8 @@ public: /// \param Target Information about the target. void Initialize(const TargetInfo &Target); - Diagnostic &getDiagnostics() const { return *Diags; } - void setDiagnostics(Diagnostic &D) { Diags = &D; } + DiagnosticsEngine &getDiagnostics() const { return *Diags; } + void setDiagnostics(DiagnosticsEngine &D) { Diags = &D; } const LangOptions &getLangOptions() const { return Features; } const TargetInfo &getTargetInfo() const { return *Target; } diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index 2234920597..afcfda0425 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -99,7 +99,7 @@ class Parser : public CodeCompletionHandler { /// in the file. Sema &Actions; - Diagnostic &Diags; + DiagnosticsEngine &Diags; /// ScopeCache - Cache scopes to reduce malloc traffic. enum { ScopeCacheSize = 16 }; diff --git a/include/clang/Rewrite/ASTConsumers.h b/include/clang/Rewrite/ASTConsumers.h index da5153c61f..7a636e5369 100644 --- a/include/clang/Rewrite/ASTConsumers.h +++ b/include/clang/Rewrite/ASTConsumers.h @@ -20,7 +20,7 @@ namespace clang { class ASTConsumer; -class Diagnostic; +class DiagnosticsEngine; class LangOptions; class Preprocessor; @@ -28,7 +28,7 @@ class Preprocessor; // This is considered experimental, and only works with Apple's ObjC runtime. ASTConsumer *CreateObjCRewriter(const std::string &InFile, raw_ostream *OS, - Diagnostic &Diags, + DiagnosticsEngine &Diags, const LangOptions &LOpts, bool SilenceRewriteMacroWarning); diff --git a/include/clang/Rewrite/FixItRewriter.h b/include/clang/Rewrite/FixItRewriter.h index f96d307f72..649e7f61cc 100644 --- a/include/clang/Rewrite/FixItRewriter.h +++ b/include/clang/Rewrite/FixItRewriter.h @@ -38,7 +38,7 @@ public: class FixItRewriter : public DiagnosticClient { /// \brief The diagnostics machinery. - Diagnostic &Diags; + DiagnosticsEngine &Diags; /// \brief The rewriter used to perform the various code /// modifications. @@ -59,7 +59,7 @@ public: typedef Rewriter::buffer_iterator iterator; /// \brief Initialize a new fix-it rewriter. - FixItRewriter(Diagnostic &Diags, SourceManager &SourceMgr, + FixItRewriter(DiagnosticsEngine &Diags, SourceManager &SourceMgr, const LangOptions &LangOpts, FixItOptions *FixItOpts); /// \brief Destroy the fix-it rewriter. @@ -87,12 +87,12 @@ public: /// 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. virtual bool IncludeInDiagnosticCounts() const; /// HandleDiagnostic - Handle this diagnostic, reporting it to the user or /// capturing it to a log as needed. - virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, + virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const DiagnosticInfo &Info); /// \brief Emit a diagnostic via the adapted diagnostic client. diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h index 392284f8d5..0c357f1e66 100644 --- a/include/clang/Sema/DeclSpec.h +++ b/include/clang/Sema/DeclSpec.h @@ -34,7 +34,7 @@ namespace clang { class ASTContext; class TypeLoc; class LangOptions; - class Diagnostic; + class DiagnosticsEngine; class IdentifierInfo; class NamespaceAliasDecl; class NamespaceDecl; @@ -661,7 +661,7 @@ public: /// Finish - This does final analysis of the declspec, issuing diagnostics for /// things like "_Imaginary" (lacking an FP type). After calling this method, /// DeclSpec is guaranteed self-consistent, even if an error occurred. - void Finish(Diagnostic &D, Preprocessor &PP); + void Finish(DiagnosticsEngine &D, Preprocessor &PP); const WrittenBuiltinSpecs& getWrittenBuiltinSpecs() const { return writtenBS; diff --git a/include/clang/Sema/Scope.h b/include/clang/Sema/Scope.h index 359cc062f2..cff8b3338d 100644 --- a/include/clang/Sema/Scope.h +++ b/include/clang/Sema/Scope.h @@ -156,7 +156,7 @@ private: DiagnosticErrorTrap ErrorTrap; public: - Scope(Scope *Parent, unsigned ScopeFlags, Diagnostic &Diag) + Scope(Scope *Parent, unsigned ScopeFlags, DiagnosticsEngine &Diag) : ErrorTrap(Diag) { Init(Parent, ScopeFlags); } diff --git a/include/clang/Sema/ScopeInfo.h b/include/clang/Sema/ScopeInfo.h index 52b42a8b71..9ef6d3c4b3 100644 --- a/include/clang/Sema/ScopeInfo.h +++ b/include/clang/Sema/ScopeInfo.h @@ -95,7 +95,7 @@ public: (HasBranchProtectedScope && HasBranchIntoScope); } - FunctionScopeInfo(Diagnostic &Diag) + FunctionScopeInfo(DiagnosticsEngine &Diag) : IsBlockInfo(false), HasBranchProtectedScope(false), HasBranchIntoScope(false), @@ -137,7 +137,7 @@ public: /// CapturesCXXThis - Whether this block captures 'this'. bool CapturesCXXThis; - BlockScopeInfo(Diagnostic &Diag, Scope *BlockScope, BlockDecl *Block) + BlockScopeInfo(DiagnosticsEngine &Diag, Scope *BlockScope, BlockDecl *Block) : FunctionScopeInfo(Diag), TheDecl(Block), TheScope(BlockScope), CapturesCXXThis(false) { diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index e52d2fefbc..aefa031a72 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -187,7 +187,7 @@ public: Preprocessor &PP; ASTContext &Context; ASTConsumer &Consumer; - Diagnostic &Diags; + DiagnosticsEngine &Diags; SourceManager &SourceMgr; /// \brief Flag indicating whether or not to collect detailed statistics. @@ -694,7 +694,7 @@ public: OpenCLOptions &getOpenCLOptions() { return OpenCLFeatures; } FPOptions &getFPOptions() { return FPFeatures; } - Diagnostic &getDiagnostics() const { return Diags; } + DiagnosticsEngine &getDiagnostics() const { return Diags; } SourceManager &getSourceManager() const { return SourceMgr; } const TargetAttributesSema &getTargetAttributesSema() const; Preprocessor &getPreprocessor() const { return PP; } diff --git a/include/clang/Sema/Template.h b/include/clang/Sema/Template.h index e68daed91f..78f50fa9ff 100644 --- a/include/clang/Sema/Template.h +++ b/include/clang/Sema/Template.h @@ -374,7 +374,7 @@ namespace clang { // Base case. FIXME: Remove once we can instantiate everything. Decl *VisitDecl(Decl *D) { unsigned DiagID = SemaRef.getDiagnostics().getCustomDiagID( - Diagnostic::Error, + DiagnosticsEngine::Error, "cannot instantiate %0 yet"); SemaRef.Diag(D->getLocation(), DiagID) << D->getDeclKindName(); diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h index 1061ed05b5..996a134659 100644 --- a/include/clang/Serialization/ASTReader.h +++ b/include/clang/Serialization/ASTReader.h @@ -223,7 +223,7 @@ private: SourceManager &SourceMgr; FileManager &FileMgr; - Diagnostic &Diags; + DiagnosticsEngine &Diags; /// \brief The semantic analysis object that will be processing the /// AST files and the translation unit that uses it. @@ -412,7 +412,7 @@ private: //@} - /// \name Diagnostic-relevant special data + /// \name DiagnosticsEngine-relevant special data /// \brief Fields containing data that is used for generating diagnostics //@{ @@ -783,7 +783,7 @@ public: /// the AST file, without actually loading the AST file. static std::string getOriginalSourceFile(const std::string &ASTFileName, FileManager &FileMgr, - Diagnostic &Diags); + DiagnosticsEngine &Diags); /// \brief Returns the suggested contents of the predefines buffer, /// which contains a (typically-empty) subset of the predefines @@ -804,7 +804,7 @@ public: /// \brief Read the header file information for the given file entry. virtual HeaderFileInfo GetHeaderFileInfo(const FileEntry *FE); - void ReadPragmaDiagnosticMappings(Diagnostic &Diag); + void ReadPragmaDiagnosticMappings(DiagnosticsEngine &Diag); /// \brief Returns the number of source locations found in the chain. unsigned getTotalNumSLocs() const { diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h index b8ac8fa183..7a49e485f2 100644 --- a/include/clang/Serialization/ASTWriter.h +++ b/include/clang/Serialization/ASTWriter.h @@ -344,7 +344,7 @@ private: void WritePreprocessor(const Preprocessor &PP, bool IsModule); void WriteHeaderSearch(HeaderSearch &HS, StringRef isysroot); void WritePreprocessorDetail(PreprocessingRecord &PPRec); - void WritePragmaDiagnosticMappings(const Diagnostic &Diag); + void WritePragmaDiagnosticMappings(const DiagnosticsEngine &Diag); void WriteCXXBaseSpecifiersOffsets(); void WriteType(QualType T); uint64_t WriteDeclContextLexicalBlock(ASTContext &Context, DeclContext *DC); diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h index 66542550bc..91355fb4b4 100644 --- a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h +++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h @@ -28,7 +28,7 @@ namespace clang { class ASTContext; -class Diagnostic; +class DiagnosticsEngine; class Stmt; class ParentMap; @@ -217,7 +217,7 @@ public: class BugReporterData { public: virtual ~BugReporterData(); - virtual Diagnostic& getDiagnostic() = 0; + virtual DiagnosticsEngine& getDiagnostic() = 0; virtual PathDiagnosticClient* getPathDiagnosticClient() = 0; virtual ASTContext &getASTContext() = 0; virtual SourceManager& getSourceManager() = 0; @@ -260,7 +260,7 @@ public: Kind getKind() const { return kind; } - Diagnostic& getDiagnostic() { + DiagnosticsEngine& getDiagnostic() { return D.getDiagnostic(); } diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h index 49b7063b35..47c12cbd5d 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h @@ -34,7 +34,7 @@ class AnalysisManager : public BugReporterData { LocationContextManager LocCtxMgr; ASTContext &Ctx; - Diagnostic &Diags; + DiagnosticsEngine &Diags; const LangOptions &LangInfo; llvm::OwningPtr<PathDiagnosticClient> PD; @@ -75,7 +75,7 @@ class AnalysisManager : public BugReporterData { bool EagerlyTrimEGraph; public: - AnalysisManager(ASTContext &ctx, Diagnostic &diags, + AnalysisManager(ASTContext &ctx, DiagnosticsEngine &diags, const LangOptions &lang, PathDiagnosticClient *pd, StoreManagerCreator storemgr, ConstraintManagerCreator constraintmgr, @@ -118,7 +118,7 @@ public: return getASTContext().getSourceManager(); } - virtual Diagnostic &getDiagnostic() { + virtual DiagnosticsEngine &getDiagnostic() { return Diags; } diff --git a/include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h b/include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h index d662e2cb98..492edd4ccb 100644 --- a/include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h +++ b/include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h @@ -16,7 +16,7 @@ namespace clang { class AnalyzerOptions; class LangOptions; - class Diagnostic; + class DiagnosticsEngine; namespace ento { class CheckerManager; @@ -24,7 +24,7 @@ namespace ento { CheckerManager *createCheckerManager(const AnalyzerOptions &opts, const LangOptions &langOpts, ArrayRef<std::string> plugins, - Diagnostic &diags); + DiagnosticsEngine &diags); } // end ento namespace diff --git a/lib/ARCMigrate/ARCMT.cpp b/lib/ARCMigrate/ARCMT.cpp index 5779b4cbb9..6d44ca6d1a 100644 --- a/lib/ARCMigrate/ARCMT.cpp +++ b/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/lib/ARCMigrate/FileRemapper.cpp b/lib/ARCMigrate/FileRemapper.cpp index 604893e817..c6e6ce46d1 100644 --- a/lib/ARCMigrate/FileRemapper.cpp +++ b/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/lib/ARCMigrate/Internals.h b/lib/ARCMigrate/Internals.h index 61eeccb3a7..46f3bb626f 100644 --- a/lib/ARCMigrate/Internals.h +++ b/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/lib/ARCMigrate/PlistReporter.cpp b/lib/ARCMigrate/PlistReporter.cpp index 81b953da9f..d1bc90fdbe 100644 --- a/lib/ARCMigrate/PlistReporter.cpp +++ b/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/lib/ARCMigrate/TransformActions.cpp b/lib/ARCMigrate/TransformActions.cpp index 1321686ca6..ec676e909a 100644 --- a/lib/ARCMigrate/TransformActions.cpp +++ b/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/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 5e0143dc00..4d3d88a18d 100644 --- a/lib/AST/ASTContext.cpp +++ b/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/lib/AST/ASTDiagnostic.cpp b/lib/AST/ASTDiagnostic.cpp index f9100c0110..4c115d116b 100644 --- a/lib/AST/ASTDiagnostic.cpp +++ b/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/lib/AST/ItaniumMangle.cpp b/lib/AST/ItaniumMangle.cpp index 78f149c2df..e94cb2d54b 100644 --- a/lib/AST/ItaniumMangle.cpp +++ b/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/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp index fd99ee189b..a5bfd7d318 100644 --- a/lib/AST/MicrosoftMangle.cpp +++ b/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/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp index 0e4159db8d..87a3d1c9b5 100644 --- a/lib/Basic/Diagnostic.cpp +++ b/lib/Basic/Diagnostic.cpp @@ -20,10 +20,10 @@ using namespace clang; -static void DummyArgToStringFn(Diagnostic::ArgumentKind AK, intptr_t QT, +static void DummyArgToStringFn(DiagnosticsEngine::ArgumentKind AK, intptr_t QT, const char *Modifier, unsigned ML, const char *Argument, unsigned ArgLen, - const Diagnostic::ArgumentValue *PrevArgs, + const DiagnosticsEngine::ArgumentValue *PrevArgs, unsigned NumPrevArgs, SmallVectorImpl<char> &Output, void *Cookie, @@ -33,7 +33,8 @@ 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/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp index dab4663617..eda2f8e19f 100644 --- a/lib/Basic/DiagnosticIDs.cpp +++ b/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/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp index f15c5dc334..410d4dfbeb 100644 --- a/lib/Basic/SourceManager.cpp +++ b/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/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 8d30c2cd2c..5ee44080ac 100644 --- a/lib/Basic/Targets.cpp +++ b/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/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp index 9346cf3699..b9e3ed9edd 100644 --- a/lib/CodeGen/BackendUtil.cpp +++ b/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/lib/CodeGen/CGCXXABI.cpp b/lib/CodeGen/CGCXXABI.cpp index 8106507e0d..248448ccdc 100644 --- a/lib/CodeGen/CGCXXABI.cpp +++ b/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/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index fed79db9b0..bdb0b57d0e 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/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/lib/CodeGen/CodeGenAction.cpp b/lib/CodeGen/CodeGenAction.cpp index f266ba9d3e..68dd5c94dc 100644 --- a/lib/CodeGen/CodeGenAction.cpp +++ b/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/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index e4633f9a74..408a870a74 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/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/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index a5938d9032..c190fa3c56 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/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/lib/CodeGen/ModuleBuilder.cpp b/lib/CodeGen/ModuleBuilder.cpp index 24f75f1753..793ee9192e 100644 --- a/lib/CodeGen/ModuleBuilder.cpp +++ b/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/lib/Driver/ArgList.cpp b/lib/Driver/ArgList.cpp index 6f7cbb6062..ca9b944950 100644 --- a/lib/Driver/ArgList.cpp +++ b/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/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 5be7e630b5..121abc8b8b 100644 --- a/lib/Driver/Driver.cpp +++ b/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/lib/Frontend/ASTMerge.cpp b/lib/Frontend/ASTMerge.cpp index 74aa5a64a4..cb195d11fb 100644 --- a/lib/Frontend/ASTMerge.cpp +++ b/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/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 19b8ccb4c3..21f6afa7aa 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/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/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index 924864c8cc..ab65c3e973 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/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/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 03d06e63d3..3426e19c0c 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/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/lib/Frontend/CreateInvocationFromCommandLine.cpp b/lib/Frontend/CreateInvocationFromCommandLine.cpp index 8fdc06db72..ccfa865233 100644 --- a/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/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/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp index 1bbceddee5..ba2d63b026 100644 --- a/lib/Frontend/FrontendAction.cpp +++ b/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/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index ae3152a5b0..4c0c11e35f 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/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/lib/Frontend/LogDiagnosticPrinter.cpp b/lib/Frontend/LogDiagnosticPrinter.cpp index 52e40efb82..00cd85dca0 100644 --- a/lib/Frontend/LogDiagnosticPrinter.cpp +++ b/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/lib/Frontend/TextDiagnosticBuffer.cpp b/lib/Frontend/TextDiagnosticBuffer.cpp index f540fcab97..b615d710ad 100644 --- a/lib/Frontend/TextDiagnosticBuffer.cpp +++ b/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/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp index 34dad73e1e..53f532e24a 100644 --- a/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/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/lib/Frontend/VerifyDiagnosticsClient.cpp b/lib/Frontend/VerifyDiagnosticsClient.cpp index 69eb887843..aaac282fe6 100644 --- a/lib/Frontend/VerifyDiagnosticsClient.cpp +++ b/lib/Frontend/VerifyDiagnosticsClient.cpp @@ -20,7 +20,7 @@ #include "llvm/Support/raw_ostream.h" using namespace clang; -VerifyDiagnosticsClient::VerifyDiagnosticsClient(Diagnostic &_Diags) +VerifyDiagnosticsClient::VerifyDiagnosticsClient(DiagnosticsEngine &_Diags) : Diags(_Diags), PrimaryClient(Diags.getClient()), OwnsPrimaryClient(Diags.ownsClient()), Buffer(new TextDiagnosticBuffer()), CurrentPreprocessor(0) @@ -55,8 +55,8 @@ 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/lib/Frontend/Warnings.cpp b/lib/Frontend/Warnings.cpp index d24779e1a9..14a7f01cb1 100644 --- a/lib/Frontend/Warnings.cpp +++ b/lib/Frontend/Warnings.cpp @@ -31,12 +31,12 @@ #include <algorithm> using namespace clang; -void clang::ProcessWarningOptions(Diagnostic &Diags, +void clang::ProcessWarningOptions(DiagnosticsEngine &Diags, const DiagnosticOptions &Opts) { Diags.setSuppressSystemWarnings(true); // Default to -Wno-system-headers Diags.setIgnoreAllWarnings(Opts.IgnoreWarnings); Diags.setShowOverloads( - static_cast<Diagnostic::OverloadsShown>(Opts.ShowOverloads)); + static_cast<DiagnosticsEngine::OverloadsShown>(Opts.ShowOverloads)); // Handle -ferror-limit if (Opts.ErrorLimit) @@ -48,11 +48,11 @@ 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/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp index e780d694ed..ef385a8aed 100644 --- a/lib/Lex/LiteralSupport.cpp +++ b/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/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index 1f54ef52c3..b242c8ba7e 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/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/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index cfe9374251..5a603b6392 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/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/lib/Lex/PTHLexer.cpp b/lib/Lex/PTHLexer.cpp index 0d48ade39e..e0c4cf0c16 100644 --- a/lib/Lex/PTHLexer.cpp +++ b/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/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index 8c1004b5f5..2937b6066e 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/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/lib/Parse/RAIIObjectsForParser.h b/lib/Parse/RAIIObjectsForParser.h index 3765f92348..ef17aee3f5 100644 --- a/lib/Parse/RAIIObjectsForParser.h +++ b/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/lib/Rewrite/FixItRewriter.cpp b/lib/Rewrite/FixItRewriter.cpp index 706b6eafd3..4ef7bc3479 100644 --- a/lib/Rewrite/FixItRewriter.cpp +++ b/lib/Rewrite/FixItRewriter.cpp @@ -25,7 +25,7 @@ using namespace clang; -FixItRewriter::FixItRewriter(Diagnostic &Diags, SourceManager &SourceMgr, +FixItRewriter::FixItRewriter(DiagnosticsEngine &Diags, SourceManager &SourceMgr, const LangOptions &LangOpts, FixItOptions *FixItOpts) : Diags(Diags), @@ -78,7 +78,7 @@ 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/lib/Rewrite/HTMLRewrite.cpp b/lib/Rewrite/HTMLRewrite.cpp index 3b781580bd..fae44a3d5f 100644 --- a/lib/Rewrite/HTMLRewrite.cpp +++ b/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/lib/Rewrite/RewriteObjC.cpp b/lib/Rewrite/RewriteObjC.cpp index 4f9c1748ce..57d1210f31 100644 --- a/lib/Rewrite/RewriteObjC.cpp +++ b/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/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp index 15800b38c0..e42370d1a3 100644 --- a/lib/Sema/AnalysisBasedWarnings.cpp +++ b/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/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp index 7e2f4ad281..e4d76c8fd5 100644 --- a/lib/Sema/DeclSpec.cpp +++ b/lib/Sema/DeclSpec.cpp @@ -27,7 +27,7 @@ using namespace clang; -static DiagnosticBuilder Diag(Diagnostic &D, SourceLocation Loc, +static DiagnosticBuilder Diag(DiagnosticsEngine &D, SourceLocation Loc, unsigned DiagID) { return D.Report(Loc, DiagID); } @@ -757,7 +757,7 @@ 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/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index a169dd270e..39933fde5f 100644 --- a/lib/Sema/Sema.cpp +++ b/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/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp index bcad4995a8..583a7fa3dd 100644 --- a/lib/Sema/SemaCXXCast.cpp +++ b/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/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 5de43bb619..8339bddf87 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/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/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index bddefb6693..f6bfb3a2f2 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/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/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 72c74084b2..e8892fd323 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/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/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 5a1ce28193..57201809f0 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/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/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 209afe330d..d30620b816 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/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/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index c2bf9d3848..185e339db3 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/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/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index f390929d4b..95a04937ec 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/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/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 494f4aa354..5f005a0106 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/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/lib/Serialization/ChainedIncludesSource.cpp b/lib/Serialization/ChainedIncludesSource.cpp index 04c3f81e9b..5fcf11a36e 100644 --- a/lib/Serialization/ChainedIncludesSource.cpp +++ b/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/lib/StaticAnalyzer/Core/AnalysisManager.cpp b/lib/StaticAnalyzer/Core/AnalysisManager.cpp index 543388e4fb..8c33881458 100644 --- a/lib/StaticAnalyzer/Core/AnalysisManager.cpp +++ b/lib/StaticAnalyzer/Core/AnalysisManager.cpp @@ -14,7 +14,7 @@ using namespace clang; using namespace ento; -AnalysisManager::AnalysisManager(ASTContext &ctx, Diagnostic &diags, +AnalysisManager::AnalysisManager(ASTContext &ctx, DiagnosticsEngine &diags, const LangOptions &lang, PathDiagnosticClient *pd, StoreManagerCreator storemgr, ConstraintManagerCreator constraintmgr, diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp index 6e73b60abf..0382ff43e6 100644 --- a/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/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/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp b/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp index e91b48d9fe..f38ebcb8b0 100644 --- a/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp +++ b/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/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index c4619e369d..e269892115 100644 --- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/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/lib/StaticAnalyzer/Frontend/AnalysisConsumer.h b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.h index 0265517aff..5a16bffeac 100644 --- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.h +++ b/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/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp b/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp index 89b99f9807..a59fcad6f8 100644 --- a/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp +++ b/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; diff --git a/tools/arcmt-test/arcmt-test.cpp b/tools/arcmt-test/arcmt-test.cpp index aa229d5516..7f1e7f399e 100644 --- a/tools/arcmt-test/arcmt-test.cpp +++ b/tools/arcmt-test/arcmt-test.cpp @@ -108,7 +108,8 @@ static bool checkForMigration(StringRef resourcesPath, DiagnosticClient *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)); // Chain in -verify checker, if requested. VerifyDiagnosticsClient *verifyDiag = 0; if (VerifyDiags) { @@ -154,7 +155,8 @@ static bool performTransformations(StringRef resourcesPath, DiagnosticClient *DiagClient = new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions()); llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); - llvm::IntrusiveRefCntPtr<Diagnostic> TopDiags(new Diagnostic(DiagID, DiagClient)); + llvm::IntrusiveRefCntPtr<DiagnosticsEngine> TopDiags( + new DiagnosticsEngine(DiagID, DiagClient)); CompilerInvocation origCI; CompilerInvocation::CreateFromArgs(origCI, Args.begin(), Args.end(), diff --git a/tools/diagtool/ListWarnings.cpp b/tools/diagtool/ListWarnings.cpp index e286f8d37d..7f7db8ef10 100644 --- a/tools/diagtool/ListWarnings.cpp +++ b/tools/diagtool/ListWarnings.cpp @@ -48,7 +48,7 @@ static void printEntries(std::vector<Entry> &entries, llvm::raw_ostream &out) { int ListWarnings::run(unsigned int argc, char **argv, llvm::raw_ostream &out) { llvm::IntrusiveRefCntPtr<DiagnosticIDs> Diags(new DiagnosticIDs); - Diagnostic D(Diags); + DiagnosticsEngine D(Diags); std::vector<Entry> Flagged, Unflagged; llvm::StringMap<std::vector<unsigned> > flagHistogram; diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp index 92ae3b3a4c..27f79b7e66 100644 --- a/tools/driver/cc1_main.cpp +++ b/tools/driver/cc1_main.cpp @@ -38,7 +38,7 @@ using namespace clang; //===----------------------------------------------------------------------===// static void LLVMErrorHandler(void *UserData, const std::string &Message) { - Diagnostic &Diags = *static_cast<Diagnostic*>(UserData); + DiagnosticsEngine &Diags = *static_cast<DiagnosticsEngine*>(UserData); Diags.Report(diag::err_fe_error_backend) << Message; @@ -47,7 +47,7 @@ static void LLVMErrorHandler(void *UserData, const std::string &Message) { } // FIXME: Define the need for this testing away. -static int cc1_test(Diagnostic &Diags, +static int cc1_test(DiagnosticsEngine &Diags, const char **ArgBegin, const char **ArgEnd) { using namespace clang::driver; @@ -119,7 +119,7 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, // Run clang -cc1 test. if (ArgBegin != ArgEnd && StringRef(ArgBegin[0]) == "-cc1test") { - Diagnostic Diags(DiagID, new TextDiagnosticPrinter(llvm::errs(), + DiagnosticsEngine Diags(DiagID, new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions())); return cc1_test(Diags, ArgBegin + 1, ArgEnd); } @@ -133,7 +133,7 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, // Buffer diagnostics from argument parsing so that we can output them using a // well formed diagnostic object. TextDiagnosticBuffer *DiagsBuffer = new TextDiagnosticBuffer; - Diagnostic Diags(DiagID, DiagsBuffer); + DiagnosticsEngine Diags(DiagID, DiagsBuffer); CompilerInvocation::CreateFromArgs(Clang->getInvocation(), ArgBegin, ArgEnd, Diags); diff --git a/tools/driver/cc1as_main.cpp b/tools/driver/cc1as_main.cpp index bfc4914995..7cc42aa627 100644 --- a/tools/driver/cc1as_main.cpp +++ b/tools/driver/cc1as_main.cpp @@ -121,7 +121,7 @@ public: } static void CreateFromArgs(AssemblerInvocation &Res, const char **ArgBegin, - const char **ArgEnd, Diagnostic &Diags); + const char **ArgEnd, DiagnosticsEngine &Diags); }; } @@ -129,7 +129,7 @@ public: void AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts, const char **ArgBegin, const char **ArgEnd, - Diagnostic &Diags) { + DiagnosticsEngine &Diags) { using namespace clang::driver::cc1asoptions; // Parse the arguments. OwningPtr<OptTable> OptTbl(createCC1AsOptTable()); @@ -203,7 +203,7 @@ void AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts, } static formatted_raw_ostream *GetOutputStream(AssemblerInvocation &Opts, - Diagnostic &Diags, + DiagnosticsEngine &Diags, bool Binary) { if (Opts.OutputPath.empty()) Opts.OutputPath = "-"; @@ -226,7 +226,8 @@ static formatted_raw_ostream *GetOutputStream(AssemblerInvocation &Opts, return new formatted_raw_ostream(*Out, formatted_raw_ostream::DELETE_STREAM); } -static bool ExecuteAssembler(AssemblerInvocation &Opts, Diagnostic &Diags) { +static bool ExecuteAssembler(AssemblerInvocation &Opts, + DiagnosticsEngine &Diags) { // Get the target specific parser. std::string Error; const Target *TheTarget(TargetRegistry::lookupTarget(Opts.Triple, Error)); @@ -329,7 +330,7 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, Diagnostic &Diags) { } static void LLVMErrorHandler(void *UserData, const std::string &Message) { - Diagnostic &Diags = *static_cast<Diagnostic*>(UserData); + DiagnosticsEngine &Diags = *static_cast<DiagnosticsEngine*>(UserData); Diags.Report(diag::err_fe_error_backend) << Message; @@ -354,7 +355,7 @@ int cc1as_main(const char **ArgBegin, const char **ArgEnd, = new TextDiagnosticPrinter(errs(), DiagnosticOptions()); DiagClient->setPrefix("clang -cc1as"); llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); - Diagnostic Diags(DiagID, DiagClient); + DiagnosticsEngine Diags(DiagID, DiagClient); // Set an error handler, so that any LLVM backend diagnostics go through our // error handler. diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp index 64aa632b78..b9268dfeb4 100644 --- a/tools/driver/driver.cpp +++ b/tools/driver/driver.cpp @@ -375,7 +375,7 @@ int main(int argc_, const char **argv_) { = new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions()); DiagClient->setPrefix(llvm::sys::path::stem(Path.str())); llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); - Diagnostic Diags(DiagID, DiagClient); + DiagnosticsEngine Diags(DiagID, DiagClient); #ifdef CLANG_IS_PRODUCTION const bool IsProduction = true; diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index aa4b12b18a..d40b5b6e83 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -2356,7 +2356,7 @@ CXTranslationUnit clang_createTranslationUnit(CXIndex CIdx, FileSystemOptions FileSystemOpts; FileSystemOpts.WorkingDir = CXXIdx->getWorkingDirectory(); - llvm::IntrusiveRefCntPtr<Diagnostic> Diags; + llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags; ASTUnit *TU = ASTUnit::LoadFromASTFile(ast_filename, Diags, FileSystemOpts, CXXIdx->getOnlyLocalDecls(), 0, 0, true); @@ -2419,13 +2419,13 @@ static void clang_parseTranslationUnit_Impl(void *UserData) { // Configure the diagnostics. DiagnosticOptions DiagOpts; - llvm::IntrusiveRefCntPtr<Diagnostic> + llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(CompilerInstance::createDiagnostics(DiagOpts, num_command_line_args, command_line_args)); // Recover resources if we crash before exiting this function. - llvm::CrashRecoveryContextCleanupRegistrar<Diagnostic, - llvm::CrashRecoveryContextReleaseRefCleanup<Diagnostic> > + llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine, + llvm::CrashRecoveryContextReleaseRefCleanup<DiagnosticsEngine> > DiagCleanup(Diags.getPtr()); llvm::OwningPtr<std::vector<ASTUnit::RemappedFile> > diff --git a/tools/libclang/CIndexCodeCompletion.cpp b/tools/libclang/CIndexCodeCompletion.cpp index 2159298989..b419fd6850 100644 --- a/tools/libclang/CIndexCodeCompletion.cpp +++ b/tools/libclang/CIndexCodeCompletion.cpp @@ -213,7 +213,7 @@ struct AllocatedCXCodeCompleteResults : public CXCodeCompleteResults { SmallVector<StoredDiagnostic, 8> Diagnostics; /// \brief Diag object - llvm::IntrusiveRefCntPtr<Diagnostic> Diag; + llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diag; /// \brief Language options used to adjust source locations. LangOptions LangOpts; @@ -270,7 +270,7 @@ static llvm::sys::cas_flag CodeCompletionResultObjects; AllocatedCXCodeCompleteResults::AllocatedCXCodeCompleteResults( const FileSystemOptions& FileSystemOpts) : CXCodeCompleteResults(), - Diag(new Diagnostic( + Diag(new DiagnosticsEngine( llvm::IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs))), FileSystemOpts(FileSystemOpts), FileMgr(new FileManager(FileSystemOpts)), diff --git a/tools/libclang/CIndexDiagnostic.cpp b/tools/libclang/CIndexDiagnostic.cpp index db71a767c9..26f69b06c1 100644 --- a/tools/libclang/CIndexDiagnostic.cpp +++ b/tools/libclang/CIndexDiagnostic.cpp @@ -182,11 +182,11 @@ enum CXDiagnosticSeverity clang_getDiagnosticSeverity(CXDiagnostic Diag) { return CXDiagnostic_Ignored; switch (StoredDiag->Diag.getLevel()) { - case Diagnostic::Ignored: return CXDiagnostic_Ignored; - case Diagnostic::Note: return CXDiagnostic_Note; - case Diagnostic::Warning: return CXDiagnostic_Warning; - case Diagnostic::Error: return CXDiagnostic_Error; - case Diagnostic::Fatal: return CXDiagnostic_Fatal; + case DiagnosticsEngine::Ignored: return CXDiagnostic_Ignored; + case DiagnosticsEngine::Note: return CXDiagnostic_Note; + case DiagnosticsEngine::Warning: return CXDiagnostic_Warning; + case DiagnosticsEngine::Error: return CXDiagnostic_Error; + case DiagnosticsEngine::Fatal: return CXDiagnostic_Fatal; } llvm_unreachable("Invalid diagnostic level"); diff --git a/unittests/AST/APValueTest.cpp b/unittests/AST/APValueTest.cpp index ae054b363b..01839381dc 100644 --- a/unittests/AST/APValueTest.cpp +++ b/unittests/AST/APValueTest.cpp @@ -24,7 +24,7 @@ class DiagnosticOutputGetter { class LastDiagnosticString : public DiagnosticClient { SmallString<64> LastDiagnostic; public: - virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, + virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const DiagnosticInfo &Info) { LastDiagnostic.clear(); Info.FormatDiagnostic(LastDiagnostic); @@ -36,7 +36,7 @@ class DiagnosticOutputGetter { const IntrusiveRefCntPtr<DiagnosticIDs> DiagIDs; const unsigned diag_just_format; LastDiagnosticString LastDiagnostic; - Diagnostic Diag; + DiagnosticsEngine Diag; public: DiagnosticOutputGetter() |