diff options
Diffstat (limited to 'clang-tools-extra')
-rw-r--r-- | clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp | 10 | ||||
-rw-r--r-- | clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp | 15 |
2 files changed, 14 insertions, 11 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp index fc9a0ff34ae..ad2393a7f7a 100644 --- a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp @@ -417,7 +417,7 @@ void LoopConvertCheck::doConversion( // First, replace all usages of the array subscript expression with our new // variable. for (const auto &I : Usages) { - StringRef ReplaceText = I.IsArrow ? VarName + "." : VarName; + std::string ReplaceText = I.IsArrow ? VarName + "." : VarName; TUInfo->getReplacedVars().insert(std::make_pair(TheLoop, IndexVar)); Diag << FixItHint::CreateReplacement( CharSourceRange::getTokenRange(I.Range), ReplaceText); @@ -446,11 +446,9 @@ void LoopConvertCheck::doConversion( } StringRef MaybeDereference = ContainerNeedsDereference ? "*" : ""; - StringRef TypeString = AutoRefType.getAsString(); - StringRef Range = ("(" + TypeString + " " + VarName + " : " + - MaybeDereference + ContainerString + ")") - .str(); - + std::string TypeString = AutoRefType.getAsString(); + std::string Range = ("(" + TypeString + " " + VarName + " : " + + MaybeDereference + ContainerString + ")").str(); Diag << FixItHint::CreateReplacement( CharSourceRange::getTokenRange(ParenRange), Range); TUInfo->getGeneratedDecls().insert(make_pair(TheLoop, VarName)); diff --git a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp index 231533db4d6..a8e39be13de 100644 --- a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp +++ b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp @@ -347,23 +347,28 @@ static int clangTidyMain(int argc, const char **argv) { // This anchor is used to force the linker to link the LLVMModule. extern volatile int LLVMModuleAnchorSource; -static int LLVM_ATTRIBUTE_UNUSED LLVMModuleAnchorDestination = LLVMModuleAnchorSource; +static int LLVM_ATTRIBUTE_UNUSED LLVMModuleAnchorDestination = + LLVMModuleAnchorSource; // This anchor is used to force the linker to link the GoogleModule. extern volatile int GoogleModuleAnchorSource; -static int LLVM_ATTRIBUTE_UNUSED GoogleModuleAnchorDestination = GoogleModuleAnchorSource; +static int LLVM_ATTRIBUTE_UNUSED GoogleModuleAnchorDestination = + GoogleModuleAnchorSource; // This anchor is used to force the linker to link the MiscModule. extern volatile int MiscModuleAnchorSource; -static int LLVM_ATTRIBUTE_UNUSED MiscModuleAnchorDestination = MiscModuleAnchorSource; +static int LLVM_ATTRIBUTE_UNUSED MiscModuleAnchorDestination = + MiscModuleAnchorSource; // This anchor is used to force the linker to link the ModernizeModule. extern volatile int ModernizeModuleAnchorSource; -static int ModernizeModuleAnchorDestination = ModernizeModuleAnchorSource; +static int LLVM_ATTRIBUTE_UNUSED ModernizeModuleAnchorDestination = + ModernizeModuleAnchorSource; // This anchor is used to force the linker to link the ReadabilityModule. extern volatile int ReadabilityModuleAnchorSource; -static int LLVM_ATTRIBUTE_UNUSED ReadabilityModuleAnchorDestination = ReadabilityModuleAnchorSource; +static int LLVM_ATTRIBUTE_UNUSED ReadabilityModuleAnchorDestination = + ReadabilityModuleAnchorSource; } // namespace tidy } // namespace clang |