From: Jeffrey Yasskin Date: Tue, 8 Dec 2009 01:46:24 +0000 (+0000) Subject: Remove several .c_str() to be forward-compatible with StringRef. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e3fdca2ee0346a41d9cc5ee417a75e66274216f5;p=clang Remove several .c_str() to be forward-compatible with StringRef. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90822 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h index d3ab115337..8933619b2c 100644 --- a/include/clang/Driver/Driver.h +++ b/include/clang/Driver/Driver.h @@ -15,6 +15,7 @@ #include "clang/Driver/Phases.h" #include "clang/Driver/Util.h" +#include "llvm/ADT/StringRef.h" #include "llvm/ADT/Triple.h" #include "llvm/System/Path.h" // FIXME: Kill when CompilationInfo // lands. @@ -112,9 +113,9 @@ private: std::list ResultFiles; public: - Driver(const char *_Name, const char *_Dir, - const char *_DefaultHostTriple, - const char *_DefaultImageName, + Driver(llvm::StringRef _Name, llvm::StringRef _Dir, + llvm::StringRef _DefaultHostTriple, + llvm::StringRef _DefaultImageName, bool IsProduction, Diagnostic &_Diags); ~Driver(); diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 2b823e0abb..56ee63f098 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -137,8 +137,8 @@ llvm::DICompileUnit CGDebugInfo::getOrCreateCompileUnit(SourceLocation Loc) { // Create new compile unit. return Unit = DebugFactory.CreateCompileUnit(LangTag, - AbsFileName.getLast().c_str(), - AbsFileName.getDirname().c_str(), + AbsFileName.getLast(), + AbsFileName.getDirname(), Producer.c_str(), isMain, isOptimized, Flags, RuntimeVers); } diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 7f7affbdb4..dbe7bd9b68 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -41,9 +41,9 @@ using namespace clang; // Used to set values for "production" clang, for releases. // #define USE_PRODUCTION_CLANG -Driver::Driver(const char *_Name, const char *_Dir, - const char *_DefaultHostTriple, - const char *_DefaultImageName, +Driver::Driver(llvm::StringRef _Name, llvm::StringRef _Dir, + llvm::StringRef _DefaultHostTriple, + llvm::StringRef _DefaultImageName, bool IsProduction, Diagnostic &_Diags) : Opts(createDriverOptTable()), Diags(_Diags), Name(_Name), Dir(_Dir), DefaultHostTriple(_DefaultHostTriple), diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 8c2731b895..8f66d4c166 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -300,8 +300,8 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, Args.push_back("-fsyntax-only"); llvm::sys::Path Path = llvm::sys::Path::GetMainExecutable(Argv0, MainAddr); - driver::Driver TheDriver(Path.getBasename().c_str(),Path.getDirname().c_str(), - llvm::sys::getHostTriple().c_str(), + driver::Driver TheDriver(Path.getBasename(), Path.getDirname(), + llvm::sys::getHostTriple(), "a.out", false, Diags); llvm::OwningPtr C( TheDriver.BuildCompilation(Args.size(), Args.data())); diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp index 527b5f3c0c..cfdd9c342a 100644 --- a/tools/driver/driver.cpp +++ b/tools/driver/driver.cpp @@ -212,8 +212,8 @@ int main(int argc, const char **argv) { #else bool IsProduction = false; #endif - Driver TheDriver(Path.getBasename().c_str(), Path.getDirname().c_str(), - llvm::sys::getHostTriple().c_str(), + Driver TheDriver(Path.getBasename(), Path.getDirname(), + llvm::sys::getHostTriple(), "a.out", IsProduction, Diags); // Check for ".*++" or ".*++-[^-]*" to determine if we are a C++