diff options
Diffstat (limited to 'contrib/llvm-project/clang/lib/Frontend/Rewrite')
-rw-r--r-- | contrib/llvm-project/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp | 10 | ||||
-rw-r--r-- | contrib/llvm-project/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp | 46 |
2 files changed, 28 insertions, 28 deletions
diff --git a/contrib/llvm-project/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp b/contrib/llvm-project/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp index b6b37461089e..1462058003b3 100644 --- a/contrib/llvm-project/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp +++ b/contrib/llvm-project/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp @@ -75,7 +75,8 @@ private: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, - StringRef RelativePath, const Module *Imported, + StringRef RelativePath, const Module *SuggestedModule, + bool ModuleImported, SrcMgr::CharacteristicKind FileType) override; void If(SourceLocation Loc, SourceRange ConditionRange, ConditionValueKind ConditionValue) override; @@ -189,9 +190,10 @@ void InclusionRewriter::InclusionDirective( StringRef /*FileName*/, bool /*IsAngled*/, CharSourceRange /*FilenameRange*/, OptionalFileEntryRef /*File*/, StringRef /*SearchPath*/, StringRef /*RelativePath*/, - const Module *Imported, SrcMgr::CharacteristicKind FileType) { - if (Imported) { - auto P = ModuleIncludes.insert(std::make_pair(HashLoc, Imported)); + const Module *SuggestedModule, bool ModuleImported, + SrcMgr::CharacteristicKind FileType) { + if (ModuleImported) { + auto P = ModuleIncludes.insert(std::make_pair(HashLoc, SuggestedModule)); (void)P; assert(P.second && "Unexpected revisitation of the same include directive"); } else diff --git a/contrib/llvm-project/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp b/contrib/llvm-project/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp index 1f40db785981..3849e4040b53 100644 --- a/contrib/llvm-project/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp +++ b/contrib/llvm-project/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp @@ -273,10 +273,9 @@ namespace { std::string SStr; llvm::raw_string_ostream S(SStr); New->printPretty(S, nullptr, PrintingPolicy(LangOpts)); - const std::string &Str = S.str(); // If replacement succeeded or warning disabled return with no warning. - if (!Rewrite.ReplaceText(SrcRange.getBegin(), Size, Str)) { + if (!Rewrite.ReplaceText(SrcRange.getBegin(), Size, SStr)) { ReplacedNodes[Old] = New; return; } @@ -465,15 +464,15 @@ namespace { std::string SynthesizeByrefCopyDestroyHelper(VarDecl *VD, int flag); std::string SynthesizeBlockHelperFuncs(BlockExpr *CE, int i, - StringRef funcName, std::string Tag); - std::string SynthesizeBlockFunc(BlockExpr *CE, int i, - StringRef funcName, std::string Tag); - std::string SynthesizeBlockImpl(BlockExpr *CE, - std::string Tag, std::string Desc); - std::string SynthesizeBlockDescriptor(std::string DescTag, - std::string ImplTag, - int i, StringRef funcName, - unsigned hasCopy); + StringRef funcName, + const std::string &Tag); + std::string SynthesizeBlockFunc(BlockExpr *CE, int i, StringRef funcName, + const std::string &Tag); + std::string SynthesizeBlockImpl(BlockExpr *CE, const std::string &Tag, + const std::string &Desc); + std::string SynthesizeBlockDescriptor(const std::string &DescTag, + const std::string &ImplTag, int i, + StringRef funcName, unsigned hasCopy); Stmt *SynthesizeBlockCall(CallExpr *Exp, const Expr* BlockExp); void SynthesizeBlockLiterals(SourceLocation FunLocStart, StringRef FunName); @@ -592,7 +591,7 @@ namespace { } bool ImplementationIsNonLazy(const ObjCImplDecl *OD) const { - IdentifierInfo* II = &Context->Idents.get("load"); + const IdentifierInfo *II = &Context->Idents.get("load"); Selector LoadSel = Context->Selectors.getSelector(0, &II); return OD->getClassMethod(LoadSel) != nullptr; } @@ -2581,7 +2580,7 @@ Stmt *RewriteModernObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) { std::string prettyBufS; llvm::raw_string_ostream prettyBuf(prettyBufS); Exp->getString()->printPretty(prettyBuf, nullptr, PrintingPolicy(LangOpts)); - Preamble += prettyBuf.str(); + Preamble += prettyBufS; Preamble += ","; Preamble += utostr(Exp->getString()->getByteLength()) + "};\n"; @@ -4037,7 +4036,7 @@ static bool HasLocalVariableExternalStorage(ValueDecl *VD) { std::string RewriteModernObjC::SynthesizeBlockFunc(BlockExpr *CE, int i, StringRef funcName, - std::string Tag) { + const std::string &Tag) { const FunctionType *AFT = CE->getFunctionType(); QualType RT = AFT->getReturnType(); std::string StructRef = "struct " + Tag; @@ -4131,9 +4130,8 @@ std::string RewriteModernObjC::SynthesizeBlockFunc(BlockExpr *CE, int i, return S; } -std::string RewriteModernObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i, - StringRef funcName, - std::string Tag) { +std::string RewriteModernObjC::SynthesizeBlockHelperFuncs( + BlockExpr *CE, int i, StringRef funcName, const std::string &Tag) { std::string StructRef = "struct " + Tag; std::string S = "static void __"; @@ -4175,8 +4173,9 @@ std::string RewriteModernObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i, return S; } -std::string RewriteModernObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag, - std::string Desc) { +std::string RewriteModernObjC::SynthesizeBlockImpl(BlockExpr *CE, + const std::string &Tag, + const std::string &Desc) { std::string S = "\nstruct " + Tag; std::string Constructor = " " + Tag; @@ -4290,10 +4289,9 @@ std::string RewriteModernObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Ta return S; } -std::string RewriteModernObjC::SynthesizeBlockDescriptor(std::string DescTag, - std::string ImplTag, int i, - StringRef FunName, - unsigned hasCopy) { +std::string RewriteModernObjC::SynthesizeBlockDescriptor( + const std::string &DescTag, const std::string &ImplTag, int i, + StringRef FunName, unsigned hasCopy) { std::string S = "\nstatic struct " + DescTag; S += " {\n size_t reserved;\n"; @@ -4415,7 +4413,7 @@ void RewriteModernObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart, llvm::raw_string_ostream constructorExprBuf(SStr); GlobalConstructionExp->printPretty(constructorExprBuf, nullptr, PrintingPolicy(LangOpts)); - globalBuf += constructorExprBuf.str(); + globalBuf += SStr; globalBuf += ";\n"; InsertText(FunLocStart, globalBuf); GlobalConstructionExp = nullptr; |