diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-07-05 16:56:25 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-07-05 16:56:25 +0000 |
commit | bcf6a8025aa50f3f28cfbd0470cf3e8f5cffbab2 (patch) | |
tree | 96b4c5523b5aee0ca2cf01939e68e0cbdb811704 /lib | |
parent | 3fd1ba0fa133d1c6e641770d0bc56606587d3eef (diff) |
StringRef'ize clang::drive::Option::getName(), from Zach Wheeler!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134418 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Driver/Arg.cpp | 2 | ||||
-rw-r--r-- | lib/Driver/ArgList.cpp | 4 | ||||
-rw-r--r-- | lib/Driver/Option.cpp | 16 |
3 files changed, 11 insertions, 11 deletions
diff --git a/lib/Driver/Arg.cpp b/lib/Driver/Arg.cpp index f1177cf97e..39b7e55564 100644 --- a/lib/Driver/Arg.cpp +++ b/lib/Driver/Arg.cpp @@ -113,7 +113,7 @@ void Arg::render(const ArgList &Args, ArgStringList &Output) const { break; case Option::RenderSeparateStyle: - Output.push_back(getOption().getName()); + Output.push_back(getOption().getName().data()); for (unsigned i = 0, e = getNumValues(); i != e; ++i) Output.push_back(getValue(Args, i)); break; diff --git a/lib/Driver/ArgList.cpp b/lib/Driver/ArgList.cpp index 596e2a7529..b8af9cc47e 100644 --- a/lib/Driver/ArgList.cpp +++ b/lib/Driver/ArgList.cpp @@ -287,9 +287,9 @@ Arg *DerivedArgList::MakeSeparateArg(const Arg *BaseArg, const Option *Opt, Arg *DerivedArgList::MakeJoinedArg(const Arg *BaseArg, const Option *Opt, llvm::StringRef Value) const { - unsigned Index = BaseArgs.MakeIndex(Opt->getName() + Value.str()); + unsigned Index = BaseArgs.MakeIndex(Opt->getName().str() + Value.str()); Arg *A = new Arg(Opt, Index, - BaseArgs.getArgString(Index) + strlen(Opt->getName()), + BaseArgs.getArgString(Index) + Opt->getName().size(), BaseArg); SynthesizedArgs.push_back(A); return A; diff --git a/lib/Driver/Option.cpp b/lib/Driver/Option.cpp index a992cef3d2..90d21a3d0b 100644 --- a/lib/Driver/Option.cpp +++ b/lib/Driver/Option.cpp @@ -144,7 +144,7 @@ FlagOption::FlagOption(OptSpecifier ID, const char *Name, Arg *FlagOption::accept(const ArgList &Args, unsigned &Index) const { // Matches iff this is an exact match. // FIXME: Avoid strlen. - if (strlen(getName()) != strlen(Args.getArgString(Index))) + if (getName().size() != strlen(Args.getArgString(Index))) return 0; return new Arg(getUnaliasedOption(), Index++); @@ -157,7 +157,7 @@ JoinedOption::JoinedOption(OptSpecifier ID, const char *Name, Arg *JoinedOption::accept(const ArgList &Args, unsigned &Index) const { // Always matches. - const char *Value = Args.getArgString(Index) + strlen(getName()); + const char *Value = Args.getArgString(Index) + getName().size(); return new Arg(getUnaliasedOption(), Index++, Value); } @@ -170,7 +170,7 @@ CommaJoinedOption::CommaJoinedOption(OptSpecifier ID, const char *Name, Arg *CommaJoinedOption::accept(const ArgList &Args, unsigned &Index) const { // Always matches. - const char *Str = Args.getArgString(Index) + strlen(getName()); + const char *Str = Args.getArgString(Index) + getName().size(); Arg *A = new Arg(getUnaliasedOption(), Index++); // Parse out the comma separated values. @@ -205,7 +205,7 @@ SeparateOption::SeparateOption(OptSpecifier ID, const char *Name, Arg *SeparateOption::accept(const ArgList &Args, unsigned &Index) const { // Matches iff this is an exact match. // FIXME: Avoid strlen. - if (strlen(getName()) != strlen(Args.getArgString(Index))) + if (getName().size() != strlen(Args.getArgString(Index))) return 0; Index += 2; @@ -225,7 +225,7 @@ MultiArgOption::MultiArgOption(OptSpecifier ID, const char *Name, Arg *MultiArgOption::accept(const ArgList &Args, unsigned &Index) const { // Matches iff this is an exact match. // FIXME: Avoid strlen. - if (strlen(getName()) != strlen(Args.getArgString(Index))) + if (getName().size() != strlen(Args.getArgString(Index))) return 0; Index += 1 + NumArgs; @@ -250,8 +250,8 @@ Arg *JoinedOrSeparateOption::accept(const ArgList &Args, unsigned &Index) const { // If this is not an exact match, it is a joined arg. // FIXME: Avoid strlen. - if (strlen(getName()) != strlen(Args.getArgString(Index))) { - const char *Value = Args.getArgString(Index) + strlen(getName()); + if (getName().size() != strlen(Args.getArgString(Index))) { + const char *Value = Args.getArgString(Index) + getName().size(); return new Arg(this, Index++, Value); } @@ -279,6 +279,6 @@ Arg *JoinedAndSeparateOption::accept(const ArgList &Args, return 0; return new Arg(getUnaliasedOption(), Index - 2, - Args.getArgString(Index-2)+strlen(getName()), + Args.getArgString(Index-2)+getName().size(), Args.getArgString(Index-1)); } |