Commit Graph

767 Commits

Author SHA1 Message Date
Daniel Dunbar 6596984f3c Driver/Darwin: Fix a crash when diagnosing conflicting deployment targets.
llvm-svn: 94812
2010-01-29 17:02:25 +00:00
Douglas Gregor ac0605e927 Introduce serialization and deserialization of diagnostic information
so that CIndex can report diagnostics through the normal mechanisms
even when executing Clang in a separate process. This applies both
when performing code completion and when using ASTs as an intermediary
for clang_createTranslationUnitFromSourceFile().

The serialized format is not perfect at the moment, because it does
not encapsulate macro-instantiation information. Instead, it maps all
source locations back to the instantiation location. However, it does
maintain source-range and fix-it information. To get perfect fidelity
from the serialized format would require serializing a large chunk of
the source manager; at present, it isn't clear if this code will live
long enough for that to matter.

llvm-svn: 94740
2010-01-28 06:00:51 +00:00
Daniel Dunbar f48d51d693 Driver/Darwin: Eliminate invalid uses of DarwinVersion -- this fixes a number of
defaults when targetting iPhoneOS (blocks, non-fragile ABI, stack protector).

llvm-svn: 94642
2010-01-27 00:57:11 +00:00
Daniel Dunbar 6d23b2f503 Driver/Darwin: Simplify target version checks.
llvm-svn: 94641
2010-01-27 00:57:03 +00:00
Daniel Dunbar 8360803a8a Driver/Darwin: Fix a few link arguments when targetting different iPhoneOS
versions to match gcc (which is matching linker changes).

llvm-svn: 94640
2010-01-27 00:56:56 +00:00
Daniel Dunbar b73bb5d085 Driver/Darwin: Switch clang -triple synthesis to use computed target information.
llvm-svn: 94639
2010-01-27 00:56:49 +00:00
Daniel Dunbar 7c870175eb Driver/Darwin: Eliminate confusing IsIPhoneOS parameter -- this was actually
just indicating whether the default target should be iPhoneOS.

llvm-svn: 94638
2010-01-27 00:56:44 +00:00
Daniel Dunbar 15c8942baf Driver/Darwin: Switch to using isTargetIPhoneOS where appropriate.
llvm-svn: 94637
2010-01-27 00:56:37 +00:00
Daniel Dunbar 3b8e50d0ed Driver/Darwin: Track target platform more explicitly in tool chain, eventually
this should just be part of the tool chain itself once we have eliminated
argument translation.

llvm-svn: 94635
2010-01-27 00:56:25 +00:00
Daniel Dunbar 19afd61201 Simplify.
llvm-svn: 94503
2010-01-26 03:56:40 +00:00
Daniel Dunbar d54669d30b Driver/Darwin: Honor IPHONEOS_DEPLOYMENT_TARGET.
llvm-svn: 94488
2010-01-26 01:45:19 +00:00
Daniel Dunbar d86666ffd7 Driver/Darwin: Stuff iPhoneOS into environment portion of the (llvm/clang) triple instead of keying off architecture. Also, fix version define to properly include the revision/micro component of the version number.
llvm-svn: 94487
2010-01-26 01:44:04 +00:00
Daniel Dunbar 4e29505a95 Driver: Fix fallback to gcc to -c instead of -S if trying to generate an LLVM bc
file.

llvm-svn: 94463
2010-01-25 22:35:08 +00:00
Daniel Dunbar fcf2d428e4 ASTUnit: Don't check that input files exist when parsing ASTs from the command
line -- they may be remapped (fake) files. This is useful for testing parsing
entirely from memory.

llvm-svn: 94395
2010-01-25 00:44:02 +00:00
Chris Lattner 0bcc858a2b -fno-rtti is now the default.
llvm-svn: 94379
2010-01-24 20:43:31 +00:00
Ted Kremenek 4c0df3dc1d Rename getClangFullVendorVersion() to getClangFullVersion().
llvm-svn: 94273
2010-01-23 02:11:34 +00:00
Ted Kremenek 51b8bc93f8 Move version string generation (e.g., "clang 1.1 ...") to libBasic/Version.cpp, getClangFullVendorVersion().
llvm-svn: 94235
2010-01-22 22:29:50 +00:00
Ted Kremenek 18e066f6a9 (1) Rename getClangSubversionRevision() to getClangRevision(), and
have it return a StringRef instead of an integer (to be more VCS
    agnostic).

(2) Add getClangFullRepositoryVersion(), which contains an
    amalgamation of the repository name and the revision.

(3) Change PCH to only emit the string returned by
    getClangFullRepositoryVersion() instead of also emitting the value
    of getClangSubversionRevision() (which has been removed).  This is
    functionally equivalent.

More cleanup to version string generation pending...

llvm-svn: 94231
2010-01-22 22:12:47 +00:00
Ted Kremenek 2377a0e0ea Rename getClangSubversionPath() -> getClangRepositoryPath() and have it return a StringRef.
llvm-svn: 94213
2010-01-22 20:55:35 +00:00
Daniel Dunbar 7cde09ac8a Driver/Darwin: Update tool chain to use static clang_rt libraries provided by
compiler-rt. This tool chain now works on x86 and ARM, but isn't the x86 default
yet. 

This drastically cleans up the linker invocation, old invocation:
--
"/Developer/usr/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-weak_reference_mismatches" "non-weak" "-o" "a.out" "-lcrt1.10.6.o" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64" "-L/usr/lib/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.." "t.o" "-lSystem" "-lgcc"
--

New invocation:
--
# For 10.6:
 "/usr/bin/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-o" "a.out" "-lcrt1.10.6.o" "t.o" "-lSystem"
# For 10.4:
 "/usr/bin/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.4" "-o" "a.out" "-lcrt1.o" "t.o" "-lSystem" "-lgcc_s.10.4" "/Volumes/Data/ddunbar/llvm.obj.64/Debug/lib/clang/1.1/lib/darwin/libclang_rt.10.4.a"
--

llvm-svn: 94150
2010-01-22 03:38:14 +00:00
Daniel Dunbar 93d7acfcf2 Driver/Darwin/ld: Fix refacto, -force_cpusubtype_ALL should only be forwarded,
not always added.

llvm-svn: 94149
2010-01-22 03:37:33 +00:00
Daniel Dunbar dcc3b657f2 Driver/Darwin/ld: Factor out getDarwinArchName, for getting the "Darwin" arch
name being used in an driver invocation.

llvm-svn: 94139
2010-01-22 02:04:58 +00:00
Daniel Dunbar a48823fdbe Driver/Darwin/ld: Eliminate AddDarwinSubArch, our linker invocation is going to
diverge from gcc anyway.

llvm-svn: 94138
2010-01-22 02:04:52 +00:00
Daniel Dunbar 3f3e2cd820 Driver: Lift clang resource directory computation to the Driver object.
llvm-svn: 93971
2010-01-20 02:35:16 +00:00
Ted Kremenek bb1110a7ae Fix possible memory leak by using an OwningPtr.
llvm-svn: 93834
2010-01-19 01:29:05 +00:00
Daniel Dunbar 6bc5be24fa Remove ../libexec from clang program search path, clang-cc is dead.
llvm-svn: 93749
2010-01-18 19:16:53 +00:00
Daniel Dunbar 620327d66b Fix a FIXME.
llvm-svn: 93087
2010-01-10 00:46:10 +00:00
Daniel Dunbar 1c4788b66b Darwin/ld: Don't pass '-weak_reference_mismatches non-weak' when
-weak_reference_mismatches is not present, it is the default.

llvm-svn: 93086
2010-01-10 00:46:00 +00:00
Chris Lattner e23003d1f1 implement -ftabstop=width, patch by Christian Adåker
llvm-svn: 93078
2010-01-09 21:54:33 +00:00
Dan Gohman d1e76b957b Use -fno-math-errno by default, and remove the IsMathErrnoDefault
targethook, which is no longer being used. This fixes PR5971.

llvm-svn: 92987
2010-01-08 02:20:44 +00:00
Nate Begeman 0e1a625fe4 Allow clang to pass -x cl through to compiler driver.
llvm-svn: 92686
2010-01-05 06:00:15 +00:00
Benjamin Kramer d20ef75b91 Remove some dead variables clang-analyzer found.
llvm-svn: 92162
2009-12-25 15:43:36 +00:00
Nuno Lopes cfca1f0dc1 move a few more symbols to .rodata/.data.rel.ro
llvm-svn: 92012
2009-12-23 17:49:57 +00:00
Daniel Dunbar e0d2691b88 Driver: Fix '... -O4 -O0 ...', which was generating bitcode.
llvm-svn: 91962
2009-12-23 00:47:42 +00:00
Daniel Dunbar f4894fe0eb Driver: Drop ToolChain::getHost()
llvm-svn: 91960
2009-12-23 00:46:38 +00:00
Daniel Dunbar c7a67b7877 Driver: When linking, don't warn about unused arguments which are obviously only
used during compilation.
 - There is no easy way to define this group properly, unfortunately, and maybe
   this is a losing strategy. For now this is unambiguous more friendly, though.

llvm-svn: 91940
2009-12-22 23:19:32 +00:00
Daniel Dunbar 0def3d17cb ARM: Honor -mfpu= and set __VFP_FP__ and __ARM_NEON__ "correctly".
- Correctly is in quotes, because we are following what I interpreted as GCC's
   intent (which diverges from practice, naturally).
 - Also, fix the arch define for arm1136jf-s.

llvm-svn: 91855
2009-12-21 23:28:17 +00:00
Daniel Dunbar 083edf70a5 Add ToolChain::getDriver() and use it instead of going through the HostInfo
object.

llvm-svn: 91830
2009-12-21 18:54:17 +00:00
Daniel Dunbar e017ecc9e2 Remove ';' after method definition. Noticed by clang++, which one would think
would have a higher respect for its own code. This is getting old, is this
warning really adding value?

llvm-svn: 91779
2009-12-19 17:50:07 +00:00
Daniel Dunbar 893d475ba8 ARM: Use front-end specific target features "soft-float" and "soft-float-abi" to communicate FP mode to target; __SOFTFP__ is set correctly now.
llvm-svn: 91755
2009-12-19 04:15:38 +00:00
Daniel Dunbar a7d0231b66 clang -cc1: Rename -mcpu to -target-cpu to match other target options and not alias driver/backend option.
llvm-svn: 91671
2009-12-18 06:30:12 +00:00
Daniel Dunbar 24c7f5efc5 Add -dwarf-debug-flags, which provides a way to embed the cc1 level options used
to compile a translation unit into the debug info for that file.
 - Used by parts of Darwin build process to check compiler flags, etc.
 - <rdar://problem/7256886> clang does not emit AT_APPLE_flags

llvm-svn: 91661
2009-12-18 02:43:17 +00:00
Daniel Dunbar 15cef0ed42 Fix -fdollars-in-identifiers Clang translation.
llvm-svn: 91562
2009-12-16 20:10:18 +00:00
Nuno Lopes 13c88c7269 implement PR5654: add -fassume-sane-operator-new, which is enabled by default, and adds the malloc attribute to the global function new() and to the overloaded new operators.
feel free to chage the name to this lengthy argument

llvm-svn: 91543
2009-12-16 16:59:22 +00:00
Daniel Dunbar 34e0b8cdee Driver: Pass -resource-dir to clang -cc1, since the driver presumably already found itself.
llvm-svn: 91384
2009-12-15 01:02:52 +00:00
Jeffrey Yasskin 1615d45daa Un-namespace-qualify llvm_unreachable. It's a macro, so the qualification gave
no extra safety anyway.

llvm-svn: 91207
2009-12-12 05:05:38 +00:00
Mike Stump d954638f02 Implement runtime checks for undefined behavior. WIP.
This implements a new flag -fcatch-undefined-behavior.  The flag turns
on additional runtime checks for:

  T a[I];

  a[i]    abort when i < 0 or i >= I.

Future stuff includes shifts by >= bitwidth amounts.

llvm-svn: 91198
2009-12-12 01:27:46 +00:00
Ted Kremenek eadc7c3537 Make using '-fshort-enums' an error until it is actually implemented (changes the ABI, so it is dangerous to not error out if we don't support it). Fixes <rdar://problem/7461006>.
llvm-svn: 91191
2009-12-12 00:38:18 +00:00
Daniel Dunbar 6c536aa0fb Driver: Switch to using "clang" "-cc1" instead of "clang-cc".
llvm-svn: 91174
2009-12-11 23:00:49 +00:00
Nuno Lopes 221c1fd63e spread 'const' love to some variables. this considerably reduces the amount of dirty data around.
llvm-svn: 91002
2009-12-10 00:07:02 +00:00
Daniel Dunbar 6cc525b44e Unbreak clang-cc handling of -msoft-float / -mfloat-abi=, which I borked.
llvm-svn: 90873
2009-12-08 19:49:51 +00:00
Jeffrey Yasskin 567ae47b4a Remove several .c_str() to be forward-compatible with StringRef.
llvm-svn: 90822
2009-12-08 01:46:24 +00:00
Ted Kremenek 7bea9a1672 Enable '-analyzer-opt-analyze-nested-blocks' by default for testing.
llvm-svn: 90812
2009-12-07 22:26:14 +00:00
Rafael Espindola 59ae799efa Shorten the help test for -no-canonical-prefixes, put it behind HelpHidden and
claim it in Driver.cpp instead of Tools.cpp.

llvm-svn: 90777
2009-12-07 18:28:29 +00:00
Daniel Dunbar 1b52d8c4ec Unbreak -ccc-cxx and -ccc-clang-cxx defaulting.
llvm-svn: 90629
2009-12-05 00:13:59 +00:00
Daniel Dunbar acd6957b59 Driver: Switch -ccc-* options to using the standard options functionality.
- I still want to get rid of them, but manually handling them isn't adding value.

llvm-svn: 90602
2009-12-04 21:55:23 +00:00
Daniel Dunbar 78e9de56f4 OptTable: Allow option groups to be used to define "help groups", which will
collate the options inside that group.

llvm-svn: 90592
2009-12-04 21:08:40 +00:00
Daniel Dunbar 250bd17374 OptParser: Add HelpHidden flag.
llvm-svn: 90591
2009-12-04 21:08:25 +00:00
Rafael Espindola 73d4637545 Add gcc's -no-canonical-prefixes option to clang.
llvm-svn: 90577
2009-12-04 19:31:58 +00:00
Daniel Dunbar e357d5689e Fix Clang tool translation to forward -fvisibility as separate arguments, the
old syntax isn't supported.

llvm-svn: 90469
2009-12-03 18:42:11 +00:00
Daniel Dunbar 65b9952c2e Add OptTable::PrintHelp.
llvm-svn: 90420
2009-12-03 07:01:38 +00:00
Daniel Dunbar 120c77e4e9 Driver: Add Command::Creator member variable, which tracks the tool that was
used to create a particular command.

llvm-svn: 90287
2009-12-02 03:23:25 +00:00
Daniel Dunbar c70c39300f clang -cc1: Move CompilerInvocation deserialization into CompilerInvocation.cpp,
where it belongs.

llvm-svn: 90198
2009-12-01 03:16:53 +00:00
Daniel Dunbar a74f8ff15c Add CodeGenOptions::{SoftFloat,FloatABI}, and update the all the (far too many) places to use this instead of using the backend -soft-float and -float-abi= options.
llvm-svn: 90127
2009-11-30 08:42:00 +00:00
Daniel Dunbar 91dea8252a clang -cc1: Fix initialization of PreprocessorOptions::TokenCache.
llvm-svn: 90126
2009-11-30 08:41:42 +00:00
Daniel Dunbar 8c317acd2b clang -cc1: Fix -include-pch now that the test code is in clang-cc.
llvm-svn: 90124
2009-11-30 08:41:22 +00:00
Daniel Dunbar 599abb2d56 clang -cc1: Initialize LangOptions::{Optimize,NoInline}
llvm-svn: 90123
2009-11-30 08:41:13 +00:00
Daniel Dunbar 84bb793718 Always pass -fmessage-length using separate arguments.
llvm-svn: 90121
2009-11-30 08:40:54 +00:00
Daniel Dunbar 0429c5ef3a clang -cc1: Initialize LangOptions::DollarIdents correctly.
llvm-svn: 90120
2009-11-30 08:40:46 +00:00
Daniel Dunbar 2c11cd156e Don't try to generate common globals for C++ files, instead of depending on the FE to set NoCommon, and simplify CodeGenOptions initialization.
llvm-svn: 90119
2009-11-30 08:40:34 +00:00
Daniel Dunbar 8e70505692 Eliminate CodeGenOptions::TimePasses.
llvm-svn: 90118
2009-11-30 08:39:52 +00:00
Daniel Dunbar de18224d9c Eliminate CodeGenOptions::SimplifyLibCalls.
llvm-svn: 90117
2009-11-30 08:39:32 +00:00
Daniel Dunbar 0ac66427a9 clang -cc1: Use proper diagnostics for all parsing errors.
llvm-svn: 90100
2009-11-29 21:52:53 +00:00
Daniel Dunbar fcb9caa772 Change CompilerInvocation::CreateFromArgs to report errors using a proper diagnostic engine.
- Clients that care about having the diagnostics output honor the user-controllable diagnostic options can buffer the diagnostics and issue them later.

llvm-svn: 90092
2009-11-29 20:58:50 +00:00
Daniel Dunbar 65ca1c6f02 Change CompilerInvocation::CreateFromArgs to take Argv0 and the address of main (or something in the main executable) so it can find the builtin compiler files.
llvm-svn: 90090
2009-11-29 20:58:32 +00:00
Daniel Dunbar a1b02a2380 Move LLVM backend options to explicit clang-cc / clang -cc1 options, which we then manually pass to the command line library; eventually the latter grossness should be fixed by a real API when creating the target machine.
llvm-svn: 90063
2009-11-29 07:18:39 +00:00
Daniel Dunbar 0317c4c5b7 Add clang -cc1 parsing for LangOptions.
- This is the last major parsing piece, main FIXMEs remain.

llvm-svn: 90059
2009-11-29 05:52:21 +00:00
Daniel Dunbar 5fe0866b9d clang-cc: Change -fsigned-char=0 to -fno-unsigned-char and pass -pic-level using separate args.
llvm-svn: 90054
2009-11-29 02:39:08 +00:00
Daniel Dunbar 9eac065e67 Move MainFileName option variable into CodeGenOptions instead of LangOptions.
llvm-svn: 90051
2009-11-29 02:38:34 +00:00
Daniel Dunbar 7ab5c491c1 Remove header which is bringing libAST in (on MSVC).
llvm-svn: 89946
2009-11-26 09:57:25 +00:00
Daniel Dunbar 5337f0c842 Fix thinko (-fno-builtin != -nobuiltininc).
llvm-svn: 89918
2009-11-26 02:14:16 +00:00
Daniel Dunbar 81fe60b787 Add clang -cc1 parsing for preprocessor options.
llvm-svn: 89917
2009-11-26 02:14:07 +00:00
Daniel Dunbar cbc693579c Add clang -cc1 parsing for header search options.
llvm-svn: 89916
2009-11-26 02:13:54 +00:00
Daniel Dunbar 44b36ee78c What the FIXMEs want, the FIXMEs shall have.
llvm-svn: 89861
2009-11-25 11:53:23 +00:00
Daniel Dunbar b8c2f7d950 Add an arg_iterator, for iterating over a subset of arguments in an ArgList.
llvm-svn: 89860
2009-11-25 11:33:30 +00:00
Daniel Dunbar ad2278d74c Add clang -cc1 parsing for frontend options.
llvm-svn: 89856
2009-11-25 10:14:52 +00:00
Daniel Dunbar 9efcf351bd Add clang -cc1 parsing for preprocessor output options (-E).
llvm-svn: 89854
2009-11-25 10:14:37 +00:00
Daniel Dunbar 5bdd299bfd Don't pass -fexceptions=0 (it is the default).
llvm-svn: 89853
2009-11-25 10:14:30 +00:00
Edward O'Callaghan c92791193d Fix for Path::isSpecialFile to Path::isRegularFile API in rev 89765.
llvm-svn: 89849
2009-11-25 06:33:27 +00:00
Edward O'Callaghan db521ec23b Fix for PR5568.
llvm-svn: 89766
2009-11-24 15:23:21 +00:00
Daniel Dunbar 8d731964d0 Sketch the rest of the clang -cc1 option definitions, aka fun with C-x C-(.
llvm-svn: 89721
2009-11-24 00:54:16 +00:00
Daniel Dunbar 8a9fa3af69 Add clang -cc1 parsing of diagnostic options.
llvm-svn: 89716
2009-11-23 23:41:17 +00:00
Daniel Dunbar 180f1fe4ce Recognize .hpp as a C++ header.
llvm-svn: 89630
2009-11-22 22:08:27 +00:00
Daniel Dunbar f5835ea2e7 Add clang -cc1 parsing of analyzer options.
llvm-svn: 89629
2009-11-22 22:08:20 +00:00
Daniel Dunbar f4b39e9c95 Fix refacto, gcc's cc1 needs to see --output-pch=, which is not just an alias
for -output-pch=.

llvm-svn: 89534
2009-11-21 02:31:29 +00:00
Daniel Dunbar a764eef0e9 Driver: Add clang -cc1 dependency output options parsing.
llvm-svn: 89508
2009-11-20 23:28:07 +00:00
Daniel Dunbar a604639635 Switch CompilerInvocation::CreateFromArgs to take const char** arguments until Driver itself switches to StringRef.
llvm-svn: 89503
2009-11-20 22:47:55 +00:00
Daniel Dunbar 4274685b63 Pass '-mcpu' 'FOO' instead of '-mcpu=FOO'.
llvm-svn: 89498
2009-11-20 22:21:52 +00:00
Daniel Dunbar 8bed86c43e Standardize Driver translation to call clang-cc using '-foo' form instead of '--foo'.
llvm-svn: 89497
2009-11-20 22:21:36 +00:00
Daniel Dunbar 69fd86dd44 Add clang -cc1 parsing of CodeGenOptions.
llvm-svn: 89464
2009-11-20 17:23:30 +00:00
Daniel Dunbar f7535121a2 Driver: Add parsing for TargetOptions to CompilerInvocation::CreateFromArgs.
llvm-svn: 89435
2009-11-20 01:46:44 +00:00
Daniel Dunbar 84e8a249fa Fix some default in the option classes, and some CompilerInvocation argification
errors.

llvm-svn: 89388
2009-11-19 20:54:59 +00:00
Daniel Dunbar 8c9efca5bd Driver: Move INPUT and UNKNOWN sentinel options into the OptParser.td file.
llvm-svn: 89371
2009-11-19 18:47:17 +00:00
Daniel Dunbar f57e69c78a Add missing dependency for CMake.
llvm-svn: 89332
2009-11-19 07:37:40 +00:00
Daniel Dunbar be6ef3874f Sketch .td file and build system goop for OptTable based clang-cc options.
llvm-svn: 89330
2009-11-19 07:19:04 +00:00
Daniel Dunbar 52ed5feee5 Factor out OptTable::ParseArgs, for parsing an entire argument vector.
llvm-svn: 89327
2009-11-19 06:35:06 +00:00
Daniel Dunbar 484afa2d3b Switch -f{builtin,math-errno,rtti} and -analyzer-purge-dead to -...no... variants instead of using llvm:🆑:init(true) arguments.
llvm-svn: 89315
2009-11-19 04:55:23 +00:00
Daniel Dunbar da13faf982 Driver: ArgList doesn't depend on Options.h anymore.
llvm-svn: 89313
2009-11-19 04:25:22 +00:00
Daniel Dunbar b323fd72ab Driver: Take option ID for {Input,Unknown}Option, to drop dependency on actual options.
llvm-svn: 89312
2009-11-19 04:25:06 +00:00
Daniel Dunbar 8c00957008 Driver: Introduce OptSpecifier class for protecting access to an option id.
llvm-svn: 89310
2009-11-19 04:14:53 +00:00
Daniel Dunbar fffd18167d Driver: Switch to using explicit {getLast,has}ArgNoClaim functions instead of taking a Claim argument.
- Most driver code always claims, and bool arguments don't play nice with the overloads.

llvm-svn: 89308
2009-11-19 04:00:53 +00:00
Daniel Dunbar b3b47b8dde Driver: Resolve inconsistency in matching options against options which are
aliases -- just treat this case as an (unchecked) client error.

llvm-svn: 89306
2009-11-19 03:26:50 +00:00
Daniel Dunbar 0bfb21e4b0 Use Option::matches instead of direct ID comparison.
llvm-svn: 89305
2009-11-19 03:26:40 +00:00
Daniel Dunbar 46fffee081 Driver: Switch to using TableGen'erated Options.inc instead of Options.def file.
llvm-svn: 89288
2009-11-19 01:03:50 +00:00
Daniel Dunbar aa767378ac Driver: Split OptTable out into OptTable.{h,cpp}
llvm-svn: 89283
2009-11-19 00:15:11 +00:00
Daniel Dunbar 7147de2c4e Make MSVC happy.
llvm-svn: 89247
2009-11-18 21:42:57 +00:00
Daniel Dunbar 26228a0d7a Driver: Rework OptTable to have no dependency on the options it manages.
llvm-svn: 89234
2009-11-18 20:19:36 +00:00
Daniel Dunbar a76762c9fb Driver: Make local type name more distinct.
llvm-svn: 89233
2009-11-18 20:19:26 +00:00
Daniel Dunbar f324fa7095 Driver: Store Option ID field as unsigned to drop dependency on the options
type.

llvm-svn: 89232
2009-11-18 20:19:19 +00:00
Daniel Dunbar 21432d38a0 Driver: Switch Options.def to storing flags as a bitmask (instead of mangled
into a string).

llvm-svn: 89212
2009-11-18 17:42:34 +00:00
Edward O'Callaghan c14422223b Fix passing stdc++ correctly in the FreeBSD toolchain support, Credit to Roman Divacky.
llvm-svn: 89205
2009-11-18 14:51:31 +00:00
David Chisnall 950a9518b1 Added block type introspection support.
As per Fariborz's suggestion, committed now but can be reverted later if the used flag is problematic for Apple.

llvm-svn: 89134
2009-11-17 19:33:30 +00:00
Daniel Dunbar 4930e3357b Add -fblocks, -stack-protector, and -fobjc-nonfragile-abi defaulting to driver,
instead of using getDefaultLangOptions.
 - Remove unused -fobjc-tight-layout while at it.

llvm-svn: 89065
2009-11-17 08:07:36 +00:00
Daniel Dunbar f408303a3f Add driver::types::isObjC predicate.
llvm-svn: 89064
2009-11-17 08:07:16 +00:00
Daniel Dunbar 4656c53e12 Move -fnext-runtime defaulting to driver (and change clang-cc default to
-fnext-runtime), instead of using getDefaultLangOptions.

llvm-svn: 89058
2009-11-17 07:07:28 +00:00
Daniel Dunbar 0730e4f7e0 Move -fms-extensions defaulting to driver, instead of using getDefaultLangOptions.
llvm-svn: 89057
2009-11-17 07:06:20 +00:00
Daniel Dunbar d609b7bbe9 Move char-is-signed defaulting to driver, instead of using
getDefaultLangOptions.

llvm-svn: 89053
2009-11-17 06:37:03 +00:00
Daniel Dunbar e13ada6a3b Add clang -mcpu=native support, patch by Roman Divacky, varioustweaks by me.
- We still need support for detecting the target features, since the name
   doesn't actually do a good job of decribing what the CPU supports (for LLVM).

llvm-svn: 88819
2009-11-14 22:04:54 +00:00
Edward O'Callaghan 932c32043a Fix for FreeBSD toolchain in regards to CPP, Credit to Roman Divacky.
llvm-svn: 86459
2009-11-08 10:13:36 +00:00
John Thompson ed4e2950bc Adding -fshort-wchar option.
llvm-svn: 86167
2009-11-05 20:14:16 +00:00
Daniel Dunbar 5ec950218a Move -fcolor-diagnostics logic to driver.
llvm-svn: 86014
2009-11-04 06:24:57 +00:00
Daniel Dunbar 2c9784769a Move logic for selection -fmessage-length= to driver.
llvm-svn: 86013
2009-11-04 06:24:47 +00:00
Daniel Dunbar 1c7577c9bd Fix indentation.
llvm-svn: 86011
2009-11-04 06:24:38 +00:00
Tanya Lattner f9d41df093 Merge constant array and structures. This will create a global variables for arrays and structs that are constant and their initializer is constant. It is on by default but can be disable with the flag -fno-merge-all-constants.
llvm-svn: 85991
2009-11-04 01:18:09 +00:00
Chris Lattner e9d7d78ab3 Implement support for the -undef command line option, patch by
Roman Divacky! PR5363

llvm-svn: 85932
2009-11-03 19:50:27 +00:00
Mike Stump 0a65b636ce Fix -pthread on dragonfly. Patch by Sascha Wildner.
llvm-svn: 85679
2009-10-31 20:11:46 +00:00
Daniel Dunbar 624c21b029 Change the driver to do the Darwin triple mangling itself instead of forwarding
-mmacosx-version-min and -miphoneos-version-min to clang-cc.

llvm-svn: 85600
2009-10-30 18:12:20 +00:00
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
Daniel Dunbar 820782aae0 Driver: Fix thinko in logic for finding gcc's tool chain directory.
llvm-svn: 84805
2009-10-22 00:12:00 +00:00
Benjamin Kramer 961b4e3edb Driver: don't produce bogus osx version numbers if no version (aka 0) was specified.
llvm-svn: 84781
2009-10-21 21:05:07 +00:00
Daniel Dunbar f4534ee0a3 Driver: If unable to find the gcc tool chain, try the next OS rev.
llvm-svn: 84656
2009-10-20 19:25:43 +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
Mike Stump 727170d2d8 Allow customization for the version line.
llvm-svn: 83652
2009-10-09 17:31:54 +00:00
Douglas Gregor 01249503fe Installation of Clang libraries and headers, from Axel Naumann!
llvm-svn: 83582
2009-10-08 22:15:31 +00:00
Ted Kremenek 7881ac97a5 Revert r83443.
llvm-svn: 83451
2009-10-07 03:21:11 +00:00
Mike Stump db9fca7735 Fixup pathnames.
llvm-svn: 83443
2009-10-07 01:11:54 +00:00
Rafael Espindola 7787d79c7b Add the -nostdclanginc option to clang (the driver).
llvm-svn: 83377
2009-10-06 12:45:37 +00:00
Douglas Gregor 1b7035da6f Provide a common set of routines in Version.h that return Subversion
branch/revision information. Use that information in the driver,
rather than one-off branch/revision computation. 

llvm-svn: 83321
2009-10-05 20:33:49 +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
Daniel Dunbar d71a03b164 Fix truck sized thinko where Darwin/ARM toolchain didn't look for programs in
libexec, *blush*.

llvm-svn: 83086
2009-09-29 18:52:10 +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 5564ba743f Push "clang-is-production" logic up to tools/driver, and make it hittable by
defining the CLANG_IS_PRODUCTION Makefile variable.

llvm-svn: 82583
2009-09-22 22:31:13 +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 07806ca7ab Improve driver error message when only running the preprocessor and an input is
already preprocessed.

--
ddunbar@giles:tmp$ touch t.i
ddunbar@giles:tmp$ gcc -E t.i
ddunbar@giles:tmp$ clang -E t.i
clang: warning: t.i: previously preprocessed input unused when '-E' is present
ddunbar@giles:tmp$ 
--

<rdar://problem/6813375> [driver] driver prints confusing message when running -E on preprocessed file

llvm-svn: 82120
2009-09-17 04:13:26 +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 3c7b9ca4bf Improve Darwin argument translation to match what the driver driver does.
llvm-svn: 81391
2009-09-09 22:33:15 +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 5f620c1fac StringRefize ArgList construction of ArgStrings.
llvm-svn: 81385
2009-09-09 22:32:26 +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
Daniel Dunbar e7af341454 Push bound architecture name into TranslateArgs.
llvm-svn: 81366
2009-09-09 18:36:12 +00:00
Daniel Dunbar b5d86bbd76 Push bound architecture name into Compilation::getArgsForToolChain.
llvm-svn: 81365
2009-09-09 18:36:01 +00:00
Mike Stump 11289f4280 Remove tabs, and whitespace cleanups.
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Daniel Dunbar faabdc3b81 Change Darwin toolchain lookup to use llvm::Triple.
- -2+1 FIXMEs.

llvm-svn: 81282
2009-09-08 23:37:36 +00:00
Daniel Dunbar 9c3f7c4a4b Validate arguments to -arch.
llvm-svn: 81281
2009-09-08 23:37:30 +00:00
Daniel Dunbar 1ef3f2aa3a Rename HostInfo::getToolChain to HostInfo::CreateToolChain, and don't recreate
the default tool chain when binding the default architecture.

llvm-svn: 81279
2009-09-08 23:37:19 +00:00