Commit Graph

475 Commits

Author SHA1 Message Date
Chandler Carruth 5553d0d4ca Sort all the #include lines with LLVM's utils/sort_includes.py which
encodes the canonical rules for LLVM's style. I noticed this had drifted
quite a bit when cleaning up LLVM, so wanted to clean up Clang as well.

llvm-svn: 198686
2014-01-07 11:51:46 +00:00
Bob Wilson 9914a02114 Propagate "-arch x86_64h" setting to the linker. <rdar://problem/15711488>
This is a follow-up to r194907, which added a new -arch setting to make it
easier to specify AVX2 targets. The "-arch x86_64h" option needs to be passed
on to the linker, but it was getting canonicalized to x86_64 by the code
in getArchTypeForDarwinArchName.

llvm-svn: 198096
2013-12-28 05:26:14 +00:00
Hans Wennborg e0053474b9 clang-cl: Support /P and /E (preprocess to file or stdout)
llvm-svn: 197827
2013-12-20 18:40:46 +00:00
David Peixotto 3e325d7490 Add option to use temporary file for assembling with clang
This commit adds the flag '-via-file-asm' to the clang driver. The
purpose of this flag is to have a way to test that clang can consume
the assembly code that it outputs. When passed this flag, clang will
generate a temporary file that contains the assembly output from the
compile step. This assembly file will then be consumed by either the
integrated assembler or the external assembler. To test that the
integrated assembler can consume its own output compile with:

  $ clang -integrated-assembler -via-file-asm

Without the '-via-file-asm' flag, clang would directly create the
object file when using the integrated assembler. With the flag it
will first create the temporary assembly file and then read that
file and assemble it with the integrated assembler.

The flow is similar to -save-temps, except that it only effects
the assembly input and the temporary file is not saved.

llvm-svn: 196606
2013-12-06 20:27:33 +00:00
Alp Toker 8c8a875079 Fix method/variable name typos
llvm-svn: 196214
2013-12-03 06:53:35 +00:00
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
Rafael Espindola 1462796cdd Remove the Darwin_Generic_GCC toolchain.
This is currently unused by any test. The code path would still be hit
by clang on ppc, but

* PPC has not been supported on current versions of OS X
* A port of current clang to older OS X on ppc should be using
toolchains::DarwinClang.

llvm-svn: 195585
2013-11-24 23:28:23 +00:00
Peter Collingbourne 3270164f39 SanitizerArgs: add ability to filter/diagnose unsupported sanitizers.
The thread, memory, dataflow and function sanitizers are now diagnosed if
enabled explicitly on an unsupported platform.  Unsupported sanitizers which
are enabled implicitly (as part of a larger group) are silently disabled.  As a
side effect, this makes SanitizerArgs parsing toolchain-dependent (and thus
essentially reverts r188058), and moves SanitizerArgs ownership to ToolChain.

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

llvm-svn: 193875
2013-11-01 18:16:25 +00:00
Hans Wennborg 9c1659b5b7 clang-cl: diagnose setting asm listing filename with multiple inputs
llvm-svn: 193006
2013-10-18 22:49:04 +00:00
Hans Wennborg 2c21f74f02 clang-cl: Add support for asm listings (/FA and /Fa)
This adds support for outputing the assembly to a file during compilation.
It does this by changing the compilation pipeling to not use the integrated
assembler, and keep the intermediate assembler file.

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

llvm-svn: 192902
2013-10-17 16:16:23 +00:00
Robert Lytton cf1dd692ae XCore target: add an xcore toolchain implementation
llvm-svn: 192437
2013-10-11 10:29:40 +00:00
Rafael Espindola cc707bc989 Produce an error if a -cc1 only option is passed to the driver.
llvm-svn: 191380
2013-09-25 15:54:41 +00:00
Rafael Espindola 8a2d496e18 Produce errors for unknown options.
This doesn't change a lot since clang still thinks it knows all of the
-f*, -m* and -W* options for example.

Other than the options clang explicitly claims to know, this fixes pr9701.

llvm-svn: 191249
2013-09-23 23:55:25 +00:00
Hans Wennborg 9cb7d9ba94 clang-cl: Don't warn about overriding /MD with /MT, /Fo with another /Fo, etc.
I put in the warnings because MSVC has them, but I don't think they're very
useful.

Clang does not warn about overriding flags in general, e.g. it's perfectly
fine to have -fomit-frame-pointer followed by -fno-omit-frame-pointer.

We should focus on warning where things get confusing, such as with the
/TP and /TC options. In "clang-cl /TC a.c /TP b.cc", the user might not
realize that the /TP flag will apply to both files, and we warn about that.

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

llvm-svn: 190964
2013-09-18 22:26:39 +00:00
Hans Wennborg a8ef14f3f4 clang-cl: ignore compile-only options in link-only invocations.
Previously we would warn about unused arguments such as /MD when linking.
Clang already has logic to ignore compile-only options, e.g. for -D and -U.
This patch extends that to include clang-cl's compile-only options too.

Also, some clang-cl options should always be ignored. Doing this earlier
means they get ignored both for compilation and link-only invocations.

llvm-svn: 190825
2013-09-17 00:03:41 +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
Hans Wennborg d9ad0681fa clang-cl: Warn about overriding /MD with /MT etc.
This also bakes the /M options into a separate option group to make
them easier to refer to from the code.

llvm-svn: 190529
2013-09-11 16:38:41 +00:00
Hans Wennborg f1a7425bd9 clang-cl: Support building DLLs (PR17083)
This adds driver support for building DLLs (the /LD and /LDd flags).
It basically does two things: runtime selection and passing -dll and
-implib to the linker.

llvm-svn: 190428
2013-09-10 20:18:04 +00:00
Hans Wennborg 0a096a0a3b clang-cl: Use .obj as extension for unnamed object files (PR17095)
We already use .obj as extension when the user provides a stem file
name (via /Fo), but were failing in the most basic case when the file
name is based on the input file.

llvm-svn: 190071
2013-09-05 17:05:56 +00:00
Rafael Espindola 0c9fa3f982 Use -### instead of -ccc-print-options.
Convert the last few tests using -ccc-print-options to -### and remove
-ccc-print-options.

llvm-svn: 189802
2013-09-03 13:26:49 +00:00
Rafael Espindola e8025644b2 Produce an error when trying to link with -emit-llvm.
llvm-svn: 189193
2013-08-25 14:27:09 +00:00
Rafael Espindola 493f045e75 Don't imply -flto with -O4.
We now saturate at -O3.

llvm-svn: 189149
2013-08-23 21:49:00 +00:00
Shuxin Yang 4b3c7ffc64 Driver::IsUsingLTO() no longer return true when seeing -emit-llvm.
One step toward differentiating following two commands:
   clang -O3 -flto a.c -c, and 
   clang -O3 -emit-llvm a.c

Thanks many awesome folks for clarifying things. 

llvm-svn: 189148
2013-08-23 21:34:57 +00:00
Alexey Samsonov 609213f9eb Move SanitizerArgs to the clang Driver
Summary:
This change turns SanitizerArgs into high-level options
stored in the Driver, which are parsed lazily. This fixes an issue of multiple copies of the same diagnostic message produced by sanitizer arguments parser.

Reviewers: rsmith

Reviewed By: rsmith

CC: chandlerc, eugenis, cfe-commits

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

llvm-svn: 188660
2013-08-19 09:14:21 +00:00
Shuxin Yang 5f22d5263a revert 188352
llvm-svn: 188353
2013-08-14 04:47:39 +00:00
Shuxin Yang 538a17691c Driver::IsUsingLTO() no longer return true when seeing -emit-llvm.
The rationale for this change is to differentiate following two situations:
  1) clang -c -emit-llvm a.c
  2) clang -c -flto a.c 

Reviewed by Eric Christopher. Thanks a lot!

llvm-svn: 188352
2013-08-14 04:36:53 +00:00
Hans Wennborg 2e27459d6c clang-cl: Support /link option and set target to win32
This adds support for the /link option, which forwards
subsequent arguments to the linker.

The test for this will only work when targetting win32.
Since that's the only target where clang-cl makes sense,
use that target by default.

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

llvm-svn: 188331
2013-08-13 23:38:57 +00:00
Hans Wennborg ed1d07282c Handle "--" explicitly in the driver
Anything that comes after -- is treated as an input file. This
used to be handled automagically by the option parsing library,
but after LLVM r188314, we should handle it ourselves.

No functionality change.

llvm-svn: 188316
2013-08-13 21:32:29 +00:00
Hans Wennborg 13b7fe72a7 clang-cl: Sink /Fe and /Fo diagnostic code into BuildActions
Differential Revision: http://llvm-reviews.chandlerc.com/D1370

llvm-svn: 188226
2013-08-12 23:26:25 +00:00
Hans Wennborg 207fcf0e7b clang-cl: Support the /Fe option
This is used to name the linked output file.

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

llvm-svn: 188210
2013-08-12 21:56:42 +00:00
Hans Wennborg 0d0b19cbe1 clang-cl: Expand warning about /TC and /TP override, and expand test
llvm-svn: 188190
2013-08-12 18:34:17 +00:00
Hans Wennborg 0a0faa98d1 clang-cl: Use .obj as object file extension instead of .o
Differential Revision: http://llvm-reviews.chandlerc.com/D1302

llvm-svn: 187840
2013-08-07 00:32:15 +00:00
Hans Wennborg 2b89a2692c clang-cl: Implement support for the /Fo option
This implements support for the /Fo option, which is used
to set the filename or output dir for object files.

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

llvm-svn: 187820
2013-08-06 22:11:28 +00:00
Hans Wennborg 6ee64d52cf clang-cl: Implement the /Tc, /TC, /Tp and /TP options.
These are used to specify source files, and whether to treat source
files as C or C++.

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

llvm-svn: 187760
2013-08-06 00:20:31 +00:00
Hans Wennborg 1907610d4e clang-cl: add the /c, /W0 and /W1 options
This adds a few more clang-cl options. It also exposes two core clang
options to the clang-cl mode: we need to be able to claim --driver_mode
so it doesn't show up as unused in cl mode, and we need -### for tests.

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

llvm-svn: 187527
2013-07-31 20:51:53 +00:00
Chandler Carruth 0ae39aaefd Start keeping track of what work was done to detect a GCC installation
on the system, and report it when running the driver in verbose mode.
Without this it is essentially impossible to understand why a particular
GCC toolchain is used by Clang for libstdc++, libgcc, etc.

This also required threading a hook through the toolchain layers for
a specific toolchain implementation to print custom information under
'clang -v'. The naming here isn't spectacular. Suggestions welcome.

llvm-svn: 187427
2013-07-30 17:57:09 +00:00
Hans Wennborg 6ddc6901ef clang-cl: add support for the /? and /help options
This establishes a new Flag in Options.td, which can be assigned to
options that should be made available in clang's cl.exe compatible
mode, and updates the Driver to make use of the flag.

(The whitespace change to CMakeLists forces the build to re-run CMake
 and pick up the include dependency on the new .td file. This makes the
 build work if someone moves backwards in commit history after this change.)

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

llvm-svn: 187280
2013-07-27 00:23:45 +00:00
Bill Schmidt 778d387684 [PowerPC] Support powerpc64le as a syntax-checking target.
This patch provides basic support for powerpc64le as an LLVM target.
However, use of this target will not actually generate little-endian
code.  Instead, use of the target will cause the correct little-endian
built-in defines to be generated, so that code that tests for
__LITTLE_ENDIAN__, for example, will be correctly parsed for
syntax-only testing.  Code generation will otherwise be the same as
powerpc64 (big-endian), for now.

The patch leaves open the possibility of creating a little-endian
PowerPC64 back end, but there is no immediate intent to create such a
thing.

The new test case variant ensures that correct built-in defines for
little-endian code are generated.

llvm-svn: 187180
2013-07-26 01:36:11 +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
Hans Wennborg e4b031ca03 Add a cl.exe compatible driver mode
The mode doesn't actually do anything yet, but this provides a
way to get into it.

llvm-svn: 186720
2013-07-19 20:33:20 +00:00
Hans Wennborg 5937ec7502 Address -Wreorder warning in Driver.cpp
llvm-svn: 186617
2013-07-18 21:45:42 +00:00
Hans Wennborg 70850d83dc Turn Driver::CCCIsCXX and CCCIsCPP into a single Mode enum,
and add a new option --driver-mode= to control it explicitly.

The CCCIsCXX and CCCIsCPP flags were non-overlapping, i.e. there
are currently really three modes that Clang can run in: gcc, g++
or cpp, so it makes sense to represent them as an enum.

Having a command line flag to control it helps testing.

llvm-svn: 186605
2013-07-18 20:29:38 +00:00
Rafael Espindola a07f720a1b Use the simpler is_directory.
llvm-svn: 186487
2013-07-17 04:23:07 +00:00
Rafael Espindola 16125fb652 Update for llvm API change.
llvm-svn: 186448
2013-07-16 19:44:23 +00:00
Rafael Espindola a36e78ef5d Use llvm::sys::fs::createTemporaryFile.
llvm-svn: 185717
2013-07-05 20:00:06 +00:00
Craig Topper 2341c0d3b2 Use SmallVectorImpl instead of SmallVector for iterators and references to avoid specifying the vector size unnecessarily.
llvm-svn: 185610
2013-07-04 03:08:24 +00:00
Rafael Espindola 37d229de2f Add r184803 back now that the bug in unique_file has been fixed.
Original message:

Use the new PathV2 instead of implementing the logic in clang.

llvm-svn: 184825
2013-06-25 04:26:55 +00:00
Rafael Espindola e7f89915b4 Revert "Use the new PathV2 instead of implementing the logic in clang."
This reverts commit 184803 while I debug the failures on the bots.

llvm-svn: 184818
2013-06-25 02:35:32 +00:00
Rafael Espindola e3d0c4a9bd Remove PathV1.h from Driver.cpp.
llvm-svn: 184807
2013-06-25 01:11:59 +00:00
Rafael Espindola 503b726b43 Use the new PathV2 instead of implementing the logic in clang.
llvm-svn: 184803
2013-06-25 00:55:28 +00:00