diff options
Diffstat (limited to 'include/clang')
48 files changed, 208 insertions, 203 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 Di |