r215751 - [cleanup] Factor out some checks. NFC.
Sean Silva
chisophugis at gmail.com
Fri Aug 15 14:11:46 PDT 2014
On Fri, Aug 15, 2014 at 1:02 PM, David Blaikie <dblaikie at gmail.com> wrote:
> On Fri, Aug 15, 2014 at 11:50 AM, Sean Silva <chisophugis at gmail.com>
> wrote:
> > Author: silvas
> > Date: Fri Aug 15 13:50:00 2014
> > New Revision: 215751
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=215751&view=rev
> > Log:
> > [cleanup] Factor out some checks. NFC.
> >
> > The core logic in main() is actually pretty simple, but there's lots of
> > stuff that has been added over time which obscures the flow of the code.
> > In upcoming patches, I'll be pulling more stuff out of the main
> > codepath.
> >
> > I'm open to naming suggestions for these helper functions.
> >
> > 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=215751&r1=215750&r2=215751&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/tools/driver/driver.cpp (original)
> > +++ cfe/trunk/tools/driver/driver.cpp Fri Aug 15 13:50:00 2014
> > @@ -293,6 +293,23 @@ namespace {
> > };
> > }
> >
> > +static void HandleDriverEnvVars(Driver &TheDriver) {
>
> "Handle" seems a bit vague - Parse? (though there's not much parsing
> happening) Read? (<- probably my preference, given the options I've
> thought of) Load? Initialize? Populate?
>
I've renamed the function to SetBackdoorDriverOutputsFromEnvVars in r215767.
Thanks for getting me to take another look at this.
-- Sean Silva
>
> > + // Handle CC_PRINT_OPTIONS and CC_PRINT_OPTIONS_FILE.
> > + TheDriver.CCPrintOptions = !!::getenv("CC_PRINT_OPTIONS");
> > + if (TheDriver.CCPrintOptions)
> > + TheDriver.CCPrintOptionsFilename =
> ::getenv("CC_PRINT_OPTIONS_FILE");
> > +
> > + // Handle CC_PRINT_HEADERS and CC_PRINT_HEADERS_FILE.
> > + TheDriver.CCPrintHeaders = !!::getenv("CC_PRINT_HEADERS");
> > + if (TheDriver.CCPrintHeaders)
> > + TheDriver.CCPrintHeadersFilename =
> ::getenv("CC_PRINT_HEADERS_FILE");
> > +
> > + // Handle CC_LOG_DIAGNOSTICS and CC_LOG_DIAGNOSTICS_FILE.
> > + TheDriver.CCLogDiagnostics = !!::getenv("CC_LOG_DIAGNOSTICS");
> > + if (TheDriver.CCLogDiagnostics)
> > + TheDriver.CCLogDiagnosticsFilename =
> ::getenv("CC_LOG_DIAGNOSTICS_FILE");
> > +}
> > +
> > int main(int argc_, const char **argv_) {
> > llvm::sys::PrintStackTraceOnErrorSignal();
> > llvm::PrettyStackTraceProgram X(argc_, argv_);
> > @@ -396,20 +413,7 @@ int main(int argc_, const char **argv_)
> > llvm::InitializeAllTargets();
> > ParseProgName(argv, SavedStrings, TheDriver);
> >
> > - // Handle CC_PRINT_OPTIONS and CC_PRINT_OPTIONS_FILE.
> > - TheDriver.CCPrintOptions = !!::getenv("CC_PRINT_OPTIONS");
> > - if (TheDriver.CCPrintOptions)
> > - TheDriver.CCPrintOptionsFilename =
> ::getenv("CC_PRINT_OPTIONS_FILE");
> > -
> > - // Handle CC_PRINT_HEADERS and CC_PRINT_HEADERS_FILE.
> > - TheDriver.CCPrintHeaders = !!::getenv("CC_PRINT_HEADERS");
> > - if (TheDriver.CCPrintHeaders)
> > - TheDriver.CCPrintHeadersFilename =
> ::getenv("CC_PRINT_HEADERS_FILE");
> > -
> > - // Handle CC_LOG_DIAGNOSTICS and CC_LOG_DIAGNOSTICS_FILE.
> > - TheDriver.CCLogDiagnostics = !!::getenv("CC_LOG_DIAGNOSTICS");
> > - if (TheDriver.CCLogDiagnostics)
> > - TheDriver.CCLogDiagnosticsFilename =
> ::getenv("CC_LOG_DIAGNOSTICS_FILE");
> > + HandleDriverEnvVars(TheDriver);
> >
> > std::unique_ptr<Compilation> C(TheDriver.BuildCompilation(argv));
> > int Res = 0;
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140815/38208177/attachment.html>
More information about the cfe-commits
mailing list