diff options
| author | Yaron Keren <yaron.keren@gmail.com> | 2015-07-03 09:16:20 +0000 |
|---|---|---|
| committer | Yaron Keren <yaron.keren@gmail.com> | 2015-07-03 09:16:20 +0000 |
| commit | 452670165c93595257f7e09f6e4b7769124e74d7 (patch) | |
| tree | 87c7d59007c30d8cb942bf7884e0fe6ed977f560 /clang/lib | |
| parent | 7779f75cc8203e752bd5f0bca0882605ecad9233 (diff) | |
| download | bcm5719-llvm-452670165c93595257f7e09f6e4b7769124e74d7.tar.gz bcm5719-llvm-452670165c93595257f7e09f6e4b7769124e74d7.zip | |
Replace some const std::string & with llvm::StringRef or std::string
and std::move to avoid implicit std::string construction.
Patch by Eugene Kosov.
llvm-svn: 241330
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/ASTMatchers/Dynamic/Parser.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/ASTMatchers/Dynamic/VariantValue.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/ASTMatchers/Dynamic/Parser.cpp b/clang/lib/ASTMatchers/Dynamic/Parser.cpp index 9930c530c08..96a78cd9f8f 100644 --- a/clang/lib/ASTMatchers/Dynamic/Parser.cpp +++ b/clang/lib/ASTMatchers/Dynamic/Parser.cpp @@ -216,7 +216,7 @@ private: if (Code[Length] == Marker) { Result->Kind = TokenInfo::TK_Literal; Result->Text = Code.substr(0, Length + 1); - Result->Value = Code.substr(1, Length - 1).str(); + Result->Value = Code.substr(1, Length - 1); Code = Code.drop_front(Length + 1); return; } diff --git a/clang/lib/ASTMatchers/Dynamic/VariantValue.cpp b/clang/lib/ASTMatchers/Dynamic/VariantValue.cpp index a88b7070123..9d8be470058 100644 --- a/clang/lib/ASTMatchers/Dynamic/VariantValue.cpp +++ b/clang/lib/ASTMatchers/Dynamic/VariantValue.cpp @@ -249,7 +249,7 @@ VariantValue::VariantValue(unsigned Unsigned) : Type(VT_Nothing) { setUnsigned(Unsigned); } -VariantValue::VariantValue(const std::string &String) : Type(VT_Nothing) { +VariantValue::VariantValue(StringRef String) : Type(VT_Nothing) { setString(String); } @@ -319,7 +319,7 @@ const std::string &VariantValue::getString() const { return *Value.String; } -void VariantValue::setString(const std::string &NewValue) { +void VariantValue::setString(StringRef NewValue) { reset(); Type = VT_String; Value.String = new std::string(NewValue); diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 6b0fed67618..f42198df4f8 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -405,7 +405,7 @@ void CompilerInstance::createPCHExternalASTSource( } IntrusiveRefCntPtr<ASTReader> CompilerInstance::createPCHExternalASTSource( - StringRef Path, const std::string &Sysroot, bool DisablePCHValidation, + StringRef Path, StringRef Sysroot, bool DisablePCHValidation, bool AllowPCHWithCompilerErrors, Preprocessor &PP, ASTContext &Context, const PCHContainerOperations &PCHContainerOps, void *DeserializationListener, bool OwnDeserializationListener, @@ -413,7 +413,7 @@ IntrusiveRefCntPtr<ASTReader> CompilerInstance::createPCHExternalASTSource( HeaderSearchOptions &HSOpts = PP.getHeaderSearchInfo().getHeaderSearchOpts(); IntrusiveRefCntPtr<ASTReader> Reader(new ASTReader( - PP, Context, PCHContainerOps, Sysroot.empty() ? "" : Sysroot.c_str(), + PP, Context, PCHContainerOps, Sysroot.empty() ? "" : Sysroot.data(), DisablePCHValidation, AllowPCHWithCompilerErrors, /*AllowConfigurationMismatch*/ false, HSOpts.ModulesValidateSystemHeaders, UseGlobalModuleIndex)); @@ -502,7 +502,7 @@ void CompilerInstance::createFrontendTimer() { CodeCompleteConsumer * CompilerInstance::createCodeCompletionConsumer(Preprocessor &PP, - const std::string &Filename, + StringRef Filename, unsigned Line, unsigned Column, const CodeCompleteOptions &Opts, |

