Commit Graph

69 Commits

Author SHA1 Message Date
Alp Toker 965f882588 Remove a whole lot of unused variables
There are about 30 removed in this patch, generated by a new FixIt I haven't
got round to submitting yet.

llvm-svn: 195814
2013-11-27 05:22:15 +00:00
Hans Wennborg e8677ef5ca Move the execution code from Compilation::ExecuteCommand to Command::Execute
I think it makes sense that a Command knows how to execute itself.

There's no functionality change but i rewrote the code to avoid the manual
memory management of Argv.

My motivation for this is that I plan to subclass Command to build fall-back
functionality into clang-cl.

Differential Revision: http://llvm-reviews.chandlerc.com/D1654

llvm-svn: 190621
2013-09-12 18:35:08 +00:00
Hans Wennborg b212b34f19 Move Compilation::PrintJob and PrintDiagnosticJob into Job::Print.
This moves the code to Job.cpp, which seems like a more natural fit,
and replaces the "is this a JobList? is this a Command?" logic with
a virtual function call.

It also removes the code duplication between PrintJob and
PrintDiagnosticJob and simplifies the code a little.

There's no functionality change here, except that the Executable is
now always printed within quotes, whereas it would previously not be
quoted in crash reports, which I think was a bug.

Differential Revision: http://llvm-reviews.chandlerc.com/D1653

llvm-svn: 190620
2013-09-12 18:23:34 +00:00
Rafael Espindola 8c4245455a Remove the -ccc-echo option that is now unused.
llvm-svn: 186970
2013-07-23 17:58:53 +00:00
Rafael Espindola 16125fb652 Update for llvm API change.
llvm-svn: 186448
2013-07-16 19:44:23 +00:00
Rafael Espindola 03bc68268f Convert last use of PathV1.h in Compilation.cpp
The way we decide which file to remove is fairly odd. I took a quick look at
maybe changing that, but it would be a more work than I want to put at this
right now, so I left pair of FIXMEs.

llvm-svn: 184766
2013-06-24 17:59:44 +00:00
Rafael Espindola a466b9aeb9 Convert a use of PathV1.h
llvm-svn: 184753
2013-06-24 16:46:15 +00:00
Rafael Espindola fc92e84586 Use llvm::sys::fs::can_write.
llvm-svn: 184234
2013-06-18 20:58:25 +00:00
Rafael Espindola 1600a53bc0 Include PathV1.h only where it is used.
llvm-svn: 184090
2013-06-17 17:23:47 +00:00
Reid Kleckner 898229ab4b [Driver] Refactor clang driver to use LLVM's Option library
The big changes are:
- Deleting Driver/(Arg|Opt)*
- Rewriting includes to llvm/Option/ and re-sorting
- 'using namespace llvm::opt' in clang::driver
- Fixing the autoconf build by adding option everywhere

As discussed in the review, this change includes using directives in
header files.  I'll make follow up changes to remove those in favor of
name specifiers.

Reviewers: espindola

Differential Revision: http://llvm-reviews.chandlerc.com/D975

llvm-svn: 183989
2013-06-14 17:17:23 +00:00
Rafael Espindola cb4bb19070 Use the sys::ExecuteAndWait that takes StringRefs.
Also don't depend on Program.h including PathV1.h.

llvm-svn: 183935
2013-06-13 20:08:52 +00:00
Rafael Espindola a3346d8765 Use the global functions instead of the Program methods.
llvm-svn: 183861
2013-06-12 20:44:26 +00:00
Chad Rosier d14757751f [driver] Do not generate crash diagnostics if the compilation command failed
to execute as the crash will surely reoccur while generating the diagnostics.
rdar://13362359

llvm-svn: 178089
2013-03-26 23:41:30 +00:00
Chad Rosier 6a1de5c634 [driver] The failure of any phase (e.g., preprocess, compile, assemble) for a
single translation unit should prevent later phases from executing.  Otherwise,
this generates lots of noise in build systems.  This a fallout from r173825.
Patch by Matthew Curtis <mcurtis@codeaurora.org>.
rdar://13298009

llvm-svn: 176198
2013-02-27 18:46:04 +00:00
Douglas Gregor 4bedb499ea Form the default -fmodules-cache-path= properly.
llvm-svn: 174674
2013-02-07 22:59:12 +00:00
Chad Rosier c5103c3f3e [driver] Clear the FailureResultFiles when initializing clang diagnostics. Also,
minor cleanup.

llvm-svn: 173852
2013-01-29 23:57:10 +00:00
Chad Rosier dd60e09021 [driver] Refactor the driver so that a failing commands doesn't prevent
subsequent commands from being executed.

The diagnostics generation isn't designed for this use case, so add a note to
fix this in the very near future.  For now, just generated the diagnostics for
the first failing command.
Part of rdar://12984531

llvm-svn: 173825
2013-01-29 20:15:05 +00:00
Chad Rosier 633dcdc52d [driver] Associate a JobAction with each result file. This enables the driver
to delete result files for only those commands that fail.
Part of rdar://12984531

llvm-svn: 173361
2013-01-24 19:14:47 +00:00
Daniel Dunbar 582b2ab0dd [Driver] Don't remove non-regular files that were outputs.
llvm-svn: 173215
2013-01-23 01:08:23 +00:00
Chandler Carruth 3a02247dc9 Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

llvm-svn: 169237
2012-12-04 09:13:33 +00:00
Dmitri Gribenko b2aa9234b6 Use empty parens for empty function parameter list instead of '(void)'.
llvm-svn: 168041
2012-11-15 14:28:07 +00:00
Chad Rosier 37756b0714 [driver] Remove an extra space with the -iprefix option, so that
matching works correctly.
Part of rdar://12329974

llvm-svn: 167173
2012-10-31 21:08:30 +00:00
Chad Rosier 2933d05033 [driver] Remove an extra space with the -internal-externc-isystem option, so
that matching works correctly.
Part of rdar://12329974

llvm-svn: 167161
2012-10-31 19:28:55 +00:00
Chad Rosier 83f16bf445 [driver] Completely rework how superfluous options are stripped out of the crash
diagnostics script.

This addresses the FIXME pertaining to quoted arguments.  We also delineate
between those flags that have an argument (e.g., -D macro, -MF file) and
those that do not (e.g., -M, -MM, -MG).  Finally, we add the -dwarf-debug-flags
to the list of flags to be removed.
rdar://12329974

llvm-svn: 167152
2012-10-31 18:31:33 +00:00
Chad Rosier 45cf50f7b6 Use array_lengthof instead of sizeof trickery.
llvm-svn: 156104
2012-05-03 21:25:34 +00:00
Chad Rosier cb600e2422 Canonicalize loop.
llvm-svn: 156093
2012-05-03 19:50:25 +00:00
Sebastian Pop 980920a321 use DEFAULT_SYSROOT
llvm-svn: 154792
2012-04-16 04:16:43 +00:00
Peter Collingbourne 9b515cb0ec Add the depfile as a result file so that it is deleted if we crash,
and prevent the diagnostic preprocessor run from writing a depfile.

llvm-svn: 143846
2011-11-06 00:40:05 +00:00
Benjamin Kramer 8c26d440da Use strpbrk(3) instead of open coding it.
llvm-svn: 141328
2011-10-06 22:53:35 +00:00
Chad Rosier 10746f5ebb [driver] For consistency, handle all shell special characters handled by the
quoting code.

llvm-svn: 141205
2011-10-05 20:09:11 +00:00
Chad Rosier 9b1311df26 [driver] The -v option doesn't quoted the command line arguments for historical
reasons.  However, it does seems practical to quote strings that need it.
rdar://10221951

llvm-svn: 141202
2011-10-05 19:51:41 +00:00
Chad Rosier be10f9853c When the compiler crashes, the compiler driver now produces diagnostic
information including the fully preprocessed source file(s) and command line 
arguments.  The developer is asked to attach this diagnostic information to a 
bug report.
rdar://9575623

llvm-svn: 136702
2011-08-02 17:58:04 +00:00
Francois Pichet 24fc69e531 Unbreak the MSVC build, using namespace clang is required otherwise MSVC will not find raw_ostream.
llvm-svn: 135853
2011-07-23 11:36:43 +00:00
Chris Lattner 0e62c1cc0b remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.

llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Chad Rosier 1988642124 Temporarily revert r135614 while I fix the cmake build.
llvm-svn: 135621
2011-07-20 21:16:17 +00:00
Chad Rosier e3805fc118 When the compiler crashes, the compiler driver now produces diagnostic information
including the fully preprocessed source file(s) and command line arguments.  The 
developer is asked to attach this diagnostic information to a bug report.

llvm-svn: 135614
2011-07-20 20:26:32 +00:00
John McCall 6dd2417dbe Missing header from last commit; accidental change.
llvm-svn: 134455
2011-07-06 00:38:59 +00:00
John McCall 24fc0decfe Change the driver's logic about Objective-C runtimes: abstract out a
structure to hold inferred information, then propagate each invididual
bit down to -cc1.  Separate the bits of "supports weak" and "has a native
ARC runtime";  make the latter a CodeGenOption.

The tool chain is still driving this decision, because it's the place that
has the required deployment target information on Darwin, but at least it's
better-factored now.

llvm-svn: 134453
2011-07-06 00:26:06 +00:00
Daniel Dunbar 462e7ed497 Driver: When compilation fails, don't try to remove output files we don't have
write access to.

llvm-svn: 130150
2011-04-25 20:43:05 +00:00
Nick Lewycky 6da90771c4 Remove stray emacs mode markers in all these files that was causing emacs to
open them in fundamental-mode instead of c++-mode.
Also twiddle whitespace for consistency in ToolChains.cpp.

llvm-svn: 122646
2010-12-31 17:31:54 +00:00
Michael J. Spencer 8aaf49959c Merge System into Support.
llvm-svn: 120297
2010-11-29 18:12:39 +00:00
Benjamin Kramer 7d11382b8c Use the expanded form of S_ISREG. Hopefully this unbreaks the MSVC build.
llvm-svn: 117779
2010-10-30 08:28:42 +00:00
Dan Gohman e89c04e518 Don't test isRegularFile before calling eraseFromDisk, since
eraseFromDisk does the same check. This avoids a stat call
in the common case.

llvm-svn: 117744
2010-10-29 23:26:14 +00:00
Daniel Dunbar b785d74080 Driver: Eliminate PipedJob, which is now unused.
llvm-svn: 110014
2010-08-02 02:38:25 +00:00
Daniel Dunbar 775d406043 Driver: Add an explicit argument translation phase to the driver itself. We are going to need this to handle things like -Xassembler, -Xpreprocessor, and -Xlinker which we might have to introspect.
llvm-svn: 105842
2010-06-11 22:00:26 +00:00
Daniel Dunbar 6a8efa8a79 Driver: Support CC_PRINT_OPTIONS, used for logging the compile commands (in -v style) to a file.
llvm-svn: 99054
2010-03-20 08:01:59 +00:00
Daniel Dunbar 7c4de04c30 Driver: Fix -### to quote shell special characters, following gcc.
llvm-svn: 99053
2010-03-20 08:01:53 +00:00
Edward O'Callaghan c92791193d Fix for Path::isSpecialFile to Path::isRegularFile API in rev 89765.
llvm-svn: 89849
2009-11-25 06:33:27 +00:00
Edward O'Callaghan db521ec23b Fix for PR5568.
llvm-svn: 89766
2009-11-24 15:23:21 +00:00
Daniel Dunbar da13faf982 Driver: ArgList doesn't depend on Options.h anymore.
llvm-svn: 89313
2009-11-19 04:25:22 +00:00