Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(439)

Issue 161053: [PATCH] Remove several .c_str() to be forward-compatible with StringRef (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years ago by Jeffrey Yasskin
Modified:
15 years ago
Reviewers:
CC:
cfe-commits_cs.uiuc.edu
Base URL:
https://llvm.org/svn/llvm-project/cfe/trunk/
Visibility:
Public.

Description

I have a change to make several Path methods return StringRef instead of string. This patch fixes the resulting breakage, but still compiles without the Path change.

Patch Set 1 #

Patch Set 2 : Sync to head #

Unified diffs Side-by-side diffs Delta from patch set Stats (+13 lines, -12 lines) Patch
M include/clang/Driver/Driver.h View 1 2 chunks +4 lines, -3 lines 0 comments Download
M lib/CodeGen/CGDebugInfo.cpp View 1 1 chunk +2 lines, -2 lines 0 comments Download
M lib/Driver/Driver.cpp View 1 1 chunk +3 lines, -3 lines 0 comments Download
M lib/Frontend/ASTUnit.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M tools/driver/driver.cpp View 1 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 2
Jeffrey Yasskin
This patch is fairly trivial, but it changes the Driver interface, so I figured I'd ...
15 years ago (2009-12-07 22:42:49 UTC) #1
daniel_zuster.org
15 years ago (2009-12-08 00:50:46 UTC) #2
LGTM.

 - Daniel

On Mon, Dec 7, 2009 at 2:42 PM,  <jyasskin@gmail.com> wrote:
> Reviewers: ,
>
> Message:
> This patch is fairly trivial, but it changes the Driver interface, so I
> figured I'd run it by the list before committing.
>
> Description:
> I have a change to make several Path methods return StringRef instead of
> string. This patch fixes the resulting breakage, but still compiles
> without the Path change.
>
> Please review this at http://codereview.appspot.com/161053
>
> Affected files:
>   M     include/clang/Driver/Driver.h
>   M     lib/CodeGen/CGDebugInfo.cpp
>   M     lib/Driver/Driver.cpp
>   M     lib/Frontend/ASTUnit.cpp
>   M     tools/driver/driver.cpp
>
>
> Index: include/clang/Driver/Driver.h
> ===================================================================
> --- include/clang/Driver/Driver.h       (revision 90805)
> +++ include/clang/Driver/Driver.h       (working copy)
> @@ -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 @@
>    std::list<std::string> 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();
>
> Index: tools/driver/driver.cpp
> ===================================================================
> --- tools/driver/driver.cpp     (revision 90805)
> +++ tools/driver/driver.cpp     (working copy)
> @@ -212,8 +212,8 @@
>  #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++
> Index: lib/Frontend/ASTUnit.cpp
> ===================================================================
> --- lib/Frontend/ASTUnit.cpp    (revision 90805)
> +++ lib/Frontend/ASTUnit.cpp    (working copy)
> @@ -300,8 +300,8 @@
>    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<driver::Compilation> C(
>      TheDriver.BuildCompilation(Args.size(), Args.data()));
> Index: lib/CodeGen/CGDebugInfo.cpp
> ===================================================================
> --- lib/CodeGen/CGDebugInfo.cpp (revision 90805)
> +++ lib/CodeGen/CGDebugInfo.cpp (working copy)
> @@ -137,8 +137,8 @@
>
>    // 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);
>  }
> Index: lib/Driver/Driver.cpp
> ===================================================================
> --- lib/Driver/Driver.cpp       (revision 90805)
> +++ lib/Driver/Driver.cpp       (working copy)
> @@ -41,9 +41,9 @@
>  // 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),
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b