Commit Graph

230 Commits

Author SHA1 Message Date
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