Commit Graph

315 Commits

Author SHA1 Message Date
Chad Rosier c31e48d7e4 [driver] i386 kext preprocessor jobs also need their unsupported options
filtered.  This happenis when -save-temps is specified. 
<rdar://problem/10088387>

llvm-svn: 139269
2011-09-08 00:38:00 +00:00
Benjamin Kramer e007e80fc0 Stop cluttering the test directory with temporary files.
llvm-svn: 139114
2011-09-05 07:19:32 +00:00
Chandler Carruth f38e760777 Don't verify the name of the driver executable. It's not really relevent
to this test, and doesn't always start with 'clang' when fully resolved
on some build systems.

llvm-svn: 138878
2011-08-31 18:39:20 +00:00
Ivan Krasin 69a990badb Clang/PNaCl: Improve test coverage for PNaClTargetInfo (type aligns), fixes nits:
- wrong alignment for double (it was 4, but 8 is desired),
- added checks for _REENTRANT define,
- fixed the issue that defines were not tested (because the check for inside #ifdef).

llvm-svn: 138775
2011-08-29 22:39:12 +00:00
Chad Rosier f29d9aa5f5 [driver] Remove a few more options when clang invokes cc1plus for i386 kexts.
<rdar://problem/10027287>

llvm-svn: 138637
2011-08-26 18:30:43 +00:00
Chad Rosier ba3df1d3ca [driver] Add -mglobal-merge/-mno-global-merge machine options to enable/disable merging of
globals during codegen.
Fixes <rdar://problem/10017909>.

llvm-svn: 138612
2011-08-26 00:26:29 +00:00
Ivan Krasin 9b2cbdfcff PNaClTargetInfo: add __ELF__, _REENTRANT and _GNU_SOURCE defines and update the test
llvm-svn: 138607
2011-08-25 23:49:20 +00:00
Chad Rosier 160276dc93 [driver] Do not add -kext to the link command line when compiling with
-fapple-kext.
Fixes <rdar://problem/10013310>. Reverts <rdar://problem/7809940>.

llvm-svn: 138564
2011-08-25 17:33:03 +00:00
Ivan Krasin 7a09d12242 Follow up to r138470 (Add PNaCl TargetInfo). I've occasionally submitted wrong patch.
llvm-svn: 138489
2011-08-24 21:22:25 +00:00
Ivan Krasin dd7403e612 Add PNaCl TargetInfo.
llvm-svn: 138470
2011-08-24 20:22:22 +00:00
Eric Christopher c3fc262423 Right now this requires asserts.
llvm-svn: 138389
2011-08-23 21:47:58 +00:00
Eric Christopher 551ef45e85 Add support for a verifier to the driver. Currently only verifies debug
output on darwin so is hard coded there.

As a note this will need a little bit of refactoring in the class
hierarchy to separate it out for different verifiers based on input type.

Fixes rdar://8256258.

llvm-svn: 138343
2011-08-23 17:56:55 +00:00
Chad Rosier 3045386527 [driver] Implement in a more table-like manner and add many more warning options
that aren't handled by llvm-gcc on fallback.
Enhancement to rdar://9964354

llvm-svn: 137912
2011-08-18 01:18:28 +00:00
Chad Rosier bc5ea3d4b9 [driver] Clang doesn't support -mkernel/-fapple-kext for i386, so it's
automatically invoking llvm-gcc's cc1plus, which doesn't support all options
supported by Clang.  Therefore, filter out unsupported options.
rdar://9964354

llvm-svn: 137842
2011-08-17 18:24:55 +00:00
Bob Wilson 0d45f58cbb Reject -mkernel for i386/Darwin C++ code; fall back to llvm-gcc instead.
Since -mkernel implies -fapple-kext, this just extends the current behavior
for -fapple-kext to apply for -mkernel as well.  Radar 9933387.

llvm-svn: 137566
2011-08-13 23:48:55 +00:00
Nico Weber ed8080cb9f Add support of -x objc-cpp-output, -x objc++-cpp-output to the Driver.
Matches gcc, and is also required for using ccache with clang.

llvm-svn: 137563
2011-08-13 23:13:37 +00:00
Douglas Gregor 9f93e38aaf Introduce the "-index-header-map" option, to give special semantics
for quoted header lookup when dealing with not-yet-installed
frameworks. Fixes <rdar://problem/9824020>.

llvm-svn: 136331
2011-07-28 04:45:53 +00:00
Chad Rosier 02cc82c234 Test for r136294.
llvm-svn: 136296
2011-07-27 23:37:42 +00:00
Chad Rosier 7802c389da Whitespace.
llvm-svn: 135605
2011-07-20 19:27:01 +00:00
Chad Rosier 5371243dab If -ccc-host-triple i386-pc-win32-macho or -ccc-host-triple
x86_64-pc-win32-macho is used in conjunction with -no-integrated-as go ahead and
use the Darwin system assembler.
rdar://9785470

llvm-svn: 135604
2011-07-20 19:14:30 +00:00
Peter Collingbourne 77b0e7f296 Implement -MG. Fixes PR9613
llvm-svn: 134996
2011-07-12 19:35:15 +00:00
NAKAMURA Takumi c7ec4539ed Tweak two tests with MSYS-bash tolerant.
llvm-svn: 134899
2011-07-11 16:21:34 +00:00
John McCall 75bc773be5 Somehow the -fgnu-runtime option itself got lost in all that shuffling.
Restore it.

llvm-svn: 134459
2011-07-06 02:36:30 +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
Eli Friedman ad811f01d5 Make clang behave in a gcc-compatible way in the presence of multiple flags for the same x86 target feature (e.g. -mno-sse -msse). gcc uses a somewhat unintuitive algorithm here in that the enabled SSE instructions is based on the order of the *last* flag for *each* feature-level, so that "-mno-sse -msse2" only enables SSE2, but "-mno-sse -msse2 -msse" enables all SSE levels.
Issue reported on cfe-dev.

llvm-svn: 134296
2011-07-02 00:34:19 +00:00
Daniel Dunbar 044a3908ef Driver/Darwin: -force_load can be specified multiple times.
llvm-svn: 134025
2011-06-28 20:16:02 +00:00
Douglas Gregor d79f9666c8 Fix test case; we may end up linking against the libprofile_rt dylib.
llvm-svn: 134006
2011-06-28 15:40:31 +00:00
Nick Lewycky 1abf57d5a9 Fix this test on machines that don't run clang -cc1as when asked to assemble.
llvm-svn: 133688
2011-06-23 05:38:06 +00:00
John McCall b5f652e3ef It is possible to request the nonfragile ABI with -fobjc-abi-version=2;
respect that when deciding whether -objc-exceptions implies the
-fexceptions -cc1 option.

llvm-svn: 133590
2011-06-22 00:53:57 +00:00
Daniel Dunbar 3d125d329c Driver/Darwin: Fixup version check for -object_path_lto support.
llvm-svn: 133548
2011-06-21 21:18:32 +00:00
Daniel Dunbar ef889c7c9b Driver/Darwin: When invoking the linker, automatically pass -object_path_lto so
that the linker has a place to put the temporary object file and can leave it
around (for the driver to clean up). This is important so that the object file
references in the debug info are preserved for possible use by dsymutil.
 - <rdar://problem/8294279> executable has no debug symbols when compiled with LTO

llvm-svn: 133543
2011-06-21 20:55:11 +00:00
Nick Lewycky 9e8bf1ba06 Also fix the warning about using "clang" instead of %clang.
llvm-svn: 133492
2011-06-21 00:23:47 +00:00
Nick Lewycky 65df58582c Remove the leading hyphen so that grep doesn't parse it as one long option :)
llvm-svn: 133491
2011-06-21 00:21:22 +00:00
Daniel Dunbar 471c4f8299 Driver/Darwin: Honor -Xarch_FOO when the arch matches either the toolchain or
the architecture being bound.
 - Fixes things like -Xarch_armv7.

llvm-svn: 133490
2011-06-21 00:20:17 +00:00
Nick Lewycky ca6b90d8af Add support for -Wa,--noexecstack when building from a non-assembly file. For
an assembly file it worked correctly, while for a .c file it would given an
error about how --noexecstack is not a supported argument to -Wa.

llvm-svn: 133489
2011-06-21 00:14:18 +00:00
Eli Friedman 623e2ba435 Add support for -force_load flag, for compat with Apple gcc. rdar://9555962 .
llvm-svn: 133218
2011-06-16 23:59:43 +00:00
John McCall 17b4c83c91 Make this test pretend to be on a darwin host.
llvm-svn: 133125
2011-06-16 01:18:08 +00:00
John McCall 31168b077c Automatic Reference Counting.
Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.

llvm-svn: 133103
2011-06-15 23:02:42 +00:00
Douglas Gregor a860e6aebc Introduce a -cc1-level option to turn off related result type
inference, to be used (only) by the Objective-C rewriter.

llvm-svn: 133025
2011-06-14 23:20:43 +00:00
Douglas Gregor c9224d6714 Eliminate the -f[no]objc-infer-related-result-type flags; there's no
reason to allow the user to control these semantics through a flag.

llvm-svn: 132919
2011-06-13 16:42:53 +00:00
Douglas Gregor 33823727c8 Implement Objective-C Related Result Type semantics.
Related result types apply Cocoa conventions to the type of message
sends and property accesses to Objective-C methods that are known to
always return objects whose type is the same as the type of the
receiving class (or a subclass thereof), such as +alloc and
-init. This tightens up static type safety for Objective-C, so that we
now diagnose mistakes like this:

t.m:4:10: warning: incompatible pointer types initializing 'NSSet *'
with an
      expression of type 'NSArray *' [-Wincompatible-pointer-types]
  NSSet *array = [[NSArray alloc] init];
         ^       ~~~~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:72:1:
note: 
      instance method 'init' is assumed to return an instance of its
      receiver
      type ('NSArray *')
- (id)init;
^

It also means that we get decent type inference when writing code in
Objective-C++0x:

  auto array = [[NSMutableArray alloc] initWithObjects:@"one",  @"two",nil];
  //    ^ now infers NSMutableArray* rather than id

llvm-svn: 132868
2011-06-11 01:09:30 +00:00
Nick Lewycky 97864dac76 On linux, -nostdlib was causing a --start-group with no --end-group to be passed
to the linker.

llvm-svn: 132629
2011-06-04 06:27:06 +00:00
Eli Friedman 1ddf91621e Fix the Windows buildbots, now that I can actually see what was going wrong with this test.
llvm-svn: 132521
2011-06-03 00:54:56 +00:00
Eli Friedman 8c5014dc5e Switch a ridiculous grep over to FileCheck.
llvm-svn: 132496
2011-06-02 22:16:39 +00:00
Rafael Espindola 9d4a8cf481 Change how we link libprofile_rt.a. While at it, refactor the code a bit.
llvm-svn: 132474
2011-06-02 18:58:46 +00:00
Nick Lewycky 8a54c3d4ce Fix Darwin test for r132006.
llvm-svn: 132013
2011-05-24 22:18:08 +00:00
Rafael Espindola f934f98ad2 The logic about -static is darwin only. For now assume that all non
darwin assembler can handle cfi. Add a test.

llvm-svn: 131464
2011-05-17 16:26:17 +00:00
Daniel Dunbar eb86b04595 Driver/Darwin: Put dsymutil -o arguments first, so that dysmutil doesn't barf
when POSIXLY_COMPLIANT is set.
 - Patch by Dave Vasilevsky!

llvm-svn: 131084
2011-05-09 17:23:16 +00:00
Daniel Dunbar ce1035c20f Frontend: Fix a crash in CC_LOG_DIAGNOSTICS handling.
llvm-svn: 130909
2011-05-05 02:12:02 +00:00
Daniel Dunbar 7e0058626a tests: Tweak test to at least use a standard arch, to ensure we try to invoke
Clang.

llvm-svn: 130861
2011-05-04 19:52:08 +00:00
Devang Patel 85ac42339c Update metadata id number in string compare check.
llvm-svn: 130757
2011-05-03 16:19:38 +00:00
Daniel Dunbar 8438464b41 Driver/Darwin: Honor --sysroot= when invoking the linker, on Darwin.
llvm-svn: 130723
2011-05-02 21:03:47 +00:00
Daniel Dunbar c44d313cff Driver/Darwin/ld: Set the deployment target following the version information in
the tool chain, instead of based on the translated arguments.

llvm-svn: 130440
2011-04-28 21:23:41 +00:00
Chandler Carruth 30483fb188 Move all of the logic for __DEPRECATED to the driver based on comments
from dgregor.

llvm-svn: 130066
2011-04-23 19:48:40 +00:00
Chandler Carruth 61fbf62838 Fix Clang's __DEPRECATED define to be controled by -Wdeprecated. This
matches GCC behavior which libstdc++ uses to limit #warning-based
messages about deprecation.

The machinery involves threading this through a new '-fdeprecated-macro'
flag for CC1. The flag defaults to "on", similarly to -Wdeprecated. We
turn the flag off in the driver when the warning is turned off (modulo
matching some GCC bugs). We record this as a language option, and key
the preprocessor on the option when introducing the define.

A separate flag rather than a '-D' flag allows us to properly represent
the difference between C and C++ builds (only C++ receives the define),
and it allows the specific behavior of following -Wdeprecated without
potentially impacting the set of user-provided macro flags.

llvm-svn: 130055
2011-04-23 09:27:53 +00:00
Chandler Carruth b009b14971 There were some frustrating problems with the implementation of
-Wwrite-strings. First and foremost, once the positive form of the flag
was passed, it could never be disabled by passing -Wno-write-strings.
Also, the diagnostic engine couldn't in turn use -Wwrite-strings to
control diagnostics (as GCC does) because it was essentially hijacked to
drive the language semantics.

Fix this by giving CC1 a clean '-fconst-strings' flag to enable
const-qualified strings in C and ObjC compilations. Corresponding
'-fno-const-strings' is also added. Then the driver is taught to
introduce '-fconst-strings' in the CC1 command when '-Wwrite-strings'
dominates.

This entire flag is basically GCC-bug-compatibility driven, so we also
match GCC's bug where '-w' doesn't actually disable -Wwrite-strings. I'm
open to changing this though as it seems insane.

llvm-svn: 130051
2011-04-23 06:30:43 +00:00
Daniel Dunbar bbd482226e Driver/Darwin: Allow OS X deployment targets like 10.4.11, even though they
can't be represented in the environment define.

llvm-svn: 129939
2011-04-21 21:27:33 +00:00
Daniel Dunbar fcd2389b7a TWEAK
llvm-svn: 129835
2011-04-19 23:34:21 +00:00
Daniel Dunbar 5c56828d91 Driver/Darwin: Switch to using new style triples.
llvm-svn: 129824
2011-04-19 21:45:47 +00:00
Chris Lattner 57540c5be0 fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129559
2011-04-15 05:22:18 +00:00
Chandler Carruth a7773f719e Add -no-canonical-prefixes to tests which assert on the name of the
built clang binary that is used by the test. Build systems that use
symlinks for build outputs will fail these assertions otherwise.

llvm-svn: 129482
2011-04-13 22:28:36 +00:00
Daniel Dunbar 2f8d10e8d7 Fronted/CC_LOG_DIAGNOSTICS: Add test case.
llvm-svn: 129097
2011-04-07 19:05:06 +00:00
Chandler Carruth 82701204a4 Add my test case for r128353. I think this is the last test case to fail
to be added... Sorry for the noise.

llvm-svn: 128395
2011-03-27 21:03:41 +00:00
Daniel Dunbar 67fea71c2d Driver/Darwin: Dsymutil actions should put the dSYM adjacent to the output file.
llvm-svn: 128292
2011-03-25 18:16:51 +00:00
Daniel Dunbar 12100e2c7f Frontend: Add a more explicit -backend-option flag for passing backend command
line options, instead of leveraging the blanket -mllvm option.
 - This allows using the frontend itself without requiring the backend have
   those options available (i.e., if the target wasn't built).

llvm-svn: 128087
2011-03-22 16:48:17 +00:00
Daniel Dunbar 151a372113 Driver/Darwin: Transparently fallback when compiling i386 -fapple-kext code, we
don't support the ABI yet.

llvm-svn: 127903
2011-03-18 20:14:03 +00:00
NAKAMURA Takumi f5606922f8 test/Driver/sysroot-flags.c: Tweak for Mingw MSYS bash.
MSYS substitutes path (that begins with "/") to de-mounted Windows path, even if it were nonexistent.
"/foo/bar" might be substituted to "C:/msysgit/foo/bar".

llvm-svn: 127861
2011-03-18 03:21:33 +00:00
NAKAMURA Takumi 1bd6491f7f test/Driver/darwin-cc.c: FileCheck-ize and tweak for Mingw MSYS bash.
MSYS substitutes path (that begins with "/") to de-mounted Windows path.
"/tmp" might be substituted as "C:/DOCUME~1/chapuni/LOCALS~1/Temp".

llvm-svn: 127860
2011-03-18 03:21:26 +00:00
Daniel Dunbar c44f8cf7b8 Driver/Obj-C: Be compatible with GCC behavior in that -fno-exceptions *does not*
disable Obj-C exceptions.

llvm-svn: 127836
2011-03-17 23:28:31 +00:00
Daniel Dunbar 033a4bc49e Driver/Darwin: These are command line options, not target features.
llvm-svn: 127820
2011-03-17 18:29:04 +00:00
Daniel Dunbar c9388c11f1 Driver/Darwin/ARM: Kernel/kext code has more strict alignment requirements.
llvm-svn: 127815
2011-03-17 17:10:06 +00:00
Daniel Dunbar b1db4b69cc Driver/ARM: Match GCC behavior in that -msoft-float disables NEON, despite this
not being consistent at all with other parts of the GCC implementation.

llvm-svn: 127777
2011-03-17 00:07:34 +00:00
NAKAMURA Takumi c9998aa1f4 test/Driver/hello.c: Tweak for cygming.
- Driver's name may be "clang(-\d.\d).exe".
  - Emitted executable file is named as "%t.exe". It must be harmless on other OS.

llvm-svn: 127729
2011-03-16 13:51:46 +00:00
Chandler Carruth 306f98c241 Add a test case that would have caught the bug fixed in r126640.
I've only covered C++'s flags here, we should probably do something
similar for ObjC flags.

llvm-svn: 126641
2011-02-28 07:38:09 +00:00
Frits van Bommel ba6ce03e46 Fix this test case for CMake builds after r126502, which sneakily changed the actual executable name to clang-<version>.
llvm-svn: 126560
2011-02-27 01:17:12 +00:00
Anders Carlsson 3320e1575f Make clang -cc1 disable Objective-C exceptions by default, and add a -fobjc-exceptions flag to turn them on.
Update all tests accordingly.

llvm-svn: 126177
2011-02-22 01:52:06 +00:00
Daniel Dunbar bd466d404a tests: Fix test on Win32.
llvm-svn: 126087
2011-02-20 17:41:24 +00:00
Daniel Dunbar 1094bb101b Driver/Darwin: Support -Wl, with -Xarch_. This doesn't work naturally because of
the special way we model "linker input" arguments.

llvm-svn: 126023
2011-02-19 05:33:51 +00:00
Roman Divacky 115f0fa397 Add hardcoded -L/usr/lib after all -L options to the FreeBSD linker
invocation. 

This mimics what gcc does and fixes libtool check for libraries.

llvm-svn: 124558
2011-01-30 08:12:24 +00:00
Benjamin Kramer ed3d85a7f0 Make the FreeBSD driver test more robust so it doesn't fail when there's a single lib32 path.
llvm-svn: 124494
2011-01-28 18:28:30 +00:00
Fariborz Jahanian a4cfff87b9 Add all options needed to support -fapple-kext. wip.
llvm-svn: 122987
2011-01-07 01:05:02 +00:00
Daniel Dunbar 86aed7d5fc Driver: M and MM should be grouped together, <rdar://problem/8744831>.
llvm-svn: 121284
2010-12-08 21:33:40 +00:00
Chandler Carruth 174305b94e Make this test resilient to whether or not the Linux toolchain renders the
sysroot flag to the link command as a joined flag or a separate flag.

llvm-svn: 121270
2010-12-08 19:11:45 +00:00
Rafael Espindola c8f008f649 Use ld directly on linux. Changes from the previous try:
*) Try to detect as much as possible from the system itself, not the distro.
   This should make it easier to port to a new distro and more likely to
   work on a unknown one.
*) The distro enum now doesn't include the arch. Just use the existing
   host detection support in LLVM.
*) Correctly handle --sysroot.

A small regression is that now clang will pass bitcode file to the linker.
This is necessary for the gold plugin support to work.

It might be better to detect this at configure/cmake time, but doing it in
c++ first is a lot easier.

llvm-svn: 118382
2010-11-07 20:14:31 +00:00
Rafael Espindola 5275559c2e Update tests to not search of as.
llvm-svn: 117711
2010-10-29 21:18:11 +00:00
Chandler Carruth c7b34694ff Try again to pacify the build bots. =/ I'm getting a Darwin machine to test on.
llvm-svn: 116918
2010-10-20 08:24:03 +00:00
Chandler Carruth 4baa6ef5ec Remove a modern bash-ism and use simpler shell redirects. Hopefully will fix
build bots.

llvm-svn: 116914
2010-10-20 07:16:18 +00:00
Chandler Carruth 24e17e175d Add support for the '--sysroot' flag, and an accompanying test of its
interactions with -isysroot and other driver commands.

llvm-svn: 116912
2010-10-20 07:00:47 +00:00
Argyrios Kyrtzidis dfe47dba37 Revert r116605, a lot more were committed by mistake.
llvm-svn: 116606
2010-10-15 18:51:34 +00:00
Argyrios Kyrtzidis ffbba26285 Add '-include-pch' option to the driver, so it can get passed to the cc1 driver.
llvm-svn: 116605
2010-10-15 18:49:01 +00:00
Argyrios Kyrtzidis 74825bcfb9 Implement -fshort-enums (rdar://8490496).
llvm-svn: 116020
2010-10-08 00:25:19 +00:00
Francois Pichet 8f170b8239 Fix last test still failing on Win32. 100% pass rate now!
llvm-svn: 113702
2010-09-11 20:43:12 +00:00
Daniel Dunbar e31e323c02 Driver/Darwin: Switch to using simplified tool chain by default -- what better
way to see what will break! :)

llvm-svn: 111840
2010-08-23 20:58:55 +00:00
Daniel Dunbar 568b7500fe Driver/OptParser: Add a NoForward flag to prevent forwarding certain options to
GCC.
 - Mark -Xclang and -mlinker-version= with it for now, although I am sure there
   are more.

llvm-svn: 111005
2010-08-13 04:44:20 +00:00
Argyrios Kyrtzidis 90bdfbbdf7 Switch on PCH for C++. C++ fans all over the world rejoice.
llvm-svn: 110879
2010-08-11 23:27:58 +00:00
Daniel Dunbar cacb0e2d45 Driver/Darwin: Pass -demangle when linking, if the linker supports it.
llvm-svn: 110873
2010-08-11 23:07:50 +00:00
Daniel Dunbar ce25f33e2a Driver/FreeBSD: Infer the right arch name in the presence of -m32,-m64, for the
cases we care about.
 - This is eventually going to be unified outside the host specific code.

llvm-svn: 110693
2010-08-10 17:39:05 +00:00
Daniel Dunbar 926f81fce5 Driver: Start ripping out support for -pipe, which is worthless and complicates
too many other things.

llvm-svn: 110007
2010-08-02 02:38:03 +00:00
Daniel Dunbar 6d48476446 Driver/Darwin: Set -force_cpusubtype_ALL only by default on x86.
llvm-svn: 109074
2010-07-22 01:47:22 +00:00
Daniel Dunbar 08d047666a Fix test for Win32.
llvm-svn: 108806
2010-07-20 04:06:54 +00:00