Commit Graph

257 Commits

Author SHA1 Message Date
Daniel Dunbar 1a8a2e8e97 Remove some obsolete or unnecessary FIXMEs.
llvm-svn: 85475
2009-10-29 02:39:57 +00:00
Daniel Dunbar 945577ce93 PR5328: Allow duplicatic -pedantic (and -pedantic-errors) options.
- clang-cc doesn't care about their relative order with other -W options.

llvm-svn: 85473
2009-10-29 02:24:45 +00:00
Daniel Dunbar b0b18615e2 Kill off MakeFormattedString helper function.
llvm-svn: 85472
2009-10-29 02:24:37 +00:00
Daniel Dunbar 38b6279ce4 Reject -I- in driver instead of clang-cc.
llvm-svn: 85469
2009-10-29 01:53:44 +00:00
Douglas Gregor f7b87cb529 [llvm up]
Switch a few ugly switch-on-string-literal constructs to use the new
llvm::StringSwitch.

llvm-svn: 85461
2009-10-29 00:41:01 +00:00
Edward O'Callaghan 5c5214626c Fix for PR4887, Credit to Jonathan Gray.
llvm-svn: 85392
2009-10-28 15:13:08 +00:00
Rafael Espindola b3549d74da Rename -nostdclanginc to -nobuiltininc.
llvm-svn: 85116
2009-10-26 13:36:57 +00:00
Edward O'Callaghan f208b55825 AuroraUX toolchain should call GNU assembler not the Solaris assembler.
llvm-svn: 84469
2009-10-19 07:02:08 +00:00
Edward O'Callaghan 7d3c275526 dynamic linker arg is incorrectly invoking gnu ld arg syntax instead of svr4 ld syntax in AuroraUX toolchain.
llvm-svn: 84266
2009-10-16 19:44:18 +00:00
Nuno Lopes 275225dd05 fix -ansi in c++: it means -std=c++98
llvm-svn: 84254
2009-10-16 14:28:06 +00:00
Daniel Dunbar cbc34b769e Driver: Default to using PTH for C++ precompiled header support, PCH for C++
isn't implemented yet.
 - <rdar://problem/7297571> Clang should use pretokenized headers for C++ PCH
   files

llvm-svn: 84197
2009-10-15 20:02:44 +00:00
Edward O'Callaghan d8712d9143 AuroraUX toolchain fixes.
llvm-svn: 84176
2009-10-15 07:44:07 +00:00
Edward O'Callaghan fc460554f6 -funit-at-a-time is the default however some current makefiles pass -fno-unit-at-a-time which is ignored by GCC, we should warn about this not error out.
llvm-svn: 83976
2009-10-13 16:41:34 +00:00
Rafael Espindola 7787d79c7b Add the -nostdclanginc option to clang (the driver).
llvm-svn: 83377
2009-10-06 12:45:37 +00:00
Fariborz Jahanian e4b21aba44 Set __EXCEPTIONS by checking on darwin's triple.
Patch by Rafael Espindola.

llvm-svn: 83209
2009-10-01 20:30:46 +00:00
Rafael Espindola 00a665751d Move the "needs exception support" logic to clang. This also fixes
-fno-exceptions in C++ code. We used to always define __EXCEPTIONS in
C++.

llvm-svn: 83199
2009-10-01 13:33:33 +00:00
Ted Kremenek 05e6f5b6e9 Turn on 'RegionStore' as the default store manager both for 'clang --analyze' and 'scan-build'. Leave 'BasicStore' as the default store manager in 'clang-cc'. While there are still known warts with RegionStore, it's ready to be tested by general users.
llvm-svn: 82752
2009-09-25 05:55:59 +00:00
Daniel Dunbar 6276f99be5 Split Darwin toolchain into Clang and GCC Darwin toolchains with a common base.
llvm-svn: 82213
2009-09-18 08:15:13 +00:00
Daniel Dunbar 26d482a1a9 Lift AddLinkRuntimeLibArgs into Darwin tool chain.
llvm-svn: 82212
2009-09-18 08:15:03 +00:00
Daniel Dunbar d5bd81e869 Move isMacosxVersionLT helpers to Darwin tool chain.
llvm-svn: 82211
2009-09-18 08:14:55 +00:00
Daniel Dunbar 510d8a8dd8 Lift getMacosxVersionMin out into Darwin ToolChain.
llvm-svn: 82210
2009-09-18 08:14:46 +00:00
Daniel Dunbar 4c30b89def Lift AddLinkerSearchPaths() into Darwin tool chain.
llvm-svn: 82209
2009-09-18 08:14:36 +00:00
Daniel Dunbar 48622c13f7 Rename a variable to match its semantics.
llvm-svn: 82208
2009-09-18 08:14:24 +00:00
Daniel Dunbar 58f7833cfb Driver: Change -O to mean -O2, -O1 is meaningless.
llvm-svn: 82131
2009-09-17 06:53:36 +00:00
Daniel Dunbar d112f103e7 We don't need a -compile-ast clang-cc action, we can just use -S.
llvm-svn: 82105
2009-09-17 00:47:53 +00:00
Daniel Dunbar 306945d3d0 Incremental improvement to logic determining whether we emit unwind tables or
not.
 - PR4932.

llvm-svn: 82021
2009-09-16 06:17:29 +00:00
Daniel Dunbar 4ed7898294 Support -mabi= for clang/ARM.
llvm-svn: 81734
2009-09-14 00:34:46 +00:00
Daniel Dunbar 33a004e9eb Swizzle the target triple based on -mthumb, and update clang-cc to recognize
thumb-foo-bar as an ARM target.

llvm-svn: 81497
2009-09-11 01:14:50 +00:00
Daniel Dunbar 7848592ec6 Initial handling of -m{soft-float,hard-float,float-abi=} for ARM.
llvm-svn: 81471
2009-09-10 23:00:09 +00:00
Daniel Dunbar e2cf8f7b53 Move X86 handling of -m[no-]soft-float and -m[no-]red-zone into AddX86TargetArgs.
llvm-svn: 81470
2009-09-10 22:59:57 +00:00
Daniel Dunbar f492c92761 Change getLLVMArchNameForARM to just get the suffix.
llvm-svn: 81469
2009-09-10 22:59:51 +00:00
Daniel Dunbar fb58b0aaa9 Add code to mangle the triple for LLVM on ARM.
- I think we should get rid of this distinction though, but I need to discuss with the interested parties.

llvm-svn: 81435
2009-09-10 06:49:20 +00:00
Daniel Dunbar 4fa0811e4c Don't pass -fno-builtin-str{cat,cpy} to clang-cc, I forget we don't support that yet. PR4941.
llvm-svn: 81430
2009-09-10 04:57:27 +00:00
Daniel Dunbar 0f5c542a86 ARM: Pass -mcpu to clang-cc based on -march= and -mcpu=.
llvm-svn: 81429
2009-09-10 04:57:17 +00:00
Daniel Dunbar 2ffe029a61 Implement Darwin/ARM behavior for defaulting to -fno-builtin-str{cat,cpy}.
llvm-svn: 81425
2009-09-10 03:37:02 +00:00
Daniel Dunbar 4eadb60652 Add a check that -static is not used with -dynamic or -mdynamic-no-pic.
llvm-svn: 81421
2009-09-10 01:21:12 +00:00
Daniel Dunbar 64198ef50f Factor out CheckPreprocessing options to share between Clang/CC1 tools.
Also, fix forwarding of -C/-CC to cc1.

llvm-svn: 81420
2009-09-10 01:21:05 +00:00
Daniel Dunbar 3b3191f23c Move Clang X86 cpu/feature argument translation into AddX86TargetArgs.
llvm-svn: 81390
2009-09-09 22:33:08 +00:00
Daniel Dunbar 1ce81538f1 Change Get{File,Program}Path to return an std::string (instead of a sys::Path).
llvm-svn: 81389
2009-09-09 22:33:00 +00:00
Daniel Dunbar 1c28f1e17c Remove gratuitous use of c_str().
llvm-svn: 81388
2009-09-09 22:32:48 +00:00
Daniel Dunbar b617a9f3c7 Use Twine concatenation instead of llvm::format.
llvm-svn: 81387
2009-09-09 22:32:41 +00:00
Daniel Dunbar b4a3e43741 Simplify.
llvm-svn: 81386
2009-09-09 22:32:34 +00:00
Daniel Dunbar 3571dd90cf Use AddDarwinArch for passing arch name to assembler.
llvm-svn: 81368
2009-09-09 18:36:27 +00:00
Daniel Dunbar e9ded43d1d Add DarwinTool base class for all Darwin tools, and move AddDarwin[Sub]Arch there.
llvm-svn: 81367
2009-09-09 18:36:20 +00:00
Mike Stump 11289f4280 Remove tabs, and whitespace cleanups.
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Daniel Dunbar c09988dda5 Remove FIXMEs for pedantically-gcc-bug-compatible behavior.
- We aren't going to fix these since they haven't caused problems in practice.

 - Similarly, don't forward -object to Darwin ld.

llvm-svn: 81224
2009-09-08 16:39:16 +00:00
Daniel Dunbar 037f389f4d Merge libgcc spec changes for darwin::Link::ConstructJob.
llvm-svn: 81022
2009-09-04 18:35:47 +00:00
Daniel Dunbar 2b5f6817e0 Tweak darwin::Link::AddLinkArgs.
llvm-svn: 81021
2009-09-04 18:35:41 +00:00
Daniel Dunbar 91dbfd6666 Implement darwin::Link::AddDarwinArch for ARM.
llvm-svn: 81020
2009-09-04 18:35:31 +00:00
Daniel Dunbar 84e727fb72 Darwin: Pass -iphoneos-version-min to ld when building for ARM.
llvm-svn: 81019
2009-09-04 18:35:21 +00:00
Daniel Dunbar f0a5b9b126 Rename Darwin_X86 toolchain to just Darwin, this can support all platforms.
llvm-svn: 81016
2009-09-04 18:34:51 +00:00
Daniel Dunbar a77eaeb1e6 Add basic support for -pthread.
- Patch by David Chisnall, with PCH and Darwin support mixed in.

llvm-svn: 80883
2009-09-03 04:54:28 +00:00
Daniel Dunbar 6cdf83c192 Add driver support for -emit-ast and AST compilation steps.
- <rdar://problem/7185031> Add 'clang' option '-emit-ast'

llvm-svn: 80678
2009-09-01 16:57:46 +00:00
David Chisnall 5778fce141 Updated GNU runtime non-fragile ABI.
Added -fconstant-string-class= option.
Added __has_feature() test for non-fragile ABI.

llvm-svn: 80591
2009-08-31 16:41:57 +00:00
Daniel Dunbar a6b4a3d646 PR4766: Don't pass -static to 'as' on x86_64 on Darwin.
Also, do pass -static even with -dynamic on i386.

llvm-svn: 79948
2009-08-24 22:26:16 +00:00
Edward O'Callaghan 856e4ff78d Second half of, clang, AuroraUX toolchain support.
llvm-svn: 79713
2009-08-22 01:06:46 +00:00
Benjamin Kramer 70231c99c4 Fix -fno-omit-frame-pointer bug Eli noticed.
llvm-svn: 78233
2009-08-05 19:47:38 +00:00
Benjamin Kramer cf4371a689 Translate -mcmodel=X to -code-model X and pass it to clang-cc. Patch by Pawel Worach!
llvm-svn: 78190
2009-08-05 14:30:52 +00:00
Benjamin Kramer 72e211a47a Add support for the -fno-omit-frame-pointer option. Patch by Roman Divacky!
llvm-svn: 78188
2009-08-05 12:11:11 +00:00
Daniel Dunbar a8888ac1cb Driver/OpenBSD: Improve ld options.
- Patch by Jonathan Gray!

llvm-svn: 77935
2009-08-03 01:28:59 +00:00
Mike Stump 183c3d2f59 Add beginnigs of rtti generation, wire up more of -fno-exceptions.
llvm-svn: 77751
2009-07-31 23:15:31 +00:00
Ted Kremenek 9c3952c03e Have 'clang --analyze' run syntactic static analysis security checks.
llvm-svn: 76996
2009-07-24 20:03:11 +00:00
Eli Friedman bb0d9a5129 Remove -ftraditional option, which gcc doesn't actually support. Make
using -traditional and -traditional-cpp with clang an error because 
it's unsupported in clang and causes a significant change in the 
semantics of the language.

llvm-svn: 75690
2009-07-14 21:58:17 +00:00
Douglas Gregor 0086a5a3bb Introduce the notion of "Relocatable" precompiled headers, which are built
with a particular system root directory and can be used with a different
system root directory when the headers it depends on have been installed.
Relocatable precompiled headers rewrite the file names of the headers used
when generating the PCH file into the corresponding file names of the 
headers available when using the PCH file.

Addresses <rdar://problem/7001604>.

llvm-svn: 74885
2009-07-07 00:12:59 +00:00
Daniel Dunbar 126b3a103e Driver: Add Source argument for Commands to hold the Action which caused a
Command to be generated, to support more advanced diagnostics.
 - No functionality change.

llvm-svn: 74627
2009-07-01 19:02:28 +00:00
Daniel Dunbar 10de9e6602 OpenBSD support.
- Patch by Jonathan Gray!

llvm-svn: 74453
2009-06-29 20:52:51 +00:00
Bill Wendling d63bbadbef Add stack protector support to clang. This generates the 'ssp' and 'sspreq'
function attributes. There are predefined macros that are defined when stack
protectors are used: __SSP__=1 with -fstack-protector and __SSP_ALL__=2 with
-fstack-protector-all.

llvm-svn: 74405
2009-06-28 07:36:13 +00:00
Daniel Dunbar 367dbb9760 Forward -C and -CC to clang.
- <rdar://problem/6945384> Driver should pass down -C and -CC

llvm-svn: 73087
2009-06-08 21:48:20 +00:00
Daniel Dunbar db09702e2a PR4016: Forward -fno-show-source-location to clang.
llvm-svn: 73082
2009-06-08 21:13:54 +00:00
Devang Patel 9e24386c65 Set function Attribute::NoImplicitFloat appropriately.
llvm-svn: 72961
2009-06-05 22:05:48 +00:00
Eli Friedman 327f0b5593 Add driver support for -fsigned-char/-funsigned-char.
llvm-svn: 72930
2009-06-05 07:21:14 +00:00
Torok Edwin a1581e1a7a forward -fno-color-diagnostics to clang-cc.
llvm-svn: 72856
2009-06-04 07:27:53 +00:00
Daniel Dunbar 877b30f83c Driver: Support -mllvm; this just forwards options to clang-cc.
llvm-svn: 72780
2009-06-03 16:16:27 +00:00
Fariborz Jahanian a4404f21d1 This patch adds support for sender-aware dispatch in Objective-C for the GNU runtime, when
compiled with -fobjc-sender-dependent-dispatch.  This is used in AOP, COP, implementing object 
planes, and a few other things.
Patch by David Chisnall.

llvm-svn: 72275
2009-05-22 20:17:16 +00:00
Daniel Dunbar adeeb052ad Don't warn about -funit-at-a-time, and reject -fno-unit-at-a-time.
- We could just warn about -fno-unit-at-a-time, but in practice people using it
   probably aren't going to get what they want out of clang.

Also, use "clang" specified error for unsupported things instead of driver
unsupported error.

llvm-svn: 72272
2009-05-22 19:02:20 +00:00
Daniel Dunbar 5bbebfe9bc Don't rely on getArchName() to return a constant string reference.
llvm-svn: 72241
2009-05-22 02:21:04 +00:00
Daniel Dunbar 58f345ceb1 Add --analyzer-no-default-checks and --analyzer-output options.
llvm-svn: 72238
2009-05-22 00:38:15 +00:00
Daniel Dunbar 13c358d9b8 Remove -fprintf-source-range-info from the Driver (this was renamed)
llvm-svn: 72061
2009-05-18 23:01:24 +00:00
Daniel Dunbar 8a35ef85d8 Driver: Emit an unsupported error on -iframework.
llvm-svn: 71698
2009-05-13 19:05:04 +00:00
Daniel Dunbar e5ae096bf8 Tweak x86 -mcpu defaults.
- Default to yonah on Darwin (to get SSE3).

 - Default to Pentium4 (32-bit) and x86-64 (64-bit) on
   non-Darwin. Welcome to the 21st century.

llvm-svn: 71069
2009-05-06 04:58:14 +00:00
Daniel Dunbar 4dbaaa6f43 Improve handling of (X86) target features.
- This is a WIP...

 - This adds -march= handling to the driver, and fixes the defaulting
   of -mcpu on Darwin (which was using the wrong test).

Instead of handling -m{sse, ...} in the driver, pass them to clang-cc as
 -target-feature [+-]name

In clang-cc, communicate with the (clang) target to discover the legal
features of a target, and the features which are enabled based on
-mcpu. This is currently hardcoded just enough to not be a feature
regression, we need to get this information from the backend's
TableGen information somehow.

This is used to construct the full list of features which are being
used, which is in turn used to initialize the predefines.

llvm-svn: 71061
2009-05-06 03:16:41 +00:00
Daniel Dunbar e993ba6fca Add -fobjc-tight-layout.
- This implements gcc style Objective-C interface layout (I
   think). Currently it is always off, there is no functionality
   change unless this is passed.
   
   For the curious, the deal is that gcc lays out the fields of a
   subclass as if they were part of the superclass. That is, the
   subclass fields immediately follow the super class fields instead
   of being padded to the alignment of the superclass structure.

 - Currently gcc uses the tight layout in 32-bit and 64-bit modes, and
   llvm-gcc uses it in 32-bit only, for reasons which aren't clear
   yet. We probably want to switch to matching gcc, once this makes it
   through testing... my hope is that we can also fix llvm-gcc in
   order to maintain compatibility between the compilers.

llvm-svn: 70827
2009-05-04 05:16:21 +00:00
Daniel Dunbar 5716d87ed1 Driver: When using the generic gcc tool, pass -m32 or -m64 if we
recognize the architecture.
 - This is an attempt to force gcc to the write target.

 - PR4094.

llvm-svn: 70647
2009-05-02 21:41:52 +00:00
Daniel Dunbar e3e263fb71 Driver: Generate an error when trying to pass an LLVM bc input to a
non-Darwin linker (sorry Gold + LTO-plugin users).

llvm-svn: 70641
2009-05-02 20:14:53 +00:00
Daniel Dunbar cc9123424f DragonFly ToolChain definition for driver.
- Patch by Alex Hornung!

llvm-svn: 70635
2009-05-02 18:28:39 +00:00
Douglas Gregor 4818553abd Implement -fmessage-length=N, which word-wraps diagnostics to N columns.
Also, put a line of whitespace between the diagnostic and the source
code/caret line when the start of the actual source code text lines up
(or nearly lines up) with the most recent line of the diagnostic. For
example, here it's okay for the last line of the diagnostic to be
(vertically) next to the source line, because there is horizontal
whitespace to separate them:

decl-expr-ambiguity.cpp:12:16: error: function-style cast to a builtin
      type can only take one argument
  typeof(int)(a,5)<<a;

However, here is a case where we need the vertical separation (since
there is no horizontal separation):

message-length.c:10:46: warning: incompatible pointer types initializing 'void
      (int, float, char, float)', expected 'int (*)(int, float, short,
      float)'

      int (*fp1)(int, float, short, float) = f;

This is part one of <rdar://problem/6711348>.

llvm-svn: 70578
2009-05-01 21:53:04 +00:00
Daniel Dunbar 44e7122151 Make sure to pass the same options to the static analyzer as the
compiler.
 - Code generation options may still affect the language...

llvm-svn: 70393
2009-04-29 18:32:25 +00:00
Daniel Dunbar fb83baaf76 With -ccc-pch-is-pch, always treat precompiled inputs as PCH,
regardless of extension.
 - Otherwise we can't expect that just plugging in -ccc-pch-is-pch
   will work.

llvm-svn: 70318
2009-04-28 19:38:45 +00:00
Daniel Dunbar 72a6090dc4 Driver: Add -std-default= option.
- This can be used to supply a default value for -std=; the idea is
   that this can be used in conjunction with CCC_ADD_ARGS or
   QA_OVERRIDE_GCC3_OPTIONS to change the default without having to
   modify the build system.

llvm-svn: 70102
2009-04-26 01:10:38 +00:00
Daniel Dunbar 68f1d8ed0c Driver: -mkernel disables default use of unwind tables (although I
don't yet understand where this is happening in llvm-gcc).

llvm-svn: 70012
2009-04-25 05:49:54 +00:00
Daniel Dunbar 11892e951d Driver: -mkernel and -fapple-kext imply -mno-red-zone.
llvm-svn: 70010
2009-04-25 05:33:23 +00:00
Daniel Dunbar c1b1b4b2c9 Don't run dsymutil when making a fat executable direct source.
- Otherwise, we will end up with stray .dSYM files which don't get
   lipo'ed or removed.

 - Ideally we would run dsymutil on the result, but we don't have the
   infrastructure for that yet. Note that gcc doesn't handle this case
   either.

 - <rdar://problem/6809621> [driver] clang leaves .dSYM files lying
   around in tmp.

llvm-svn: 69951
2009-04-24 03:03:52 +00:00
Daniel Dunbar 838cbe19b7 Call ld, not collect2.
- <rdar://problem/6517382> [driver] call ld directly

llvm-svn: 69938
2009-04-23 23:17:23 +00:00
Chris Lattner 6968641ac5 rename -fprint-source-range-info -> -fdiagnostics-print-source-range-info.
Temporarily accept both of them, I'll rip out the old one after awhile.

llvm-svn: 69662
2009-04-21 05:34:31 +00:00
Daniel Dunbar f5e9b1f5d0 Forward f[no-]dollars-in-identifiers to clang, when specified.
llvm-svn: 69549
2009-04-19 21:20:32 +00:00
Daniel Dunbar 8281bdeb4d Forward -fno-diagnostics-fixit-info to clang-cc.
llvm-svn: 69546
2009-04-19 21:09:34 +00:00
Douglas Gregor 111af7d7b4 Preliminary PCH support in the driver
llvm-svn: 69410
2009-04-18 00:34:01 +00:00
Fariborz Jahanian 493d4e080d Added -print-ivar-layout option. No change in functionality
yet.

llvm-svn: 69346
2009-04-17 03:04:15 +00:00
Daniel Dunbar 092f0ccd9c Pass -fdiagnostics-show-option to clang-cc by default.
- <rdar://problem/6796848> implement -fdiagnostics-show-option

llvm-svn: 69276
2009-04-16 06:32:38 +00:00
Daniel Dunbar b4b3709c5b Driver: Forward -W* to clang, it can handle all these itself now.
Remove clang_W_Group and clang_ignored_W_Group.

llvm-svn: 69261
2009-04-16 03:44:10 +00:00
Daniel Dunbar 2edd923c90 Driver: For clang, accept -fsigned-bitfields and reject
-funsigned-bitfields for now (clang defaults to -fsigned-bitfields).
 - <rdar://problem/6790309> ER: Support
   -fsigned-bitfields/-funsigned-bitfields

llvm-svn: 69131
2009-04-15 02:37:43 +00:00
Chris Lattner cac63f359e Implement support for GCC's -dD mode, which dumps -E output *and*
macro definitions.

llvm-svn: 68884
2009-04-12 01:56:53 +00:00
Daniel Dunbar c8b7af89ce Driver: Forward -miphoneos-version-min to clang.
llvm-svn: 68816
2009-04-10 20:11:50 +00:00
Daniel Dunbar d067f7fbef Driver: Split out CPP specific options for clang so that we don't end
up adding them twice when running with -no-integrated-cpp or
-save-temps.
 - <rdar://problem/6766636> -save-temps falls over with prefix headers

llvm-svn: 68660
2009-04-08 23:54:23 +00:00
Daniel Dunbar 17ddaa677e More fixes to builtin preprocessor defines.
- Add -static-define option driver can use when __STATIC__ should be
   defined (instead of __DYNAMIC__).

 - Don't set __OPTIMIZE_SIZE__ on Os, __OPTIMIZE_SIZE__ is tied to Oz.

 - Set __NO_INLINE__ following GCC 4.2.

 - Set __GNU_GNU_INLINE__ or __GNU_STDC_INLINE__ following GCC 4.2.

 - Set __EXCEPTIONS for Objective-C NonFragile ABI.

 - Set __STRICT_ANSI__ for standard conforming modes.

 - I added a clang style test case in utils for this, but its not
   particularly portable and I don't think it belongs in the test
   suite.

llvm-svn: 68621
2009-04-08 18:03:55 +00:00
Daniel Dunbar ad0f62b203 Darwin ld: Unconditionally add -lstdc++ if we are pretending to be
g++.

llvm-svn: 68601
2009-04-08 06:06:21 +00:00
Daniel Dunbar 3b358a3d83 Make debug info work when using -save-temps.
- This is pretty ugly, but the most obvious solution. Chime in if you
   have a nicer one.

 - The problem is that with -save-temps, clang-cc has no idea what the
   name of the original input file is. However, the user expects to be
   able to set breakpoints based on the input file name.

 - We support this by providing a new option -main-file-name (similar
   to -dumpbase used by gcc) which allows the driver to pass in the
   original file name.

 - <rdar://problem/6753383> building with clang using --save-temps
   gets the compile unit name from the .i file...

llvm-svn: 68595
2009-04-08 05:11:16 +00:00
Daniel Dunbar ab7b2f5623 Set __PIC__ (more) correctly.
- Add -pic-level clang-cc option to specify the value for the define,
   updated driver to pass this.

 - Added __pic__

 - Added OBJC_ZEROCOST_EXCEPTIONS define while I was here (to match gcc).

llvm-svn: 68584
2009-04-08 03:03:23 +00:00
Daniel Dunbar d4510f2223 Driver: Fix forwarding of -fpascal-strings.
llvm-svn: 68570
2009-04-07 23:51:44 +00:00
Daniel Dunbar c44b4ccca8 Driver: Fix forwarding of -{std,ansi,trigraphs} when there are
multiple instances of an option.

Also, removed direct -ansi support from clang-cc.

llvm-svn: 68558
2009-04-07 22:13:21 +00:00
Daniel Dunbar 3a148f2625 Driver: Forward remaining -f options to clang manually.
- Groups are really just intended to hold inherent structure of the
   options, not be abused for individual tool argument translation.

llvm-svn: 68554
2009-04-07 21:51:40 +00:00
Daniel Dunbar 9dc82a2632 Driver: Only forward last instance of -mmacosx-version-min= and
-isysroot to clang.
 - Don't forward arbitrary -i* options to clang, just the ones we know
   about.

llvm-svn: 68553
2009-04-07 21:42:00 +00:00
Daniel Dunbar d18049ab1d Driver: Manually translate a number of -f with no- variants options to
clang.
 - We will eventually want some more driver infrastructre for this
   probably.

 - For now, the clang-cc interface stays relatively the same, but we
   don't accept multiple instances anymore, or the [no-] variants
   directly.

llvm-svn: 68550
2009-04-07 21:16:11 +00:00
Daniel Dunbar 513d500fda Driver: Explicitly warn that -pg isn't supported (even though we
aren't failing the compilation).

llvm-svn: 68540
2009-04-07 19:18:24 +00:00
Daniel Dunbar c790b09b81 Driver: More verbosity reduction.
- Ignore some more -W options and -[fm] options which we can somewhat
   safely ignore.

 - Recognize that -W is an alias for -Wextra

W: -Wdeclaration-after-statement -Werror-implicit-function-declaration -Wfour-char-constants -Winit-self -Wmissing-format-attribute -Wno-#warnings -Wno-comment -Wno-long-long -Wno-variadic-macros -Wold-style-definition -Wstrict-prototypes -Wunused-parameter

f: -fconstant-cfstrings -fdollars-in-identifiers -finline -finline-functions -fno-inline -fno-keep-inline-functions -fno-strict-aliasing -fobjc-atdefs -fobjc-call-cxx-cdtors -fobjc-new-property -fstack-protector

m: -mconstant-cfstrings -mfix-and-continue
llvm-svn: 68487
2009-04-07 02:59:27 +00:00
Daniel Dunbar f89733cfb8 Driver: Handle properly calling dsymutil when source input is
preceeded by a linker input flag.
 - <rdar://problem/6757236> clang should make a dSYM when going
   straight from source to binary

 - This still matches gcc, but the right way to solve this would be to
   detect the situation we care about (we are compiling from source
   and linking in one step), instead of looking at the suffix of the
   input file. The Tool doesn't quite have enough information to do
   this yet, however.

 - Also, find the suffix correctly.

llvm-svn: 68417
2009-04-04 00:55:30 +00:00
Daniel Dunbar c2a7189048 Driver: Explicitly ignore -fpch-preprocess when using clang, we don't
need to do anything special to support this.

llvm-svn: 68403
2009-04-03 20:51:31 +00:00
Daniel Dunbar 6a8803a34f Driver: Add missed translation for darwin::Preprocess (gcc), -d*
wasn't being forwarded.

llvm-svn: 68365
2009-04-03 01:27:06 +00:00
Ed Schouten e33194b9d5 Add some whitespace to test my commit privileges.
Approved by:	ddunbar

llvm-svn: 68343
2009-04-02 19:13:12 +00:00
Daniel Dunbar 7803c9546b Driver: Allow -ccc-gcc-name to specify the name/path to use when
calling gcc in generic configurations.

llvm-svn: 68260
2009-04-01 23:34:41 +00:00
Daniel Dunbar 0a05d93ed6 Quick and dirty (!) fix to make sure we use powerpc in triples.
- PR3922

 - I have a clean solution for this in flight, but it may take a while
   to come to fruition so we'll take a quick fix for now.

llvm-svn: 68241
2009-04-01 20:33:11 +00:00
Daniel Dunbar d854c8d8a6 Driver: Add freebsd::Link
- Patch by Ed Schouten!

llvm-svn: 68233
2009-04-01 19:36:32 +00:00
Daniel Dunbar 2ec6e8e2ba Remove a FIXME, use -emit-pth to drive PTH generation.
-  c.f. r68164

llvm-svn: 68184
2009-04-01 03:28:10 +00:00
Daniel Dunbar ae8bca038d Tweak/cleanup darwin::Link a bit, add several FIXMES, and improve test
case.

llvm-svn: 68182
2009-04-01 03:17:40 +00:00
Daniel Dunbar 5c9c118600 Tweak darwin::Assemble and add a FIXME.
llvm-svn: 68165
2009-04-01 00:27:44 +00:00
Daniel Dunbar e521a8994c Driver: Forward -Wp, and -Xpreprocessor arguments to clang when using
the preprocessor.
 - PR3602.

 - As is inherent in the blanket forwarding options, this will only
   work if clang-cc happens to accept what the user passed. Users by
   and large should use driver options to interact with the
   preprocessor, if at all possible.

llvm-svn: 68144
2009-03-31 20:53:55 +00:00
Daniel Dunbar 8eb473c477 Driver: Call 'as' directly on FreeBSD.
- Patch by Ed Schouten!

llvm-svn: 68121
2009-03-31 17:45:15 +00:00
Daniel Dunbar d640be24fd (LLVM up) Update to use llvm::sys::getHostTriple().
- Always pass -triple to clang-cc (-arch will be removed).

 - clang-cc doesn't play guess work with the target triple anymore.

llvm-svn: 68119
2009-03-31 17:35:15 +00:00
Daniel Dunbar 759b1c9b80 Fix -MD with no -MT when -o is specified (and fix test case).
llvm-svn: 68042
2009-03-30 17:59:58 +00:00
Daniel Dunbar d67a32252c Driver: Support -M and -MM.
- Not particularly elegant, but my hand is forced by gcc.

Also, tweak -ccc-print-bindings output.

llvm-svn: 68027
2009-03-30 06:36:42 +00:00
Daniel Dunbar 52e96cc932 Improve dependency file support.
- Rip out various bits of logic from clang-cc's dependency file gen,
   force driver to provide instead.

 - -MD output now goes to proper location
<rdar://problem/6723948> clang -MD puts dep file in /tmp with wrong name

 - -M and -MM still don't work correctly.

llvm-svn: 68022
2009-03-30 00:34:04 +00:00
Daniel Dunbar f64f5307dc Driver: Add test case for darwin::Preprocess and darwin::Compile
tools, and enable them.

llvm-svn: 68019
2009-03-29 22:27:40 +00:00
Daniel Dunbar afec1f58e9 Driver: Finish porting Darwin::Preprocess and Compile port (still
unused, and lacking a test case).
 - ccc is now on death row, pending some more testing and bug fixes.

llvm-svn: 68012
2009-03-29 18:40:18 +00:00
Daniel Dunbar e6adeeece3 Driver: Start porting Darwin::Preprocess and Compile implementations
(currently unused).

llvm-svn: 68003
2009-03-29 17:08:39 +00:00
Daniel Dunbar a21c833d74 Driver: Pass -f[no-]pascal-strings on to clang, even if it has been
turned into -m[no-]pascal-strings by the tool chain.
 - This still has issue that derived arguments don't propogate "used"
   information correctly so spurious "argument unused" warnings will
   still show up.

llvm-svn: 67841
2009-03-27 15:22:28 +00:00
Daniel Dunbar c196421fbc Driver: Add darwin::Link tool.
- <rdar://problem/6717381> [driver] implement ld argument translation
   in new driver

llvm-svn: 67760
2009-03-26 16:23:12 +00:00
Ted Kremenek 759d5d3fa7 Turn on -analyzer-eagerly-assume by default when using 'clang-cc' to perform
static analysis.

llvm-svn: 67665
2009-03-25 00:38:14 +00:00
Daniel Dunbar 1386495406 Driver: Handle -flto, -O4, and tweak -emit-llvm to match llvm-gcc.
- -emit-llvm no longer changes what compilation steps are done.

 - -emit-llvm and -emit-llvm -S write output files with .o and .s
    suffixes, respectively.

 - <rdar://problem/6714125> clang-driver should support -O4 and -flto,
   like llvm-gcc

llvm-svn: 67645
2009-03-24 20:17:30 +00:00
Daniel Dunbar 038f5d6ef0 Driver: Translate -fverbose-asm for LLVM backend.
- <rdar://problem/6715707> driver should translate -fverbose-asm into
   -asm-verbose

llvm-svn: 67634
2009-03-24 17:59:06 +00:00
Daniel Dunbar d7a1860eba Driver: Forward -MMD (not -MM) to clang-cc; this got lost in
translation, the former we support, the later we don't (yet).

llvm-svn: 67611
2009-03-24 07:20:59 +00:00
Daniel Dunbar a45cf5b6b0 Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.

llvm-svn: 67602
2009-03-24 02:24:46 +00:00
Daniel Dunbar 06686abfdc Driver: lipo wasn't being called correctly (translation failure from
ccc due to the different way we handle output arguments).

llvm-svn: 67583
2009-03-24 00:24:37 +00:00
Daniel Dunbar 1773177a99 Driver: Add two special groups of "whitelisted" options which we know
clang doesn't support, and don't want to warn are unused. Eventually
these should disappear.

Here is a more readable list than is in the diff:

W options: -Wall, -Wcast-align, -Wchar-align, -Wchar-subscripts,
-Werror, -Wextra, -Winline, -Wint-to-pointer-cast, -Wmissing-braces,
-Wmost, -Wnested-externs, -Wno-format-y2k, -Wno-four-char-constants,
-Wno-missing-field-initializers, -Wno-trigraphs, -Wno-unknown-pragmas,
-Wno-unused-parameter, -Wparentheses, -Wpointer-arith,
-Wpointer-to-int-cast, -Wreturn-type, -Wshorten-64-to-32, -Wswitch,
-Wunused-function, -Wunused-label, -Wunused-value, -Wunused-variable,
-Wwrite-strings.

f options: -fasm-blocks, -fmessage-length=.

llvm-svn: 67549
2009-03-23 19:03:36 +00:00
Daniel Dunbar 60196720eb Driver: Switch to using -include-pth.
llvm-svn: 67393
2009-03-20 19:38:56 +00:00
Daniel Dunbar be2208472c Driver: Add and use darwin::Assemble tool.
- Based on patch from Pieter de Bie; thanks!

llvm-svn: 67379
2009-03-20 16:06:39 +00:00
Daniel Dunbar 64ed5e3730 Driver: Add darwin::Lipo tool.
llvm-svn: 67355
2009-03-20 00:52:38 +00:00
Daniel Dunbar 403c468065 Driver/clang: -mattr strings were not comma separated.
- Apologies for commits w/o test cases; they are coming.

llvm-svn: 67310
2009-03-19 17:36:04 +00:00
Daniel Dunbar 2da027244d Driver: Claim -arch options when pipelining, and claim arguments that
are forwarded to GCC.
 - The later is unfortunate, as it prevents us from generally warning
   about anything interesting on platforms that use a generic
   toolchain. However, we can't do much better without significantly
   complicating things, and generally we should have proper tool chain
   definitions.

llvm-svn: 67293
2009-03-19 07:55:12 +00:00
Daniel Dunbar 5cdf3e0fb9 Driver: Handle "linker input" arguments.
- Make InputInfo a variant of filename, pipe, input argument,
   nothing.

 - Leave a FIXME in InputInfo that this should be revisited.

llvm-svn: 67292
2009-03-19 07:29:38 +00:00
Daniel Dunbar 7ef5ed6c16 Driver: Fix bug in translating -O to clang, add clang-translation test
case.

llvm-svn: 67257
2009-03-18 23:39:35 +00:00