Commit Graph

1743 Commits

Author SHA1 Message Date
Evgeniy Stepanov ea155f0153 Require -pie when linking with ASan on Android.
llvm-svn: 157923
2012-06-04 11:15:05 +00:00
Simon Atanasyan 590ad8f515 MIPS: Factor out code selects the float ABI as determined by -msoft-float,
-mhard-float, and -mfloat-abi= to the new function getMipsFloatABI. That
simplifies reuse of this code.

llvm-svn: 157888
2012-06-02 15:06:29 +00:00
Simon Atanasyan 217dc2d8dd MIPS: Pass -KPIC argument to MIPS assembler if necessary.
llvm-svn: 157635
2012-05-29 19:07:33 +00:00
Simon Atanasyan a16b7fd029 Factor out the code retrieves the last PIC related argument from
the Clang::ConstructJob() to the new ArgList::getLastArg() routine
with eight argument. That simplifies reusing of this code.

llvm-svn: 157633
2012-05-29 18:50:33 +00:00
Alexey Samsonov dda3a7f914 Make Clang driver pass the last option from -g group to the compiler.
Leave a better fixme for different debug info flags

llvm-svn: 157602
2012-05-29 08:10:34 +00:00
Chad Rosier 37a12af0af [driver] Have the crash diagnostics print the clang version information.
rdar://11518308

llvm-svn: 157346
2012-05-23 21:38:47 +00:00
Argyrios Kyrtzidis 3169e80603 [driver] When creating the compiler invocation out of command-line
arguments, force use of clang frontend for the driver.

Fixes rdar://11356765.

llvm-svn: 157205
2012-05-21 20:11:54 +00:00
Peter Collingbourne 041ac6c2b1 Tell the driver that CUDA is a C++-like language, so that we get C++
header searches with CUDA.

llvm-svn: 157172
2012-05-20 23:28:36 +00:00
Chad Rosier 06fd3c61be [driver] Remove obsolete support for -A link option. The standard -A option is
used by the preprocessor.  Apple's GCC also supported a -A option for linking.

The ld man page has the following:
 -A basefile - Obsolete incremental load format.  This option is obsolete.

Nick Kledzik confirms this option is no longer needed/supported.
rdar://11455614

llvm-svn: 156965
2012-05-16 23:45:12 +00:00
Chad Rosier c14ded7182 Rename the driver option to -mno-implicit-float, per Eli's suggestion.
llvm-svn: 156950
2012-05-16 21:19:55 +00:00
Manuel Klimek 3ef9c44747 Pulls diagnostics for temp file handling into the common diagnostic kinds.
llvm-svn: 156947
2012-05-16 20:55:58 +00:00
Chad Rosier f1985d2a44 [driver] Allow the driver to directly accept the -no-implicit-float option, so that the
generation of implicit floating point instructions can be disable for ARM. 
rdar://11409142

llvm-svn: 156942
2012-05-16 20:40:09 +00:00
Kostya Serebryany 66e8fab1c8 [tsan] add ThreadSanitizer linker flags on Linux and also copy the tsan-rt into the appropriate place at build time
llvm-svn: 156906
2012-05-16 06:36:00 +00:00
Douglas Gregor 9295df0569 Add the Objective-C runtime linking arguments after user-specified
linker arguments. Fixes <rdar://problem/11417441>. 

llvm-svn: 156853
2012-05-15 21:00:27 +00:00
Bob Wilson 16d939584b Do not link with Objective-C libraries with -nostdlib or -nodefaultlibs.
<rdar://problem/11433499>

llvm-svn: 156841
2012-05-15 18:57:39 +00:00
Gabor Greif 9304763dfc add embedded linux variants that occur in the field
llvm-svn: 156813
2012-05-15 11:21:03 +00:00
Chandler Carruth 94a3201179 Teach the driver on Linux to respect -nodefaultlibs.
Patch from Andrew C. Morrow.

llvm-svn: 156771
2012-05-14 18:31:18 +00:00
Sirish Pande 11ebc4ed1b Hexagon V5 FP support.
llvm-svn: 156567
2012-05-10 20:19:54 +00:00
Chad Rosier 7b1fee1fe5 Roll logic into a single if statement, per David's suggestion.
llvm-svn: 156502
2012-05-09 18:55:57 +00:00
Chad Rosier bf8628e62f Use the triple directly, rather then getTriple().
llvm-svn: 156501
2012-05-09 18:51:13 +00:00
Chad Rosier 266c620623 Now the proper fix for r156497. Sorry for the churn.
llvm-svn: 156498
2012-05-09 18:46:30 +00:00
Chad Rosier 6037c6bae0 Move the iOSVersionMin string to a header so as to avoid a dangling pointer.
llvm-svn: 156497
2012-05-09 18:37:26 +00:00
Chad Rosier f761fe9d23 [driver] Use the iOS target triple to infer the deployment target.
rdar://11409204

llvm-svn: 156489
2012-05-09 18:09:58 +00:00
Bob Wilson e78227b1ff Ignore a "generic" return value from getHostCPUName. <rdar://problem/11314502>
llvm-svn: 156487
2012-05-09 17:53:10 +00:00
Nuno Lopes 3d6311d5f7 add -fbounds-checking option.
When enabled, clang generates bounds checks for array and pointers dereferences. Work to follow in LLVM's backend.

OK'ed by Chad; thanks for the review.

llvm-svn: 156431
2012-05-08 22:10:46 +00:00
Chad Rosier aaec1338b1 StringRefize code because we're good even when we crash.
Patch by Jordy Rose.

llvm-svn: 156172
2012-05-04 15:32:05 +00:00
Jean-Daniel Dupas 73d801cd8a Fix -Wlarge-by-value-copy option handling in the driver.
CC1 supports only the joined format.

llvm-svn: 156161
2012-05-04 08:08:37 +00:00
Alexey Samsonov 74a3868dbb This patch adds a new Clang compiler flag "-gline-tables-only".
It reduces the amount of emitted debug information:
1) DIEs in .debug_info have types DW_TAG_compile_unit, DW_TAG_subprogram,
DW_TAG_inlined_subroutine (for opt builds) and DW_TAG_lexical_block only.
2) .debug_str contains only function names.
3) No debug data for types/namespaces/variables is emitted.
4) The data in .debug_line is enough to produce valid stack traces with
function names and line numbers.

Reviewed by Eric Christopher.

llvm-svn: 156160
2012-05-04 07:39:27 +00:00
Bob Wilson e64bd84ec7 Remove obsolete code for finding a fallback iOS SDK. <rdar://problem/11378535>
llvm-svn: 156149
2012-05-04 03:09:46 +00:00
Chad Rosier dcef562557 [driver - crash diagnostics] Convert the flags back to an array of strings and use
array_lengthof.  Also, append the new filename with correct preprocessed suffix.
Last part of rdar://11285725

llvm-svn: 156117
2012-05-03 22:38:00 +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 1c5add6c5b [driver - crash diagnostics] Only write the failing command in the script.
Part of rdar://11285725

llvm-svn: 156096
2012-05-03 20:17:15 +00:00
Chad Rosier cb600e2422 Canonicalize loop.
llvm-svn: 156093
2012-05-03 19:50:25 +00:00
Chad Rosier f91fb400b3 [driver crash diagnostics] Remove more flags that reference absolute paths that
aren't necessary to reproduce the clang crash.
Part of rdar://11285725

llvm-svn: 156079
2012-05-03 17:07:55 +00:00
Bob Wilson f9fbc6a84a Rip out old code for finding libraries in GCC's directories.
llvm-svn: 156058
2012-05-03 05:23:52 +00:00
Benjamin Kramer c242ef245c Driver: Turn the default value for -fmath-errno into a proper target hook and disable it by default on more platforms.
For now -fno-math-errno is the default on BSD-derived platforms (Darwin,
DragonFlyBSD, FreeBSD, NetBSD, OpenBSD). If the default is not right for
your platform, please yell. I only verified the result with the default
compilers on Darwin and FreeBSD.

llvm-svn: 155990
2012-05-02 14:55:48 +00:00
James Molloy cebf75e8ca Fix forwarding of -fpack-struct from driver to CC1, and add a test.
-fpack-struct's handling has changed in CC1 (one of only two flags that needed changing) because the driver treats "-fpack-struct" as a boolean flag, and CC1 (did) treat it as an option with a separated value.

This change causes -fpack-struct=X to be forwarded correctly to -fpack-struct=X instead of erroneously to "-fpack-struct X"

llvm-svn: 155981
2012-05-02 07:56:14 +00:00
Andrew Trick 4d77ceaa22 Speculatively fix windows cmake builders.
Really just a wild stab in the dark.

llvm-svn: 155974
2012-05-02 01:23:51 +00:00
James Molloy a3c85b8629 Unify Options.td and CC1Options.td, in a first step towards unifying the serialization logic in Frontend and Driver.
Reviewed by Eric, Doug and Chandler, and here: http://llvm.org/reviews/r/7/

llvm-svn: 155916
2012-05-01 14:57:16 +00:00
Douglas Gregor f7b8841b71 Add support for openSUSE 12.2, from Ismail Donmez!
llvm-svn: 155860
2012-04-30 23:42:57 +00:00
Chad Rosier 98ab91c226 [driver] Don't try to set the deployment target when there is no bound
architecture; this was happening for tools such as lipo and dsymutil.
Also, if no -arch option has been specified, set the architecture based
on the TC default.
rdar://11329656

llvm-svn: 155730
2012-04-27 19:51:11 +00:00
Chad Rosier a78a6eb408 Fix logic such that we only call getToolChain once. No functional change
intended.

llvm-svn: 155719
2012-04-27 16:50:38 +00:00
Chad Rosier 631fa107eb Remove redundant calls to BAA->getArchName(). No functional change
intended.

llvm-svn: 155718
2012-04-27 16:48:16 +00:00
Chad Rosier 7c5d908d81 Revert 155679; Not a typo.
llvm-svn: 155708
2012-04-27 14:58:16 +00:00
Chad Rosier a2a59ade6c Typo.
llvm-svn: 155679
2012-04-27 00:35:50 +00:00
Simon Atanasyan 9bb634df36 MIPS: Add support for 64-bit MIPS targets: mips64 / mips64el.
llvm-svn: 155656
2012-04-26 19:57:02 +00:00
Chandler Carruth 3634c66b41 Fix a long-standing bug where Clang had a different default from GCC on
Linux and other (non-Darwin) platforms and have it use -fmath-errno by
default (for better or worse).

Darwin has seen the light here and uses -fno-math-errno by default, this
patch preserves that.

If any maintainers for a non-Linux platform would also like to opt-in to
-fno-math-errno by default, I'm happy to add folks, but we're currently
getting buts and misleading comparisons with GCC due to this difference
in behavior on Linux at least.

llvm-svn: 155607
2012-04-26 02:10:51 +00:00
Evgeniy Stepanov 7786671b5a Clang driver support for linking on Android.
llvm-svn: 155541
2012-04-25 08:59:22 +00:00
Evgeniy Stepanov 78eaa2cd1b Fix default cpu for -march=armv5e.
llvm-svn: 155540
2012-04-25 08:35:56 +00:00
Evgeniy Stepanov 582911a089 Only pass -mcpu, -march, -mfpu to linux-as on ARM.
llvm-svn: 155431
2012-04-24 09:05:31 +00:00
Chandler Carruth 70ac923ebc Revert r155363, due to the underlying patches in LLVM causing regression
test suite failures.

llvm-svn: 155371
2012-04-23 18:25:40 +00:00
Sirish Pande 7039d0eaee Hexagon V5 (floating point) support in cfe.
llvm-svn: 155363
2012-04-23 17:48:57 +00:00
Bob Wilson 7dda0cdcd7 Link with Foundation whenever -fobjc-link-runtime is used. <rdar://10976177>
The check for excluding libarclite on i386 MacOSX should not apply to
Foundation.

llvm-svn: 155263
2012-04-21 00:21:42 +00:00
Chad Rosier 5b58af0381 In r135308, -save-temps was modified to prevent a temporary file from
overwriting the input file.  For example,

clang -c foo.s -o foo.o -save-temps

Unfortunately, the original patch didn't compare the paths of the input and
output files.  Thus, something like the following would fail to create foo.s.

cd /tmp/obj
clang -c ../src/foo.s -o foo.o -save-temps

rdar://11252615

llvm-svn: 155224
2012-04-20 20:05:08 +00:00
Chad Rosier 232150b90a When generating the clang crash diagnostic script, strip out the -o flag.
Add a FIXME comment.
rdar://11283560

llvm-svn: 155207
2012-04-20 17:21:42 +00:00
Chad Rosier 681e4b8d96 Add a little hack to emulate a clang crash, so the diagnostics generator can be
tested.

llvm-svn: 155205
2012-04-20 17:08:59 +00:00
Evgeniy Stepanov ed943f66d6 Pass -mfloat-abi= to linuxtools assembler.
llvm-svn: 155191
2012-04-20 09:03:40 +00:00
Chad Rosier 9c74e4310c When generating the clang crash diagnostic script, strip out the -D, -F, and -I
flags.  We have preprocessed source, so we don't need these.

No test case as it's fairly difficult to make the compiler crash on demand.  I'll
patiently wait for Ben to tell me how to do this in 2 lines of code.  :)
rdar://11283560

llvm-svn: 155180
2012-04-20 00:30:04 +00:00
Chandler Carruth b8ae76037a Revert some Hexagon builtin commits to match reverts done to LLVM in
r155047. See the LLVM log for the primary motivation:
  http://llvm.org/viewvc/llvm-project?rev=155047&view=rev

Primary commit r154828:
  - Several issues were raised in review, and fixed in subsequent
    commits.
  - Follow-up commits also reverted, and which should be folded into the
    original before reposting:
    - r154837: Re-add the 'undef BUILTIN' thing to fix the build.
    - r154928: Fix build warnings, re-add (and correct) header and
      license
    - r154937: Typo fix.

Please resubmit this patch with the relevant LLVM resubmission.

llvm-svn: 155048
2012-04-18 21:32:25 +00:00
Gabor Greif 5d3231cecb fix GCC version comparison wrt. equal patch suffices (and squash two typos)
llvm-svn: 154997
2012-04-18 10:59:08 +00:00
Gabor Greif 8a45d57a1d fix a typo
llvm-svn: 154920
2012-04-17 11:16:26 +00:00
Sirish Pande f02eebef2a Hexagon V5(Floating Point) support.
llvm-svn: 154828
2012-04-16 17:04:05 +00:00
Sebastian Pop 980920a321 use DEFAULT_SYSROOT
llvm-svn: 154792
2012-04-16 04:16:43 +00:00
David Blaikie 6f9f4ebc9f Correct indentation
llvm-svn: 154774
2012-04-15 21:22:10 +00:00
David Chisnall 3d127c79e8 Don't link lib[std]c++ when -nostdlib is specified (Solaris driver).
Patch by Dmitri Shubin!

llvm-svn: 154392
2012-04-10 11:49:50 +00:00
Evgeniy Stepanov 70cb3d623b Pass -march, -mcpu, -mfpu to linuxtools assembler.
llvm-svn: 154389
2012-04-10 09:05:40 +00:00
Rafael Espindola 9446d76e80 Fix an annoying little bug I found while debugging another LTO issue. Gold
requires the -plugin to come before any -plugin-opt options, we were passing
them the other way around. With this one can run (for example):

clang -o foo foo.c -O4 -Wl,-plugin-opt=generate-api-file

llvm-svn: 154357
2012-04-09 23:53:34 +00:00
Fariborz Jahanian 0568407543 objective-c: remove -fobjc-default-synthesize-properties from the driver.
cc1 option remains though to invoke default property synthesis.
// rdar://11209719

llvm-svn: 154334
2012-04-09 18:58:55 +00:00
Fariborz Jahanian ba8ef296e4 objective-c: Remove -fno-objc-default-synthesize-properties
as the driver option.
// rdar://11209719

llvm-svn: 154331
2012-04-09 18:20:28 +00:00
David Chisnall 58464d0fe1 Revert r154321, pending more discussion.
llvm-svn: 154327
2012-04-09 17:25:11 +00:00
David Chisnall 4ec2af2fab Add -fobjc-trace to emit a call before and after each Objective-C message send
for hooking in code flow visualisation applications.  

llvm-svn: 154321
2012-04-09 15:42:15 +00:00
Anton Korobeynikov a29e4627bc Factor out ARM floating ABI determination to new routine
llvm-svn: 154318
2012-04-09 13:38:30 +00:00
David Chisnall a27cf0e6e1 Make a modern Objective-C runtime the default target for *BSD. Don't yet change this on GNU/Linux, where the GCC runtime still tends to be used.
llvm-svn: 154315
2012-04-09 12:33:41 +00:00
Chandler Carruth c0c0455f55 Teach Clang about PIE compilations. This is the first step of PR12380.
First, this patch cleans up the parsing of the PIC and PIE family of
options in the driver. The existing logic failed to claim arguments all
over the place resulting in kludges that marked the options as unused.
Instead actually walk all of the arguments and claim them properly.

We now treat -f{,no-}{pic,PIC,pie,PIE} as a single set, accepting the
last one on the commandline. Previously there were lots of ordering bugs
that could creep in due to the nature of the parsing. Let me know if
folks would like weird things such as "-fPIE -fno-pic" to turn on PIE,
but disable full PIC. This doesn't make any sense to me, but we could in
theory support it.

Options that seem to have intentional "trump" status (-static, -mkernel,
etc) continue to do so and are commented as such.

Next, a -pie-level flag is threaded into the frontend, rigged to
a language option, and handled preprocessor, setting up the appropriate
defines. We'll now have the correct defines when compiling with -fpie.

The one place outside of the preprocessor that was inspecting the PIC
level (as opposed to the relocation model, which is set and handled
separately, yay!) is in the GNU ObjC runtime. I changed it to exactly
preserve existing behavior. If folks want to change its behavior in the
face of PIE, they can do that in a separate patch.

Essentially the only functionality changed here is the preprocessor
defines and bug-fixes to the argument management.

Tests have been updated and extended to test all of this a bit more
thoroughly.

llvm-svn: 154291
2012-04-08 16:40:35 +00:00
Simon Atanasyan 571d7bde3c MIPS: Pass -mabi option to the assmbler when compile MIPS targets.
llvm-svn: 154270
2012-04-07 22:31:29 +00:00
Simon Atanasyan 3b7589a6c3 MIPS: Move code calculates CPU and ABI names to the separate function to reuse this function later.
llvm-svn: 154269
2012-04-07 22:09:23 +00:00
Chad Rosier 706c235013 [driver] In general, the driver claims redundant args and uses the last arg.
However, the '-x' option has special handling and wasn't following this
paradigm.  Fix it to do so by claiming the arg as we parse the '-x' option.
rdar://11203340

llvm-svn: 154231
2012-04-07 00:01:31 +00:00
Simon Atanasyan 1e1e2e2d9a MIPS: Provide a correct path to the dynamic linker when build for MIPS 64-bit targets.
llvm-svn: 154200
2012-04-06 20:14:27 +00:00
Simon Atanasyan 2390aa1813 MIPS: Pass -EB/-EL argument to the assembler according to selected endian when compile for MIPS targets.
llvm-svn: 154195
2012-04-06 19:15:24 +00:00
Chandler Carruth 69a125bf02 Fix using Clang as a cross compiler installed on a host machine and not
inside of a sysroot targeting a system+sysroot which is "similar" or
"compatible" with the host system. This shows up when trying to build
system images on largely compatible hardware as-if fully cross compiled.

The problem is that previously we *perfectly* mimiced GCC here, and it
turns out GCC has a bug that no one has really stumbled across. GCC will
try to look in thy system prefix ('/usr/local' f.ex.) into which it is
instaled to find libraries installed along side GCC that should be
preferred to the base system libraries ('/usr' f.ex.). This seems not
unreasonable, but it has a very unfortunate consequence when combined
with a '--sysroot' which does *not* contain the GCC installation we're
using to complete the toolchain. That results in some of the host
system's library directories being searched during the link.

Now, it so happens that most folks doing stuff like this use
'--with-sysroot' and '--disable-multilib' when configuring GCC. Even
better, they're usually not cross-compiling to a target that is similar
to the host. As a result, searching the host for libraries doesn't
really matter -- most of the time weird directories get appended that
don't exist (no arm triple lib directory, etc). Even if you're
cross-compiling from 32-bit to 64-bit x86 or vice-versa, disabling
multilib makes it less likely that you'll actually find viable libraries
on the host. But that's just luck. We shouldn't rely on this, and this
patch disables looking in the system prefix containing the GCC
installation if that system prefix is *outside* of the sysroot. For
empty sysroots, this has no effect. Similarly, when using the GCC
*inside* of the sysroot, we still track wherever it is installed within
the sysroot and look there for libraries. But now we can use a cross
compiler GCC installation outside the system root, and only look for the
crtbegin.o in the GCC installation, and look for all the other libraries
inside the system root.

This should fix PR12478, allowing Clang to be used when building
a ChromiumOS image without polluting the image with libraries from the
host system.

llvm-svn: 154176
2012-04-06 16:32:06 +00:00
Nico Weber bea0d04f8c Honor -fno-pic, -fno-PIC, -fno-pie, -fno-PIE.
Review at http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120402/055759.html

llvm-svn: 154064
2012-04-04 23:00:14 +00:00
Chad Rosier 45619cbc03 [driver] When using the -mfpmath= option, add an error message when trying to
enable neonfp on a CPU that doesn't support NEON.
rdar://11108618

llvm-svn: 154061
2012-04-04 22:13:40 +00:00
Simon Atanasyan fa4dbbf12a Test commit to check commit access.
llvm-svn: 154056
2012-04-04 21:22:57 +00:00
Chad Rosier d1717c1aed Whitespace.
llvm-svn: 154050
2012-04-04 20:56:36 +00:00
Chad Rosier cfbfc5827c [driver] Add a static helper function for handling -mfpu= to remove some code
duplication.  No functional change intended.

llvm-svn: 154049
2012-04-04 20:51:35 +00:00
David Blaikie 747ff7e194 Reduce variable scope.
llvm-svn: 154047
2012-04-04 20:43:14 +00:00
Chad Rosier 1f0e52e361 [driver] Create a new -mfpmath= option, which is used to control whether clang
uses Neon instructions for single-precision FP.

-mfpmath=neon is analogous to passing llc -mattr=+neonfp.
-mfpmath=[vfp|vfp2|vfp3|vfp4] is analogous to passing llc -mattr=-neonfp.

rdar://11108618

llvm-svn: 154046
2012-04-04 20:39:32 +00:00
Fariborz Jahanian 7ebeedea6c modern objc translator. Add more
rewriter specific option to cc1 with -rewrite-objc.
// rdar://11143173

llvm-svn: 154037
2012-04-04 18:50:28 +00:00
Fariborz Jahanian b248221686 Remove unused argument.
llvm-svn: 154035
2012-04-04 18:28:00 +00:00
Fariborz Jahanian 73223bbd0a Use -rewrite-legacy-objc as clang argument for translating
objective-c's fragile abi, Use -rewrite-objc for translating 
objective-c's modern abi.  // rdar://11143173

llvm-svn: 153877
2012-04-02 15:59:19 +00:00
Bob Wilson 0090df24d7 Ignore unused --serialize-diagnostics option when using llvm-gcc.
llvm-gcc doesn't handle --serialize-diagnostics so when compiling i386
kernel/kext code with -Werror, you get an error about that option being
unused.  Claim the argument to prevent this from breaking builds.
<rdar://problem/11161933>

llvm-svn: 153854
2012-04-01 23:03:29 +00:00
Jim Grosbach 903e63fef3 ARM backend knows about cortex-m4. The front end should too.
llvm-svn: 153678
2012-03-29 19:53:34 +00:00
Chandler Carruth 8b4140d712 Move the emission of strict enum range metadata behind a flag (the same
flag as GCC uses: -fstrict-enums). There is a *lot* of code making
unwarranted assumptions about the underlying type of enums, and it
doesn't seem entirely reasonable to eagerly break all of it.

Much more importantly, the current state of affairs is *very* good at
optimizing based upon this information, which causes failures that are
very distant from the actual enum. Before we push for enabling this by
default, I think we need to implement -fcatch-undefined-behavior support
for instrumenting and trapping whenever we store or load a value outside
of the range. That way we can track down the misbehaving code very
quickly.

I discussed this with Rafael, and currently the only important cases he
is aware of are the bool range-based optimizations which are staying
hard enabled. We've not seen any issue with those either, and they are
much more important for performance.

llvm-svn: 153550
2012-03-27 23:58:37 +00:00
Chad Rosier 4fab82cda6 [driver] Fix unused argument warnings.
1. Don't short-circuit conditional statements that are checking flags.
Otherwise, the driver emits warnings about unused arguments.

2. -mkernel and -fapple-kext imply no exceptions, so claim exception related
 arguments now to avoid warnings about unused arguments.

rdar://11120518

llvm-svn: 153478
2012-03-26 22:04:46 +00:00
Chad Rosier d9d80e0844 [driver] -mkernel implies -fno-common, so claim the arg to avoid an unused
argument warning.
Part of rdar://11120518

llvm-svn: 153470
2012-03-26 21:35:40 +00:00
Chad Rosier f27e1c40dd [driver] -mkernel implies -fno-builtin, so claim the arg to avoid an unused
argument warning.
Part of rdar://11120518

llvm-svn: 153469
2012-03-26 21:29:17 +00:00
Akira Hatanaka 6976ec8551 Add support for MIPS' floating ABIs (hard, soft and single) to clang driver.
Patch by Simon Atanasyan.

llvm-svn: 153348
2012-03-23 23:07:09 +00:00
Bob Wilson 7f05ca38e4 Duplicated code is bad. At least make it consistent.
The getARMTargetCPU and getLLVMArchSuffixForARM functions exist in both
Toolchain.cpp and Tools.cpp.  This stuff needs a thorough overhaul.  In the
meantime, this patch at least makes them consistent.  One version had been
converted to use StringSwitch, and the other version had new Cortex M-series
processors added.

llvm-svn: 153202
2012-03-21 17:19:12 +00:00
Bob Wilson cc4ab9d9c0 For Darwin, do not let -mcpu override the -arch option. <rdar://11059238>
On Darwin the architecture and the corresponding Mach-O slice is typically
specified with -arch.  If not, it defaults to the current host architecture.
Do not use -mcpu to override the -arch value.  This is only an issue when
people need to use specialized code for a non-default CPU (hopefully guarded
by run-time checks to detect the current processor).  The -mcpu option is
still used for the -target-cpu option to clang, but this patch causes it to
not be used to set the architecture in the target triple.

llvm-svn: 153197
2012-03-21 16:31:37 +00:00
Nico Weber 8935578528 Fix a regression where ':' in CPLUS_INCLUDE_PATH and friends would no longer separate paths.
This regressed in r152583. Also add a test to make sure it doesn't regress again.

llvm-svn: 153034
2012-03-19 15:00:03 +00:00
Chad Rosier 9c76d24f9c [frontend] Fix how the frontend handles -fno-inline. AFAIK clang now matches
the behavior of gcc with respect to the -fno-inline and -fno-inline-functions
flags.

llvm-svn: 152861
2012-03-15 22:31:42 +00:00
David Blaikie ebcbe4b6aa Reapply r152745 (reverted in 152765) now that compiler-rt is fixed.
Original commit message:

Provide -Wnull-conversion separately from -Wconversion.

Like GCC, provide a NULL conversion to non-pointer conversion as a separate
flag, on by default. GCC's flag is "conversion-null" which we provide for
cross compatibility, but in the interests of consistency (with
-Wint-conversion, -Wbool-conversion, etc) the canonical Clang flag is called
-Wnull-conversion.

Patch by Lubos Lunak.
Review feedback by myself, Chandler Carruth, and Chad Rosier.

llvm-svn: 152774
2012-03-15 04:50:32 +00:00
Chad Rosier 2860fbb747 Revert r152745 as it's breaking the internal buildbots.
Abbreviated commit message:
Provide -Wnull-conversion separately from -Wconversion.

llvm-svn: 152765
2012-03-15 01:00:38 +00:00
David Blaikie 1ce8dbb93f Provide -Wnull-conversion separately from -Wconversion.
Like GCC, provide a NULL conversion to non-pointer conversion as a separate
flag, on by default. GCC's flag is "conversion-null" which we provide for
cross compatibility, but in the interests of consistency (with
-Wint-conversion, -Wbool-conversion, etc) the canonical Clang flag is called
-Wnull-conversion.

Patch by Lubos Lunak.
Review feedback by myself, Chandler Carruth, and Chad Rosier.

llvm-svn: 152745
2012-03-14 22:28:22 +00:00
Chad Rosier 864dfe11bd [driver] Clang should report an error for -faltivec on non-ppc.
rdar://10963572

llvm-svn: 152684
2012-03-13 23:45:51 +00:00
Chad Rosier d6f716ab2a [driver] Parse diagnostic args in the driver.
Previously, only diagnostics thrown by the cc1 process were
actually honoring the diagnostic options given on the command line,
like -Werror.

Reuse the existing code in Frontend currently used for cc1,
adjusting it to not interpret -Wl, linker flags as warnings.

Also fix a faulty test exposed by this change.
It wasn't actually testing anything, and was giving this warning:

clang-3: warning: argument unused during compilation: '-verify'

Which -Werror didn't turn into an error because it was output
by the driver, not the cc1 process, and diagnostic options
weren't parsed by the driver. And you couldn't see the warning
when running the test suite.

Fixes PR12181.
Patch by Dylan Noblesmith <nobled@dreamwidth.org>.

llvm-svn: 152660
2012-03-13 20:09:56 +00:00
David Chisnall ddc4c9d0a7 Tweak linkage order for solaris.
llvm-svn: 152627
2012-03-13 14:14:54 +00:00
NAKAMURA Takumi b5ee8a6deb [msvc] Honor %INCLUDE%. It should know essential search paths with vcvarsall.bat.
FYI,

On VS10, %INCLUDE% contains;
(VS10)\VC\INCLUDE
(VS10)\VC\ATLMFC\INCLUDE
(SDK70A)\include

On VS11,
(VS11)\VC\INCLUDE
(VS11)\VC\ATLMFC\INCLUDE
(SDK80)\include\shared
(SDK80)\include\um
(SDK80)\include\winrt

FIXME: It may be enabled also on mingw.
llvm-svn: 152589
2012-03-13 00:02:21 +00:00
Bill Wendling c0938f3fdb Address some of the concerns by Chandler.
* s/AddDirectoryList/addDirectoryList/
* Move the call to ::getenv into the function.
* FileCheck-ize the testcase.

llvm-svn: 152583
2012-03-12 22:10:06 +00:00
Bill Wendling adbeb9f38d Update FIXME.
llvm-svn: 152579
2012-03-12 21:24:57 +00:00
Bill Wendling 281ca2917b Have clang pay attention to the LIBRARY_PATH environment variable.
The LIBRARY_PATH environment variable should be honored by clang. Have the
driver pass the directories to the linker.
<rdar://problem/9743567> and PR10296.

llvm-svn: 152578
2012-03-12 21:22:35 +00:00
Benjamin Kramer ddefa6d925 Use VersionTuple to manage macosx versions in the driver. No functionality change.
llvm-svn: 152504
2012-03-10 20:55:36 +00:00
Nico Weber 97bd94bd98 Update comment after r152140. Clarify a bit too.
llvm-svn: 152441
2012-03-09 21:19:44 +00:00
Anna Zaks 0af3e06ff6 [analyzer] Rework inlining related command line options.
- Remove -analyzer-inline-call.
 - Add -analyzer-ipa=[none|inlining]
 - Add -analyzer-inlining-mode to allow experimentation for
different performance tuning methods.

llvm-svn: 152351
2012-03-08 23:16:35 +00:00
Rafael Espindola c41db927f3 Implement -fno-dwarf2-cfi-asm on linux too.
llvm-svn: 152316
2012-03-08 14:39:55 +00:00
Chad Rosier bee5a1df03 [driver] Don't try to generate diagnostic information for linker crashes.
rdar://10993648

llvm-svn: 152180
2012-03-07 00:30:40 +00:00
Chad Rosier 1aeb15adf5 Whitespace.
llvm-svn: 152159
2012-03-06 23:14:35 +00:00
Chad Rosier 64d6be979f [driver] What was implemented in r152130 was actually -fno-inline-functions, not
-fno-inline.
Part of rdar://10972766

llvm-svn: 152145
2012-03-06 21:17:19 +00:00
Ted Kremenek f7639e1b4a Add new code migrator support for migrating existing Objective-C code to use
the new Objective-C NSArray/NSDictionary/NSNumber literal syntax.

This introduces a new library, libEdit, which provides a new way to support
migration of code that improves on the original ARC migrator.  We now believe
that most of its functionality can be refactored into the existing libraries,
and thus this new library may shortly disappear.

llvm-svn: 152141
2012-03-06 20:06:33 +00:00
Ted Kremenek d151dde0e6 Enable default @synthesize by default.
llvm-svn: 152140
2012-03-06 20:06:15 +00:00
Ted Kremenek e65b086e07 Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,
NSNumber, and boolean literals.  This includes both Sema and Codegen support.
Included is also support for new Objective-C container subscripting.

My apologies for the large patch.  It was very difficult to break apart.
The patch introduces changes to the driver as well to cause clang to link
in additional runtime support when needed to support the new language features.

Docs are forthcoming to document the implementation and behavior of these features.

llvm-svn: 152137
2012-03-06 20:05:56 +00:00
Chad Rosier 806031896d [driver] Add support for -fno-inline.
rdar://10972766

llvm-svn: 152130
2012-03-06 18:49:20 +00:00
Anna Zaks d5c3027473 [analyzer] Turn inlining on by default for better testing exposure.
Fix a test, which was most likely an unintended recursive call.

llvm-svn: 151848
2012-03-01 22:37:46 +00:00
Kostya Serebryany 28a7a1198b Add a flag -fthread-sanitizer.
This flag enables ThreadSanitizer instrumentation committed to llvm as r150423.
The patch includes one test for -fthread-sanitizer and one similar test for -faddress-sanitizer.
This patch does not modify the linker flags (as we do it for -faddress-sanitizer) because the run-time library is not yet
committed and it's structure in compiler-rt is not 100% clear.
The users manual wil be changed in a separate commit.

llvm-svn: 151846
2012-03-01 22:27:08 +00:00
David Chisnall 272a071d65 Add -C when linking on Solaris so that the error messages are understandable by actual humans.
llvm-svn: 151726
2012-02-29 15:06:12 +00:00
Argyrios Kyrtzidis 3dbeb55874 [driver] Emit an error when trying to use ARC on macosx earlier than 10.6
rdar://10459258

llvm-svn: 151706
2012-02-29 03:43:52 +00:00
David Chisnall c73fb894af Add -lm by default on Solaris.
llvm-svn: 151653
2012-02-28 20:06:45 +00:00
David Chisnall e0a7c28627 It turns out -fno-cxa-atexit just produces broken code, so disable it on Solaris and we'll ship a __cxa_atexit implementation...
llvm-svn: 151648
2012-02-28 19:15:06 +00:00
David Chisnall 0c52c0f0fd Some more Solaris fixes. Now successfully building libc++ on Solaris with clang (and linking clang against it).
llvm-svn: 151632
2012-02-28 17:10:04 +00:00
Jim Grosbach 2e16624291 Re-enable the Darwin ARM integrated assembler.
All known nightly-test failures are fixed.

llvm-svn: 151595
2012-02-27 23:55:25 +00:00
Chandler Carruth 2e9d731761 A follow-up to r151482 which added support for powerpc and powerpc64
Debian multiarch libraries, this should in theory add support for those
platform's header search rules. I don't have a system to check this
with, so review appreciated. I've added the corresponding tests
referring to the debian multiarch tree.

We are starting to have a relatively completely tested Linux platform
for header search and library search, with several interesting
peculiarities. We should point people at the debian_multiarch_tree when
suggesting new tests. Folks with Debian systems that can check this for
correctness, it would be much appreciated. The missing chunks I know of
are testing bi-arch peudo-cross-compiling toolchains betwen 32-bit and
64-bit variants of platforms, and the MIPS and ARM Debian toolchains.

llvm-svn: 151484
2012-02-26 09:21:43 +00:00
Chandler Carruth af3c2090b4 Add support for PPC and PPC64 multiarch toolchains on Debain.
Patch from Michel Dänzer, sent our way via Jeremy Huddleston who added
64-bit support. I just added one other place where powerpc64-linux-gnu
was missing (we only had powerpc64-unknown-linux-gnu).

I've also added a tree to test out the debian multiarch stuff. I don't
use debian regularly, so I'm not certain this is entirely accurate. If
anyone wants to check it against a debian system and fix any
inaccuracies, fire away. This way at least folks can see how this is
*supposed* to be tested.

It'd be particularly good to get the Debian MIPS toolchains tested in
this way.

llvm-svn: 151482
2012-02-26 09:03:21 +00:00
Chad Rosier 4c5c8ccf40 Temporarily revert r151288:
ARM: enable the integrated assembler by default for Darwin. 

llvm-svn: 151454
2012-02-25 20:32:43 +00:00
Jim Grosbach 1d43ca99e2 ARM: enable the integrated assembler by default for Darwin.
llvm-svn: 151288
2012-02-23 21:55:04 +00:00
Joerg Sonnenberger 17d7551e73 Revert part of r148839 and keep DefaultTargetTriple in the form adjusted
by -target and similar options. As discussed in PR 12026, the change
broke support for target-prefixed tools, i.e. calling x86_64--linux-ld
when compiling for x86_64--linux. Improve the test cases added
originally in r149083 to not require execution, just executable files.
Document the hack with appropiate FIXME comments.

llvm-svn: 151185
2012-02-22 19:15:16 +00:00
Chad Rosier ce975d9997 [driver] Add a warning for when -mcpu= is specified without an argument. There
are likely many other OPT_xxxx_EQ options that could/should be added here.
rdar://10704648

llvm-svn: 151174
2012-02-22 17:55:22 +00:00
Chad Rosier 877c0a27f8 Provide a way to disable auto-generation of preprocessed files during clang
crash.  This can speedup the process of generating a delta reduced test case.
rdar://10905465

llvm-svn: 151109
2012-02-22 00:30:39 +00:00
Aaron Ballman 232c4f50ba Fixing the working-directory option so that it stores the proper directory.
llvm-svn: 150960
2012-02-20 14:13:25 +00:00
Rafael Espindola 1af7c219c7 Implement a -gcc-toolchain command line option that does the same as
configure's --with-gcc-toolchain. The configure option is now just a default
value for the command line one.

llvm-svn: 150898
2012-02-19 01:38:32 +00:00
David Chisnall c616e95162 Default to not using __cxa_atexit on Solaris.
llvm-svn: 150883
2012-02-18 17:00:56 +00:00
David Chisnall 96de9933fb Tweak link order on Solaris so that global ctors work.
llvm-svn: 150696
2012-02-16 16:00:47 +00:00
David Blaikie 040a3a28f1 Remove the unuseful -fdiagnostics-show-name
This option was added in r129614 and doesn't have any use case that I'm aware
of. It's possible that external tools are using these names - and if that's
the case we can certainly reassess the functionality, but for now it lets us
shave out a few unneeded bits from clang.

Move the "StaticDiagNameIndex" table into the only remaining consumer, diagtool.
This removes the actual diagnostic name strings from clang entirely.

Reviewed by Chris Lattner & Ted Kremenek.

llvm-svn: 150612
2012-02-15 19:45:34 +00:00
David Chisnall 1026fb0797 Add some Solaris include paths and fix a -lgcc_eh that apparently should be -lgcc_s.
llvm-svn: 150602
2012-02-15 18:24:31 +00:00
David Chisnall a9ed5d76b4 Fix copy-and-paste error in comment
llvm-svn: 150587
2012-02-15 16:25:46 +00:00
David Chisnall f571cde869 First pass at Solaris toolchain support. This version compiles and links hello
world on Solaris 11 for both x86 and x86-64 using the built-in assembler and
Solaris (not GNU) ld, however it currently relies on a hard-coded GCC location
to find crtbegin.o and crtend.o, as well as libgcc and libgcc_eh.  

llvm-svn: 150580
2012-02-15 13:39:01 +00:00
Dylan Noblesmith 4d9cbffbe2 include clang's config.h unconditionally (v2)
And remove HAVE_CLANG_CONFIG_H, now that the header is generated
in the autoconf build, too.

Reverts r149571/restores r149504, now that config.h is generated
correctly by LLVM's configure in all build configurations.

llvm-svn: 150487
2012-02-14 15:54:49 +00:00
Chad Rosier 636d283202 When generating diagnostic information due to a clang failure, allow multiple
-arch options if the're all the same.

Patch by Jeremy Huddleston.
rdar://10849701

llvm-svn: 150403
2012-02-13 18:16:28 +00:00
Chandler Carruth 779579b332 Delete a simplistic helper function now that llvm::Triple can provide
this functionality.

llvm-svn: 150358
2012-02-13 02:02:09 +00:00
Chandler Carruth 9b5f8ddcf8 Begin refactoring to use the newly added triple predicates for
simplicity. Also addresses a FIXME, although not one that could be
observed.

llvm-svn: 150294
2012-02-11 03:31:12 +00:00
Jim Grosbach 576452b830 Have the driver pass CPU and target feature information to cc1as.
When creating the MCSubtargetInfo, the assembler driver uses the CPU and
feature string to construct a more accurate model of what instructions
are and are not legal.

rdar://10840476

llvm-svn: 150273
2012-02-10 20:37:10 +00:00
David Blaikie c8233cb740 Correct comment Clang C++ use in production.
This was from way-back-when (r82583) when Clang's C++ support wasn't prime-time
yet. Production quality C++ was tested experimentally from r100119 and turned
on by default in r141063.

Patch by Justin Bogner.

llvm-svn: 150148
2012-02-09 03:57:02 +00:00
Bob Wilson 7ecbd32e4e Filter a few more options not recognized by gcc. <rdar://problem/10814020>
These are new options that gcc doesn't recognize so the clang driver needs
to remove them when it falls back to invoking gcc.

llvm-svn: 149951
2012-02-07 01:17:55 +00:00
Eric Christopher 65c05fa79c Rewrite the debug action handling to take -verify into account.
Add a quiet option for dwarfdump and move it out of NDEBUG only.
Still requires an option as we don't want this on by default.

llvm-svn: 149894
2012-02-06 19:43:51 +00:00
Eric Christopher 3622221c87 Update the command line here and update the comment, we're just going
to leave this as a debug only option for now.

llvm-svn: 149890
2012-02-06 19:13:09 +00:00
Benjamin Kramer 3bb42f38f4 - Turn the other distribution checks into range compares.
- Turn openSUSE version parsing into a StringSwitch
- Add an entry for Fedora release 16 (Verne)

llvm-svn: 149872
2012-02-06 15:33:06 +00:00
Benjamin Kramer 7c3f09d416 Consolidate the ubuntu detection logic a bit, add an entry for Ubuntu 12.04 aka precise pangolin.
llvm-svn: 149869
2012-02-06 14:36:09 +00:00
Dylan Noblesmith 2c1dd2716a Basic: import SmallString<> into clang namespace
(I was going to fix the TODO about DenseMap too, but
that would break self-host right now. See PR11922.)

llvm-svn: 149799
2012-02-05 02:13:05 +00:00
Dylan Noblesmith e27789991d Basic: import OwningPtr<> into clang namespace
llvm-svn: 149798
2012-02-05 02:12:40 +00:00
Bob Wilson 14adb360a7 Fix -ftrap-function fallout from llvm r145714. <rdar://problem/10799325>
That llvm change removed the -trap-func backend option, so that using
-ftrap-function with clang would cause the backend to complain.  Fix it
by adding the trap function name to the CodeGenOptions and passing it through
to the TargetOptions.

llvm-svn: 149679
2012-02-03 06:27:22 +00:00
Rafael Espindola c29af947d6 Replace the old --with-cxx-* configure options with a single --with-gcc-toolchain
that just uses the new toolchain probing logic. This fixes linking with -m32 on
64 bit systems (the /32 dir was not being added to the search).

llvm-svn: 149652
2012-02-03 01:01:20 +00:00
Dylan Noblesmith 4f4e745725 back out r149504
Too many weird build failures.

llvm-svn: 149571
2012-02-02 00:40:14 +00:00
Dylan Noblesmith 86780e906b include clang's config.h unconditionally
And remove HAVE_CLANG_CONFIG_H, now that the header is generated
in the autoconf build, too. (clang r149497 / llvm r149498)

Also include the config.h header after all other headers, per
the LLVM coding standards.

It also turns out WindowsToolChain.cpp wasn't using the config
header at all, so that include's just deleted now.

llvm-svn: 149504
2012-02-01 14:25:28 +00:00
Bob Wilson a223401498 Use new Triple::getMacOSXVersion function.
llvm-svn: 149439
2012-01-31 22:43:59 +00:00
Bob Wilson 9d3f7af8c3 Fix more fallout from the introduction of "macosx" and "ios" triples.
The Darwin toolchain constructor was assuming that all Darwin triples would
have an OS string starting with "darwin".  Triples starting with "macosx"
would misinterpret the version number, and "ios" triples would completely
miss the version number (or worse) because the OS name is not 6 characters
long.  We lose some sanity checking of triple strings here, since the
Triple.getOSVersion function doesn't do all the checking that the previous
code did, but this still seems like a step in the right direction.

llvm-svn: 149422
2012-01-31 21:30:03 +00:00
Chandler Carruth d7fa2e04f6 Revert r149083 which is not the direction we're going in the Clang
driver based on discussions with Doug Gregor. There are several issues:
1) The patch was not reviewed prior to commit and there were review comments.
2) The design of the functionality (triple-prefixed tool invocation)
   isn't the design we want for Clang going forward: it focuses on the
   "user triple" rather than on the "toolchain triple", and forces that
   bit of state into the API of every single toolchain instead of
   handling it automatically in the common base classes.
3) The tests provided are not stable. They fail on a few Linux variants
   (Gentoo among them) and on mingw32 and some other environments.

I *am* interested in the Clang driver being able to invoke
triple-prefixed tools, but we need to design that feature the right way.
This patch just extends the previous hack without fixing the underlying
problems with it. I'm working on a new design for this that I will mail
for review by tomorrow.

I am aware that this removes functionality that NetBSD relies on, but
this is ToT, not a release. This functionality hasn't been properly
designed, implemented, and tested yet. We can't "regress" until we get
something that really works, both with the immediate use cases and with
long term maintenance of the Clang driver.

For reference, the original commit log:
Keep track of the original target the user specified before
normalization. This used to be captured in DefaultTargetTriple and is
used for the (optional) $triple-$tool lookup for cross-compilation.
Do this properly by making it an attribute of the toolchain and use it
in combination with the computed triple as index for the toolchain
lookup.

llvm-svn: 149337
2012-01-31 02:21:20 +00:00
Anna Zaks 58cc6cabe5 [analyzer] Rename the checker as per Ted's comment. Remove the reference
from the driver.

llvm-svn: 149276
2012-01-30 21:14:16 +00:00
Joerg Sonnenberger d64c60e534 Remove the ToolTriple logic in NetBSD, which was completely broken by
the recent refactoring. All interesting NetBSD release have a GNU as
version on i386 that supports --32, so don't bother with the conditional
setting of it.

llvm-svn: 149087
2012-01-26 22:27:52 +00:00
Joerg Sonnenberger f8ce8575aa Remove obviously incorrect branch.
llvm-svn: 149084
2012-01-26 21:58:37 +00:00
Joerg Sonnenberger 91960f4abb Keep track of the original target the user specified before
normalization. This used to be captured in DefaultTargetTriple and is
used for the (optional) $triple-$tool lookup for cross-compilation.
Do this properly by making it an attribute of the toolchain and use it
in combination with the computed triple as index for the toolchain
lookup.

llvm-svn: 149083
2012-01-26 21:56:28 +00:00
Bob Wilson 269e6377dd Revert r148249: "Make the auto-detection hack for the iOS simulator set the target triple correctly."
There were some problems with this, so I'm backing it out for now.

llvm-svn: 149040
2012-01-26 03:37:03 +00:00
Ted Kremenek 37e965221c Enable several checkers under --analyze for general testing.
llvm-svn: 149016
2012-01-26 02:27:38 +00:00
Chandler Carruth 0b1756b880 Reintroduce r148981 with significantly improved regression test. Now it
both actually tests what it wants to, doesn't have bogus and broken
assertions in it, and is also formatted much more cleanly and
consistently. Probably still some more that can be improved here, but
its much better.

Original commit message:
----
Try to unbreak the FreeBSD toolchain's detection of 32-bit targets
inside a 64-bit freebsd machine with the 32-bit compatibility layer
installed. The FreeBSD image always has the /usr/lib32 directory, so
test for the more concrete existence of crt1.o. Also enhance the tests
for freebsd to clarify what these trees look like and exercise the new
code.

Thanks to all the FreeBSD folks for helping me understand what caused
the failure and how we might fix it. =] That helps a lot. Also, yay
build bots.

llvm-svn: 149011
2012-01-26 01:35:15 +00:00
Argyrios Kyrtzidis e8be6652ce Revert r148981 because it fails test/Driver/freebsd.c
Original log:

Author: chandlerc <chandlerc@91177308-0d34-0410-b5e6-96231b3b80d8>
Date:   Wed Jan 25 21:32:31 2012 +0000

    Try to unbreak the FreeBSD toolchain's detection of 32-bit targets
    inside a 64-bit freebsd machine with the 32-bit compatibility layer
    installed. The FreeBSD image always has the /usr/lib32 directory, so
    test for the more concrete existence of crt1.o. Also enhance the tests
    for freebsd to clarify what these trees look like and exercise the new
    code.

    Thanks to all the FreeBSD folks for helping me understand what caused
    the failure and how we might fix it. =] That helps a lot. Also, yay
    build bots.

llvm-svn: 148993
2012-01-25 22:55:16 +00:00
Chandler Carruth 143f2f6e37 Try to unbreak the FreeBSD toolchain's detection of 32-bit targets
inside a 64-bit freebsd machine with the 32-bit compatibility layer
installed. The FreeBSD image always has the /usr/lib32 directory, so
test for the more concrete existence of crt1.o. Also enhance the tests
for freebsd to clarify what these trees look like and exercise the new
code.

Thanks to all the FreeBSD folks for helping me understand what caused
the failure and how we might fix it. =] That helps a lot. Also, yay
build bots.

llvm-svn: 148981
2012-01-25 21:32:31 +00:00
Chandler Carruth cf705b21e2 Restore a tiny bit of functionality that I completely overlooked in the
Linux toolchain selection -- sorry folks. =] This should fix the Hexagon
toolchain.

However, I would point out that I see why my testing didn't catch this
-- we have no tests for Hexagon. ;]

llvm-svn: 148977
2012-01-25 21:03:58 +00:00
Chandler Carruth f7bf3db070 The Linux pattern of adding all the search paths that exist doesn't seem
to suit the FreeBSD folks. Take them back to something closer to the old
behavior. We test whether the /usr/lib32 directory exists (within the
SysRoot), and use it if so, otherwise use /usr/lib.

FreeBSD folks, let me know if this causes any problems, or if you have
further tweaks.

llvm-svn: 148953
2012-01-25 11:24:24 +00:00
Chandler Carruth 1ccbed88fc Remove the 'ToolTriple' concept from the NetBSD toolchain along with my
gross hack to provide it from my previous patch removing HostInfo. This
was enshrining (and hiding from my searches) the concept of storing and
diff-ing the host and target triples. We don't have the host triple
reliably available, so we need to merely inspect the target system. I've
changed the logic in selecting library search paths for NetBSD to match
what I provided for FreeBSD -- we include both search paths, but put the
32-bit-on-64-bit-host path first so it trumps.

NetBSD maintainers, you may want to tweak this, or feel free to ask me
to tweak it. I've left a FIXME here about the challeng I see in fixing
this properly.

llvm-svn: 148952
2012-01-25 11:18:20 +00:00
Chandler Carruth 2886ba2352 Delete still more remnants of the now dead HostInfo. The janitoring will
continue until cleanliness improves.

llvm-svn: 148951
2012-01-25 11:03:35 +00:00
Chandler Carruth 2ad5de1f72 Delete the driver's HostInfo class. This abstraction just never really
did anything. The two big pieces of functionality it tried to provide
was to cache the ToolChain objects for each target, and to figure out
the exact target based on the flag set coming in to an invocation.
However, it had a lot of flaws even with those goals:
 - Neither of these have anything to do with the host, or its info.
 - The HostInfo class was setup as a full blown class *hierarchy* with
   a separate implementation for each "host" OS. This required
   dispatching just to create the objects in the first place.
 - The hierarchy claimed to represent the host, when in fact it was
   based on the target OS.
 - Each leaf in the hierarchy was responsible for implementing the flag
   processing and caching, resulting in a *lot* of copy-paste code and
   quite a few bugs.
 - The caching was consistently done based on architecture alone, even
   though *any* aspect of the targeted triple might change the behavior
   of the configured toolchain.
 - Flag processing was already being done in the Driver proper,
   separating the flag handling even more than it already is.

Instead of this, we can simply have the dispatch logic in the Driver
which previously created a HostInfo object create the ToolChain objects.
Adding caching in the Driver layer is a tiny amount of code. Finally,
pulling the flag processing into the Driver puts it where it belongs and
consolidates it in one location.

The result is that two functions, and maybe 100 lines of new code
replace over 10 classes and 800 lines of code. Woot.

This also paves the way to introduce more detailed ToolChain objects for
various OSes without threading through a new HostInfo type as well, and
the accompanying boiler plate. That, of course, was the yak I started to
shave that began this entire refactoring escapade. Wheee!

llvm-svn: 148950
2012-01-25 11:01:57 +00:00
Chandler Carruth b65b111d24 Switch the ToolChain types to all store a Driver reference rather than
a HostInfo reference. Nothing about the HostInfo was used by any
toolchain except digging out the driver from it. This just makes that
a lot more direct. The change was accomplished entirely mechanically.
It's one step closer to removing the shim full of buggy copy/paste code
that is HostInfo.

llvm-svn: 148945
2012-01-25 09:12:06 +00:00
Chandler Carruth cb91619e5c Remove the TargetTriple object that I added to the Driver recently. This
helped stage the refactoring of things a bit, but really isn't the right
place for it. The driver may be responsible for compilations with many
different targets. In those cases, having a target triple in the driver
is actively misleading because for many of those compilations that is
not actually the triple being targeted.

This moves the last remaining users of the Driver's target triple to
instead use the ToolChain's target triple. The toolchain has a single,
concrete target it operates over, making this a more stable and natural
home for it.

llvm-svn: 148942
2012-01-25 08:49:21 +00:00
Chandler Carruth 25442b8e72 Have FreeBSD use even more of the same smarts as Linux is now using for
adding search paths. Add them only when they exist, and prefix the paths
with the sysroot. This will allow targeting a FreeBSD sysroot on
a non-FreeBSD host machine, and perhaps more importantly should allow
testing the FreeBSD driver's behavior similarly to the Linux tests with
a fake tree of files in the regression test suite.

I don't have FreeBSD systems handy to build up the list of files that
should be used here, but this is the basic functionality and I'm hoping
Roman or someone from the community can contribute the actual test
cases.

llvm-svn: 148940
2012-01-25 08:10:33 +00:00
Chandler Carruth f4826e28b9 Switch FreeBSD to just include both '/usr/lib32' and '/usr/lib' in the
search paths for 32-bit targets. This avoids having to detect which is
expected for the target system, and the linker should DTRT, and take the
32-bit libraries from the first one when applicable. Thanks to Roman
Divacky for sanity checking this.

llvm-svn: 148939
2012-01-25 08:04:15 +00:00
Chandler Carruth a1f1fd3b60 Switch the Linux C++ standard library header search logic over to use
the GCC installation's multiarch suffix now that it is exposed.

llvm-svn: 148938
2012-01-25 08:04:13 +00:00
Chandler Carruth 866faab4db Make a major refactoring to how the GCC installation detection works.
The fundamental shift here is to stop making *any* assumptions about the
*host* triple. Where these assumptions you ask? Why, they were in one of
the two target triples referenced of course. This was the single biggest
place where the previously named "host triple" was actually used as
such. ;] The reason we were reasoning about the host is in order to
detect the use of '-m32' or '-m64' flags to change the target. These
flags shift the default target only slightly, which typically means
a slight deviation from the host. When using these flags, the GCC
installation is under a different triple from the one actually targeted
in the compilation, and we used the host triple to find it.

Too bad that wasn't even correct. Consider an x86 Linux host which has
a PPC64 cross-compiling GCC toolchain installed. This toolchain is also
configured for multiarch compiling and can target PPC32 with eth '-m32'
flag. When targeting 'powerpc-linux-gnu' or some other PPC32 triple, we
have to look for the PPC64 variant of the triple to find the GCC
install, and that triple is neither the host nor target.

The new logic computes the multiarch's alternate triple from the target
triple, and looks under both sides. It also looks more aggressively for
the correct subdirectory of the GCC installation, and exposes the
subdirectory in a nice programmatic way. This '/32' or '/64' suffix is
something we can reuse in many other parts of the toolchain.

An important note -- while this likely fixes a large category of
cross-compile use cases, that's not my primary goal, and I've not done
testing (or added test cases) for scenarios that may now work. If
someone else wants to try more interesting PPC cross compiles, I'd love
to have reports. But my focus is on factoring away the references to the
"host" triple. The refactoring is my goal, and so I'm mostly relying on
the existing (pretty good) test coverage we have here.

Future patches will leverage this new functionality to factor out more
and more of the toolchain's triple manipulation.

llvm-svn: 148935
2012-01-25 07:21:38 +00:00
Chandler Carruth 96bae7b1fd Fix one of the (larger) FIXMEs where we were misusing the Driver's idea
of the target triple to stand in for the "host" triple.

Thanks to a great conversation with Richard Smith, I'm now much more
confident in how this is proceeding. In all of the places where we
currently reason about the "host" architecture or triple, what we really
want to reason about in the detected GCC installation architecture or
triple, and the ways in which that differs from the target. When we find
a GCC installation with a different triple from our target *but capable
of targeting our target* through an option such as '-m64', we want to
detect *that* case and change the paths within the GCC installation (and
libstdc++ installation) to reflect this difference.

This patch makes one function do this correctly. Subsequent commits will
hoist the logic used here into the GCCInstallation utility, and then
reuse it through the rest of the toolchains to fix the remaining places
where this is currently happening.

llvm-svn: 148852
2012-01-24 20:08:17 +00:00
Chandler Carruth 4d9d76839a Address one part of the FIXME I introduced my switching the triple
inside of GCCInstallation to be a proper llvm::Triple. This is still
a touch ugly because we have to use it as a string in so many places,
but I think on the whole the more structured representation is better.

Comments of course welcome if this tradeoff isn't working for folks.

llvm-svn: 148843
2012-01-24 19:28:29 +00:00
Chandler Carruth 64cee06504 At least within these classes, consistently spell 'GCC' as 'GCC'.
I can't read Java-style 'Gcc' acronyms. ;]

No functionality changed.

llvm-svn: 148840
2012-01-24 19:21:42 +00:00
Chandler Carruth 46f204fef8 Start hoisting the logic for computing the target triple into its own
function. The logic for this, and I want to emphasize that this is the
logic for computing the *target* triple, is currently scattered
throughout various different HostInfo classes ToolChain factoring
functions. Best part, it is largely *duplicated* there. The goal is to
hoist all of that up to here where we can deal with it once, and in
a consistent manner.

Unfortunately, this uncovers more fun problems: the ToolChains assume
that the *actual* target triple is the one passed into them by these
factory functions, while the *host* triple is the one in the driver.
This already was a lie, and a damn lie, when the '-target' flag was
specified. It only really worked when the difference stemmed from '-m32'
and '-m64' flags. I'll have to fix that (and remove all the FIXMEs I've
introduced here to document the problem) before I can finish hoisting
the target-calculation logic.

It's bugs all the way down today it seems...

llvm-svn: 148839
2012-01-24 19:17:46 +00:00
Chandler Carruth 7f1417f7cf Remove HostInfo::useDriverDriver(). This was only used in two places
inside the innards of the Driver implementation, and only ever
implemented to return 'true' for the Darwin OSes. Instead use a more
direct query on the target triple and a comment to document why the
target matters here.

If anyone is worried about this predicate getting wider use or improper
use, I can make it a local or private predicate in the driver.

llvm-svn: 148797
2012-01-24 10:43:44 +00:00
Chandler Carruth 4d73703ffd Hoist the targeted triple object into an actual object in the Driver.
The Driver has a fixed target, whether we like it or not, the
DefaultTargetTriple is not a default. This at least makes things more
honest. I'll eventually get rid of most (if not all) of
DefaultTargetTriple with this proper triple object. Bit of a WIP.

llvm-svn: 148796
2012-01-24 10:21:46 +00:00
Nick Lewycky 1c8c436a85 Add support for -fno-optimize-sibling-calls. Currently only implemented in the
X86 backend in LLVM.

llvm-svn: 148689
2012-01-23 08:29:12 +00:00
NAKAMURA Takumi 44193b732e [Cygwin] Abandon Cygwin-1.5 and g++-3. Use g++-4.3 and higher on Cygwin-1.7.
llvm-svn: 148636
2012-01-21 14:46:01 +00:00
Sebastian Pop 422377cfd3 rename -ccc-host-triple into -target
llvm-svn: 148582
2012-01-20 22:01:23 +00:00
Ted Kremenek b9ff6b2302 Reenable DeadStoresChecker under --analyze, and move the IdempotentOperationsChecker to the 'experimental' category. Fixes <rdar://problem/10146347>.
llvm-svn: 148533
2012-01-20 06:00:17 +00:00
Douglas Gregor 226173ae93 In the driver, -fmodules enables modules for C/Objective-C but one
also needs -fcxx-modules to enable modules for C++/Objective-C++.

llvm-svn: 148393
2012-01-18 15:19:58 +00:00
David Blaikie f47fa304a4 Remove unnecessary default cases in switches over enums.
This allows -Wswitch-enum to find switches that need updating when these enums are modified.

llvm-svn: 148281
2012-01-17 02:30:50 +00:00
Eli Friedman 5ceb74a7d0 Make the auto-detection hack for the iOS simulator set the target triple correctly. Getting the target triple wrong mostly appears to work, but messes up in subtle cases; for example, we incorrectly conclude that fwrite is actually named fwrite$UNIX2003. Also shuffles around the auto-detection code a bit to try and make it a bit more reliable. Fixes <rdar://problem/10664848>.
llvm-svn: 148249
2012-01-16 18:50:54 +00:00
Chad Rosier 1b9c5f1188 Fix 80-column violation.
llvm-svn: 148162
2012-01-14 00:30:11 +00:00
Eli Friedman d749c6bf2e Revert r148138; it's causing test failures.
llvm-svn: 148141
2012-01-13 21:33:06 +00:00