diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-06-09 18:49:38 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-06-09 18:49:38 +0000 |
commit | 312a8b726e24078d3bd3b2328f9f895d1407cdb7 (patch) | |
tree | 5170f5e2111c978f108af2f284cfcceeee5a125c /lib/Driver/ArgList.cpp | |
parent | a3f28c341a1b69fc1b8deefb4f9abd64ac949ec1 (diff) |
Driver: Add an explicit offset to JoinedArg and JoinedAndSeparateArg, so that
they can be independent of the exact option that created them.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105739 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ArgList.cpp')
-rw-r--r-- | lib/Driver/ArgList.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/Driver/ArgList.cpp b/lib/Driver/ArgList.cpp index 3d07431209..ad067f108e 100644 --- a/lib/Driver/ArgList.cpp +++ b/lib/Driver/ArgList.cpp @@ -191,6 +191,17 @@ const char *ArgList::MakeArgString(const llvm::Twine &T) const { return MakeArgString(Str.str()); } +const char *ArgList::GetOrMakeJoinedArgString(unsigned Index, + llvm::StringRef LHS, + llvm::StringRef RHS) const { + llvm::StringRef Cur = getArgString(Index); + if (Cur.size() == LHS.size() + RHS.size() && + Cur.startswith(LHS) && Cur.endswith(RHS)) + return Cur.data(); + + return MakeArgString(LHS + RHS); +} + // InputArgList::InputArgList(const char **ArgBegin, const char **ArgEnd) @@ -269,7 +280,7 @@ Arg *DerivedArgList::MakeSeparateArg(const Arg *BaseArg, const Option *Opt, Arg *DerivedArgList::MakeJoinedArg(const Arg *BaseArg, const Option *Opt, llvm::StringRef Value) const { Arg *A = new JoinedArg(Opt, BaseArgs.MakeIndex(Opt->getName() + Value.str()), - BaseArg); + strlen(Opt->getName()), BaseArg); SynthesizedArgs.push_back(A); return A; } |