r215759 - [cleanup] Factor out handling CC1 tools. NFC.
David Blaikie
dblaikie at gmail.com
Fri Aug 15 13:08:03 PDT 2014
On Fri, Aug 15, 2014 at 12:23 PM, Sean Silva <chisophugis at gmail.com> wrote:
> Author: silvas
> Date: Fri Aug 15 14:23:47 2014
> New Revision: 215759
>
> URL: http://llvm.org/viewvc/llvm-project?rev=215759&view=rev
> Log:
> [cleanup] Factor out handling CC1 tools. NFC.
>
> Modified:
> cfe/trunk/tools/driver/driver.cpp
>
> Modified: cfe/trunk/tools/driver/driver.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=215759&r1=215758&r2=215759&view=diff
> ==============================================================================
> --- cfe/trunk/tools/driver/driver.cpp (original)
> +++ cfe/trunk/tools/driver/driver.cpp Fri Aug 15 14:23:47 2014
> @@ -357,6 +357,19 @@ static void SetInstallDir(SmallVectorImp
> TheDriver.setInstalledDir(InstalledPath);
> }
>
> +static int HandleCC1Tool(SmallVectorImpl<const char *> &argv, StringRef Tool) {
Handle -> Execute, perhaps? (Run? Invoke? Call? (call sounds a bit indirect))
> + if (Tool == "")
> + return cc1_main(argv.data()+2, argv.data()+argv.size(), argv[0],
> + (void*) (intptr_t) GetExecutablePath);
> + if (Tool == "as")
> + return cc1as_main(argv.data()+2, argv.data()+argv.size(), argv[0],
> + (void*) (intptr_t) GetExecutablePath);
> +
> + // Reject unknown tools.
> + llvm::errs() << "error: unknown integrated tool '" << Tool << "'\n";
> + return 1;
> +}
> +
> int main(int argc_, const char **argv_) {
> llvm::sys::PrintStackTraceOnErrorSignal();
> llvm::PrettyStackTraceProgram X(argc_, argv_);
> @@ -375,20 +388,8 @@ int main(int argc_, const char **argv_)
> llvm::cl::ExpandResponseFiles(Saver, llvm::cl::TokenizeGNUCommandLine, argv);
>
> // Handle -cc1 integrated tools.
> - if (argv.size() > 1 && StringRef(argv[1]).startswith("-cc1")) {
> - StringRef Tool = argv[1] + 4;
> -
> - if (Tool == "")
> - return cc1_main(argv.data()+2, argv.data()+argv.size(), argv[0],
> - (void*) (intptr_t) GetExecutablePath);
> - if (Tool == "as")
> - return cc1as_main(argv.data()+2, argv.data()+argv.size(), argv[0],
> - (void*) (intptr_t) GetExecutablePath);
> -
> - // Reject unknown tools.
> - llvm::errs() << "error: unknown integrated tool '" << Tool << "'\n";
> - return 1;
> - }
> + if (argv.size() > 1 && StringRef(argv[1]).startswith("-cc1"))
> + return HandleCC1Tool(argv, argv[1] + 4);
>
> bool CanonicalPrefixes = true;
> for (int i = 1, size = argv.size(); i < size; ++i) {
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list