diff options
-rw-r--r-- | include/clang/Frontend/CompilerInvocation.h | 4 | ||||
-rw-r--r-- | lib/Driver/CC1Options.cpp | 17 | ||||
-rw-r--r-- | tools/driver/cc1_main.cpp | 10 |
3 files changed, 13 insertions, 18 deletions
diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h index 9d068c523c..f4f79cb695 100644 --- a/include/clang/Frontend/CompilerInvocation.h +++ b/include/clang/Frontend/CompilerInvocation.h @@ -81,8 +81,8 @@ public: /// /// \param Res [out] - The resulting invocation. /// \param Args - The input argument strings. - static void CreateFromArgs(CompilerInvocation &Res, - const llvm::SmallVectorImpl<llvm::StringRef> &Args); + static void CreateFromArgs(CompilerInvocation &Res, const char **ArgBegin, + const char **ArgEnd); /// toArgs - Convert the CompilerInvocation to a list of strings suitable for /// passing to CreateFromArgs. diff --git a/lib/Driver/CC1Options.cpp b/lib/Driver/CC1Options.cpp index 7b0d67a1d2..afa01434f3 100644 --- a/lib/Driver/CC1Options.cpp +++ b/lib/Driver/CC1Options.cpp @@ -135,20 +135,13 @@ static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args) { // void CompilerInvocation::CreateFromArgs(CompilerInvocation &Res, - const llvm::SmallVectorImpl<llvm::StringRef> &Args) { - // This is gratuitous, but until we switch the driver to using StringRef we - // need to get C strings. - llvm::SmallVector<std::string, 16> StringArgs(Args.begin(), Args.end()); - llvm::SmallVector<const char *, 16> CStringArgs; - for (unsigned i = 0, e = Args.size(); i != e; ++i) - CStringArgs.push_back(StringArgs[i].c_str()); - + const char **ArgBegin, + const char **ArgEnd) { // Parse the arguments. llvm::OwningPtr<OptTable> Opts(createCC1OptTable()); unsigned MissingArgIndex, MissingArgCount; llvm::OwningPtr<InputArgList> InputArgs( - Opts->ParseArgs(CStringArgs.begin(), CStringArgs.end(), - MissingArgIndex, MissingArgCount)); + Opts->ParseArgs(ArgBegin, ArgEnd,MissingArgIndex, MissingArgCount)); // Check for missing argument error. if (MissingArgCount) { @@ -159,6 +152,8 @@ void CompilerInvocation::CreateFromArgs(CompilerInvocation &Res, << " value )\n"; } - ParseCodeGenArgs(Res.getCodeGenOpts(), *InputArgs); + // FIXME: Disabled until the FIXMEs are resolved. + if (0) + ParseCodeGenArgs(Res.getCodeGenOpts(), *InputArgs); ParseTargetArgs(Res.getTargetOpts(), *InputArgs); } diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp index a0bd492a10..93adf579f9 100644 --- a/tools/driver/cc1_main.cpp +++ b/tools/driver/cc1_main.cpp @@ -51,18 +51,17 @@ int cc1_main(Diagnostic &Diags, const char **ArgBegin, const char **ArgEnd) { // Create a compiler invocation. llvm::errs() << "cc1 creating invocation.\n"; CompilerInvocation Invocation; - CompilerInvocation::CreateFromArgs(Invocation, - llvm::SmallVector<llvm::StringRef, 32>(ArgBegin, ArgEnd)); + CompilerInvocation::CreateFromArgs(Invocation, ArgBegin, ArgEnd); // Convert the invocation back to argument strings. std::vector<std::string> InvocationArgs; Invocation.toArgs(InvocationArgs); // Dump the converted arguments. - llvm::SmallVector<llvm::StringRef, 32> Invocation2Args; + llvm::SmallVector<const char*, 32> Invocation2Args; llvm::errs() << "invocation argv :"; for (unsigned i = 0, e = InvocationArgs.size(); i != e; ++i) { - Invocation2Args.push_back(InvocationArgs[i]); + Invocation2Args.push_back(InvocationArgs[i].c_str()); llvm::errs() << " \"" << InvocationArgs[i] << '"'; } llvm::errs() << "\n"; @@ -70,7 +69,8 @@ int cc1_main(Diagnostic &Diags, const char **ArgBegin, const char **ArgEnd) { // Convert those arguments to another invocation, and check that we got the // same thing. CompilerInvocation Invocation2; - CompilerInvocation::CreateFromArgs(Invocation2, Invocation2Args); + CompilerInvocation::CreateFromArgs(Invocation2, Invocation2Args.begin(), + Invocation2Args.end()); // FIXME: Implement CompilerInvocation comparison. if (true) { |