diff options
33 files changed, 231 insertions, 213 deletions
diff --git a/include/clang/AST/Statistics.h b/include/clang/AST/Statistics.h index fc1abae302..052135b8f6 100644 --- a/include/clang/AST/Statistics.h +++ b/include/clang/AST/Statistics.h @@ -14,8 +14,6 @@ #ifndef LLVM_CLANG_AST_STATISTICS_H #define LLVM_CLANG_AST_STATISTICS_H -#define CLANG_C_ONLY 1 - #ifndef NDEBUG #include "llvm/ADT/Statistic.h" #include "llvm/Support/Casting.h" @@ -37,16 +35,7 @@ struct isa_impl<clang::Type, From> { \ } \ }; \ } -#elif defined(CLANG_C_ONLY) -#define CLANG_ISA_STATISTIC(Type,Counter) \ - namespace llvm { \ - template <typename From> \ - struct isa_impl<clang::Type, From> { \ - static inline bool doit(const From &Val) __attribute__((always_inline)) { \ - return false; \ - } \ - }; \ - } + #else #define CLANG_ISA_STATISTIC(Type,Counter) #endif diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index 643868506d..3b8c3c3026 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -95,7 +95,7 @@ namespace clang { /// should also provide full recovery from such errors, such that /// suppressing the diagnostic output can still result in successful /// compilation. -class FixItHint { +class CodeModificationHint { public: /// \brief Tokens that should be removed to correct the error. SourceRange RemoveRange; @@ -110,7 +110,7 @@ public: /// \brief Empty code modification hint, indicating that no code /// modification is known. - FixItHint() : RemoveRange(), InsertionLoc() { } + CodeModificationHint() : RemoveRange(), InsertionLoc() { } bool isNull() const { return !RemoveRange.isValid() && !InsertionLoc.isValid(); @@ -118,9 +118,9 @@ public: /// \brief Create a code modification hint that inserts the given /// code string at a specific location. - static FixItHint CreateInsertion(SourceLocation InsertionLoc, - llvm::StringRef Code) { - FixItHint Hint; + static CodeModificationHint CreateInsertion(SourceLocation InsertionLoc, + llvm::StringRef Code) { + CodeModificationHint Hint; Hint.InsertionLoc = InsertionLoc; Hint.CodeToInsert = Code; return Hint; @@ -128,17 +128,17 @@ public: /// \brief Create a code modification hint that removes the given /// source range. - static FixItHint CreateRemoval(SourceRange RemoveRange) { - FixItHint Hint; + static CodeModificationHint CreateRemoval(SourceRange RemoveRange) { + CodeModificationHint Hint; Hint.RemoveRange = RemoveRange; return Hint; } /// \brief Create a code modification hint that replaces the given /// source range with the given code string. - static FixItHint CreateReplacement(SourceRange RemoveRange, - llvm::StringRef Code) { - FixItHint Hint; + static CodeModificationHint CreateReplacement(SourceRange RemoveRange, + llvm::StringRef Code) { + CodeModificationHint Hint; Hint.RemoveRange = RemoveRange; Hint.InsertionLoc = RemoveRange.getBegin(); Hint.CodeToInsert = Code; @@ -519,8 +519,8 @@ private: /// NumRanges - This is the number of ranges in the DiagRanges array. unsigned char NumDiagRanges; /// \brief The number of code modifications hints in the - /// FixItHints array. - unsigned char NumFixItHints; + /// CodeModificationHints array. + unsigned char NumCodeModificationHints; /// DiagArgumentsKind - This is an array of ArgumentKind::ArgumentKind enum /// values, with one for each argument. This specifies whether the argument @@ -542,11 +542,11 @@ private: /// only support 10 ranges, could easily be extended if needed. SourceRange DiagRanges[10]; - enum { MaxFixItHints = 3 }; + enum { MaxCodeModificationHints = 3 }; - /// FixItHints - If valid, provides a hint with some code + /// CodeModificationHints - If valid, provides a hint with some code /// to insert, remove, or modify at a particular position. - FixItHint FixItHints[MaxFixItHints]; + CodeModificationHint CodeModificationHints[MaxCodeModificationHints]; /// ProcessDiag - This is the method used to report a diagnostic that is /// finally fully formed. @@ -573,12 +573,13 @@ private: /// for example. class DiagnosticBuilder { mutable Diagnostic *DiagObj; - mutable unsigned NumArgs, NumRanges, NumFixItHints; + mutable unsigned NumArgs, NumRanges, NumCodeModificationHints; void operator=(const DiagnosticBuilder&); // DO NOT IMPLEMENT friend class Diagnostic; explicit DiagnosticBuilder(Diagnostic *diagObj) - : DiagObj(diagObj), NumArgs(0), NumRanges(0), NumFixItHints(0) {} + : DiagObj(diagObj), NumArgs(0), NumRanges(0), + NumCodeModificationHints(0) {} public: /// Copy constructor. When copied, this "takes" the diagnostic info from the @@ -588,7 +589,7 @@ public: D.DiagObj = 0; NumArgs = D.NumArgs; NumRanges = D.NumRanges; - NumFixItHints = D.NumFixItHints; + NumCodeModificationHints = D.NumCodeModificationHints; } /// \brief Simple enumeration value used to give a name to the @@ -598,7 +599,7 @@ public: /// \brief Create an empty DiagnosticBuilder object that represents /// no actual diagnostic. explicit DiagnosticBuilder(SuppressKind) - : DiagObj(0), NumArgs(0), NumRanges(0), NumFixItHints(0) { } + : DiagObj(0), NumArgs(0), NumRanges(0), NumCodeModificationHints(0) { } /// \brief Force the diagnostic builder to emit the diagnostic now. /// @@ -647,14 +648,14 @@ public: DiagObj->DiagRanges[NumRanges++] = R; } - void AddFixItHint(const FixItHint &Hint) const { + void AddCodeModificationHint(const CodeModificationHint &Hint) const { if (Hint.isNull()) return; - assert(NumFixItHints < Diagnostic::MaxFixItHints && - "Too many fix-it hints!"); + assert(NumCodeModificationHints < Diagnostic::MaxCodeModificationHints && + "Too many code modification hints!"); if (DiagObj) - DiagObj->FixItHints[NumFixItHints++] = Hint; + DiagObj->CodeModificationHints[NumCodeModificationHints++] = Hint; } }; @@ -715,8 +716,8 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, } inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, - const FixItHint &Hint) { - DB.AddFixItHint(Hint); + const CodeModificationHint &Hint) { + DB.AddCodeModificationHint(Hint); return DB; } @@ -812,17 +813,17 @@ public: return DiagObj->DiagRanges[Idx]; } - unsigned getNumFixItHints() const { - return DiagObj->NumFixItHints; + unsigned getNumCodeModificationHints() const { + return DiagObj->NumCodeModificationHints; } - const FixItHint &getFixItHint(unsigned Idx) const { - return DiagObj->FixItHints[Idx]; + const CodeModificationHint &getCodeModificationHint(unsigned Idx) const { + return DiagObj->CodeModificationHints[Idx]; } - const FixItHint *getFixItHints() const { - return DiagObj->NumFixItHints? - &DiagObj->FixItHints[0] : 0; + const CodeModificationHint *getCodeModificationHints() const { + return DiagObj->NumCodeModificationHints? + &DiagObj->CodeModificationHints[0] : 0; } /// FormatDiagnostic - Format this diagnostic into a string, substituting the @@ -845,7 +846,7 @@ class StoredDiagnostic { FullSourceLoc Loc; std::string Message; std::vector<SourceRange> Ranges; - std::vector<FixItHint> FixIts; + std::vector<CodeModificationHint> FixIts; public: StoredDiagnostic(); @@ -865,7 +866,7 @@ public: range_iterator range_end() const { return Ranges.end(); } unsigned range_size() const { return Ranges.size(); } - typedef std::vector<FixItHint>::const_iterator fixit_iterator; + typedef std::vector<CodeModificationHint>::const_iterator fixit_iterator; fixit_iterator fixit_begin() const { return FixIts.begin(); } fixit_iterator fixit_end() const { return FixIts.end(); } unsigned fixit_size() const { return FixIts.size(); } diff --git a/include/clang/Basic/PartialDiagnostic.h b/include/clang/Basic/PartialDiagnostic.h index de858eadb6..d49e621d2f 100644 --- a/include/clang/Basic/PartialDiagnostic.h +++ b/include/clang/Basic/PartialDiagnostic.h @@ -29,7 +29,8 @@ class DeclarationName; class PartialDiagnostic { public: struct Storage { - Storage() : NumDiagArgs(0), NumDiagRanges(0), NumFixItHints(0) { } + Storage() : NumDiagArgs(0), NumDiagRanges(0), NumCodeModificationHints(0) { + } enum { /// MaxArguments - The maximum number of arguments we can hold. We @@ -46,8 +47,8 @@ public: unsigned char NumDiagRanges; /// \brief The number of code modifications hints in the - /// FixItHints array. - unsigned char NumFixItHints; + /// CodeModificationHints array. + unsigned char NumCodeModificationHints; /// DiagArgumentsKind - This is an array of ArgumentKind::ArgumentKind enum /// values, with one for each argument. This specifies whether the argument @@ -64,11 +65,11 @@ public: /// only support 10 ranges, could easily be extended if needed. SourceRange DiagRanges[10]; - enum { MaxFixItHints = 3 }; + enum { MaxCodeModificationHints = 3 }; - /// FixItHints - If valid, provides a hint with some code + /// CodeModificationHints - If valid, provides a hint with some code /// to insert, remove, or modify at a particular position. - FixItHint FixItHints[MaxFixItHints]; + CodeModificationHint CodeModificationHints[MaxCodeModificationHints]; }; /// \brief An allocator for Storage objects, which uses a small cache to @@ -91,7 +92,7 @@ public: Storage *Result = FreeList[--NumFreeListEntries]; Result->NumDiagArgs = 0; Result->NumDiagRanges = 0; - Result->NumFixItHints = 0; + Result->NumCodeModificationHints = 0; return Result; } @@ -165,16 +166,17 @@ private: DiagStorage->DiagRanges[DiagStorage->NumDiagRanges++] = R; } - void AddFixItHint(const FixItHint &Hint) const { + void AddCodeModificationHint(const CodeModificationHint &Hint) const { if (Hint.isNull()) return; if (!DiagStorage) DiagStorage = getStorage(); - assert(DiagStorage->NumFixItHints < Storage::MaxFixItHints && + assert(DiagStorage->NumCodeModificationHints < + Storage::MaxCodeModificationHints && "Too many code modification hints!"); - DiagStorage->FixItHints[DiagStorage->NumFixItHints++] + DiagStorage->CodeModificationHints[DiagStorage->NumCodeModificationHints++] = Hint; } @@ -234,8 +236,8 @@ public: DB.AddSourceRange(DiagStorage->DiagRanges[i]); // Add all code modification hints - for (unsigned i = 0, e = DiagStorage->NumFixItHints; i != e; ++i) - DB.AddFixItHint(DiagStorage->FixItHints[i]); + for (unsigned i = 0, e = DiagStorage->NumCodeModificationHints; i != e; ++i) + DB.AddCodeModificationHint(DiagStorage->CodeModificationHints[i]); } /// \brief Clear out this partial diagnostic, giving it a new diagnostic ID @@ -282,8 +284,8 @@ public: DeclarationName N); friend const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, - const FixItHint &Hint) { - PD.AddFixItHint(Hint); + const CodeModificationHint &Hint) { + PD.AddCodeModificationHint(Hint); return PD; } diff --git a/include/clang/Checker/BugReporter/PathDiagnostic.h b/include/clang/Checker/BugReporter/PathDiagnostic.h index 24c75ce7b2..d380c45480 100644 --- a/include/clang/Checker/BugReporter/PathDiagnostic.h +++ b/include/clang/Checker/BugReporter/PathDiagnostic.h @@ -168,7 +168,7 @@ public: private: const std::string str; - std::vector<FixItHint> FixItHints; + std::vector<CodeModificationHint> CodeModificationHints; const Kind kind; const DisplayHint Hint; std::vector<SourceRange> ranges; @@ -203,8 +203,8 @@ public: ranges.push_back(SourceRange(B,E)); } - void addFixItHint(const FixItHint& Hint) { - FixItHints.push_back(Hint); + void addCodeModificationHint(const CodeModificationHint& Hint) { + CodeModificationHints.push_back(Hint); } typedef const SourceRange* range_iterator; @@ -217,15 +217,15 @@ public: return ranges_begin() + ranges.size(); } - typedef const FixItHint *fixit_iterator; + typedef const CodeModificationHint *code_modifications_iterator; - fixit_iterator fixit_begin() const { - return FixItHints.empty()? 0 : &FixItHints[0]; + code_modifications_iterator code_modifications_begin() const { + return CodeModificationHints.empty()? 0 : &CodeModificationHints[0]; } - fixit_iterator fixit_end() const { - return FixItHints.empty()? 0 - : &FixItHints[0] + FixItHints.size(); + code_modifications_iterator code_modifications_end() const { + return CodeModificationHints.empty()? 0 + : &CodeModificationHints[0] + CodeModificationHints.size(); } static inline bool classof(const PathDiagnosticPiece* P) { diff --git a/include/clang/Frontend/TextDiagnosticPrinter.h b/include/clang/Frontend/TextDiagnosticPrinter.h index 157876b59d..d09e51fd01 100644 --- a/include/clang/Frontend/TextDiagnosticPrinter.h +++ b/include/clang/Frontend/TextDiagnosticPrinter.h @@ -69,7 +69,7 @@ public: void EmitCaretDiagnostic(SourceLocation Loc, SourceRange *Ranges, unsigned NumRanges, SourceManager &SM, - const FixItHint *Hints, + const CodeModificationHint *Hints, unsigned NumHints, unsigned Columns); diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp index 2b7fcd07f9..9b8bae3142 100644 --- a/lib/Basic/Diagnostic.cpp +++ b/lib/Basic/Diagnostic.cpp @@ -571,7 +571,7 @@ bool DiagnosticBuilder::Emit() { // the Diagnostic object. DiagObj->NumDiagArgs = NumArgs; DiagObj->NumDiagRanges = NumRanges; - DiagObj->NumFixItHints = NumFixItHints; + DiagObj->NumCodeModificationHints = NumCodeModificationHints; // Process the diagnostic, sending the accumulated information to the // DiagnosticClient. @@ -996,9 +996,9 @@ StoredDiagnostic::StoredDiagnostic(Diagnostic::Level Level, for (unsigned I = 0, N = Info.getNumRanges(); I != N; ++I) Ranges.push_back(Info.getRange(I)); - FixIts.reserve(Info.getNumFixItHints()); - for (unsigned I = 0, N = Info.getNumFixItHints(); I != N; ++I) - FixIts.push_back(Info.getFixItHint(I)); + FixIts.reserve(Info.getNumCodeModificationHints()); + for (unsigned I = 0, N = Info.getNumCodeModificationHints(); I != N; ++I) + FixIts.push_back(Info.getCodeModificationHint(I)); } StoredDiagnostic::~StoredDiagnostic() { } @@ -1231,7 +1231,7 @@ StoredDiagnostic::Deserialize(FileManager &FM, SourceManager &SM, return Diag; } - FixItHint Hint; + CodeModificationHint Hint; Hint.RemoveRange = SourceRange(RemoveBegin, RemoveEnd); Hint.InsertionLoc = InsertionLoc; Hint.CodeToInsert.assign(Memory, Memory + InsertLen); diff --git a/lib/Checker/PathDiagnostic.cpp b/lib/Checker/PathDiagnostic.cpp index 963923c9ad..97500d9578 100644 --- a/lib/Checker/PathDiagnostic.cpp +++ b/lib/Checker/PathDiagnostic.cpp @@ -108,8 +108,8 @@ void PathDiagnosticClient::HandleDiagnostic(Diagnostic::Level DiagLevel, for (unsigned i = 0, e = Info.getNumRanges(); i != e; ++i) P->addRange(Info.getRange(i)); - for (unsigned i = 0, e = Info.getNumFixItHints(); i != e; ++i) - P->addFixItHint(Info.getFixItHint(i)); + for (unsigned i = 0, e = Info.getNumCodeModificationHints(); i != e; ++i) + P->addCodeModificationHint(Info.getCodeModificationHint(i)); D->push_front(P); HandlePathDiagnostic(D); diff --git a/lib/Frontend/FixItRewriter.cpp b/lib/Frontend/FixItRewriter.cpp index 20d452e76a..0b04cf2b44 100644 --- a/lib/Frontend/FixItRewriter.cpp +++ b/lib/Frontend/FixItRewriter.cpp @@ -93,7 +93,7 @@ void FixItRewriter::HandleDiagnostic(Diagnostic::Level DiagLevel, // completely ignore it, even if it's an error: fix-it locations // are meant to perform specific fix-ups even in the presence of // other errors. - if (Info.getNumFixItHints() == 0) + if (Info.getNumCodeModificationHints() == 0) return; // See if the location of the error is one that matches what the @@ -122,10 +122,10 @@ void FixItRewriter::HandleDiagnostic(Diagnostic::Level DiagLevel, // Make sure that we can perform all of the modifications we // in this diagnostic. - bool CanRewrite = Info.getNumFixItHints() > 0; - for (unsigned Idx = 0, Last = Info.getNumFixItHints(); + bool CanRewrite = Info.getNumCodeModificationHints() > 0; + for (unsigned Idx = 0, Last = Info.getNumCodeModificationHints(); Idx < Last; ++Idx) { - const FixItHint &Hint = Info.getFixItHint(Idx); + const CodeModificationHint &Hint = Info.getCodeModificationHint(Idx); if (Hint.RemoveRange.isValid() && Rewrite.getRangeSize(Hint.RemoveRange) == -1) { CanRewrite = false; @@ -140,7 +140,7 @@ void FixItRewriter::HandleDiagnostic(Diagnostic::Level DiagLevel, } if (!CanRewrite) { - if (Info.getNumFixItHints() > 0) + if (Info.getNumCodeModificationHints() > 0) Diag(Info.getLocation(), diag::note_fixit_in_macro); // If this was an error, refuse to perform any rewriting. @@ -152,9 +152,9 @@ void FixItRewriter::HandleDiagnostic(Diagnostic::Level DiagLevel, } bool Failed = false; - for (unsigned Idx = 0, Last = Info.getNumFixItHints(); + for (unsigned Idx = 0, Last = Info.getNumCodeModificationHints(); Idx < Last; ++Idx) { - const FixItHint &Hint = Info.getFixItHint(Idx); + const CodeModificationHint &Hint = Info.getCodeModificationHint(Idx); if (!Hint.RemoveRange.isValid()) { // We're adding code. if (Rewrite.InsertTextBefore(Hint.InsertionLoc, Hint.CodeToInsert)) diff --git a/lib/Frontend/HTMLDiagnostics.cpp b/lib/Frontend/HTMLDiagnostics.cpp index 022a34d0bd..da99cb8b7b 100644 --- a/lib/Frontend/HTMLDiagnostics.cpp +++ b/lib/Frontend/HTMLDiagnostics.cpp @@ -484,7 +484,8 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID, // FIXME: This code is disabled because it seems to mangle the HTML // output. I'm leaving it here because it's generally the right idea, // but needs some help from someone more familiar with the rewriter. - for (const FixItHint *Hint = P.fixit_begin(), *HintEnd = P.fixit_end(); + for (const CodeModificationHint *Hint = P.code_modifications_begin(), + *HintEnd = P.code_modifications_end(); Hint != HintEnd; ++Hint) { if (Hint->RemoveRange.isValid()) { HighlightRange(R, LPosInfo.first, Hint->RemoveRange, diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp index 4e91f8d4c2..24d51e2c78 100644 --- a/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/lib/Frontend/TextDiagnosticPrinter.cpp @@ -276,7 +276,7 @@ void TextDiagnosticPrinter::EmitCaretDiagnostic(SourceLocation Loc, SourceRange *Ranges, unsigned NumRanges, SourceManager &SM, - const FixItHint *Hints, + const CodeModificationHint *Hints, unsigned NumHints, unsigned Columns) { assert(LangOpts && "Unexpected diagnostic outside source file processing"); @@ -409,7 +409,7 @@ void TextDiagnosticPrinter::EmitCaretDiagnostic(SourceLocation Loc, std::string FixItInsertionLine; if (NumHints && DiagOpts->ShowFixits) { - for (const FixItHint *Hint = Hints, *LastHint = Hints + NumHints; + for (const CodeModificationHint *Hint = Hints, *LastHint = Hints + NumHints; Hint != LastHint; ++Hint) { if (Hint->InsertionLoc.isValid()) { // We have an insertion hint. Determine whether the inserted @@ -833,7 +833,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, if (DiagOpts->ShowCarets && Info.getLocation().isValid() && ((LastLoc != Info.getLocation()) || Info.getNumRanges() || (LastCaretDiagnosticWasNote && Level != Diagnostic::Note) || - Info.getNumFixItHints())) { + Info.getNumCodeModificationHints())) { // Cache the LastLoc, it allows us to omit duplicate source/caret spewage. LastLoc = Info.getLocation(); LastCaretDiagnosticWasNote = (Level == Diagnostic::Note); @@ -845,9 +845,9 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, for (unsigned i = 0; i != NumRanges; ++i) Ranges[i] = Info.getRange(i); - unsigned NumHints = Info.getNumFixItHints(); + unsigned NumHints = Info.getNumCodeModificationHints(); for (unsigned idx = 0; idx < NumHints; ++idx) { - const FixItHint &Hint = Info.getFixItHint(idx); + const CodeModificationHint &Hint = Info.getCodeModificationHint(idx); if (Hint.RemoveRange.isValid()) { assert(NumRanges < 20 && "Out of space"); Ranges[NumRanges++] = Hint.RemoveRange; @@ -855,8 +855,8 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, } EmitCaretDiagnostic(LastLoc, Ranges, NumRanges, LastLoc.getManager(), - Info.getFixItHints(), - Info.getNumFixItHints(), + Info.getCodeModificationHints(), + Info.getNumCodeModificationHints(), DiagOpts->MessageLength); } diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 19f25ea4a8..2f89142409 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -1372,7 +1372,8 @@ bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) { // a pedwarn. if (CurPtr != BufferStart && (CurPtr[-1] != '\n' && CurPtr[-1] != '\r')) Diag(BufferEnd, diag::ext_no_newline_eof) - << FixItHint::CreateInsertion(getSourceLocation(BufferEnd), "\n"); + << CodeModificationHint::CreateInsertion(getSourceLocation(BufferEnd), + "\n"); BufferPtr = CurPtr; diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index 757ba9014d..7b601010b2 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -127,10 +127,10 @@ void Preprocessor::CheckEndOfDirective(const char *DirType, bool EnableMacros) { // Add a fixit in GNU/C99/C++ mode. Don't offer a fixit for strict-C89, // because it is more trouble than it is worth to insert /**/ and check that // there is no /**/ in the range also. - FixItHint Hint; + CodeModificationHint FixItHint; if (Features.GNUMode || Features.C99 || Features.CPlusPlus) - Hint = FixItHint::CreateInsertion(Tmp.getLocation(),"//"); - Diag(Tmp, diag::ext_pp_extra_tokens_at_eol) << DirType << Hint; + FixItHint = CodeModificationHint::CreateInsertion(Tmp.getLocation(),"//"); + Diag(Tmp, diag::ext_pp_extra_tokens_at_eol) << DirType << FixItHint; DiscardUntilEndOfDirective(); } } diff --git a/lib/Parse/DeclSpec.cpp b/lib/Parse/DeclSpec.cpp index 11865ab97b..4a699e7ad5 100644 --- a/lib/Parse/DeclSpec.cpp +++ b/lib/Parse/DeclSpec.cpp @@ -481,7 +481,7 @@ void DeclSpec::Finish(Diagnostic &D, Preprocessor &PP) { if (TypeSpecComplex != TSC_unspecified) { if (TypeSpecType == TST_unspecified) { Diag(D, TSCLoc, SrcMgr, diag::ext_plain_complex) - << FixItHint::CreateInsertion( + << CodeModificationHint::CreateInsertion( PP.getLocForEndOfToken(getTypeSpecComplexLoc()), " double"); TypeSpecType = TST_double; // _Complex -> _Complex double. @@ -507,7 +507,7 @@ void DeclSpec::Finish(Diagnostic &D, Preprocessor &PP) { Diag(D, SCLoc, SrcMgr, diag::err_friend_storage_spec) << SpecName - << FixItHint::CreateRemoval(SourceRange(SCLoc, SCEndLoc)); + << CodeModificationHint::CreateRemoval(SourceRange(SCLoc, SCEndLoc)); ClearStorageClassSpecs(); } diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index e87d052141..cff35b72c4 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -734,7 +734,7 @@ bool Parser::ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS, if (TagName) { Diag(Loc, diag::err_use_of_tag_name_without_tag) << Tok.getIdentifierInfo() << TagName << getLang().CPlusPlus - << FixItHint::CreateInsertion(Tok.getLocation(),TagName); + << CodeModificationHint::CreateInsertion(Tok.getLocation(),TagName); // Parse this as a tag as if the missing tag were present. if (TagKind == tok::kw_enum) @@ -1360,7 +1360,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, DS.SetRangeEnd(EndProtoLoc); Diag(Loc, diag::warn_objc_protocol_qualifier_missing_id) - << FixItHint::CreateInsertion(Loc, "id") + << CodeModificationHint::CreateInsertion(Loc, "id") << SourceRange(Loc, EndProtoLoc); // Need to support trailing type qualifiers (e.g. "id<p> const"). // If a type specifier follows, it will be diagnosed elsewhere. @@ -1756,7 +1756,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, // Check for extraneous top-level semicolon. if (Tok.is(tok::semi)) { Diag(Tok, diag::ext_extra_struct_semi) - << FixItHint::CreateRemoval(Tok.getLocation()); + << CodeModificationHint::CreateRemoval(Tok.getLocation()); ConsumeToken(); continue; } @@ -1999,7 +1999,7 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, DeclPtrTy EnumDecl) { !(getLang().C99 || getLang().CPlusPlus0x)) Diag(CommaLoc, diag::ext_enumerator_list_comma) << getLang().CPlusPlus - << FixItHint::CreateRemoval(CommaLoc); + << CodeModificationHint::CreateRemoval(CommaLoc); } // Eat the }. @@ -3009,7 +3009,7 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, // We have ellipsis without a preceding ',', which is ill-formed // in C. Complain and provide the fix. Diag(EllipsisLoc, diag::err_missing_comma_before_ellipsis) - << FixItHint::CreateInsertion(EllipsisLoc, ", "); + << CodeModificationHint::CreateInsertion(EllipsisLoc, ", "); } } diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 813c24ce3d..3dc6ad9b34 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -837,7 +837,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, Diag(TemplateId->TemplateNameLoc, diag::err_explicit_instantiation_with_definition) << SourceRange(TemplateInfo.TemplateLoc) - << FixItHint::CreateInsertion(LAngleLoc, "<>"); + << CodeModificationHint::CreateInsertion(LAngleLoc, "<>"); // Create a fake template parameter list that contains only // "template<>", so that we treat this construct as a class @@ -1079,7 +1079,7 @@ Parser::BaseResult Parser::ParseBaseSpecifier(DeclPtrTy |