Commit Graph

1743 Commits

Author SHA1 Message Date
Aaron Ballman 1f10cc5eb4 No longer emitting a PCH file when using -fsyntax-only on a header file. Fixes PR13343.
llvm-svn: 161019
2012-07-31 01:21:00 +00:00
Jiangning Liu eabbf92223 Fix dynamic object linker for ARM GNUEABIHF.
llvm-svn: 160958
2012-07-30 11:05:56 +00:00
David Chisnall 5f99f48bcd Provide correct linker command line options on FreeBSD 8 (GNU ld 2.15) and on newer FreeBSD (GNU ld 2.17).
Patch by Dimitry Andric!

llvm-svn: 160931
2012-07-29 15:24:44 +00:00
NAKAMURA Takumi 836926dbdf clang/lib: [CMake] Update tblgen'd dependencies.
llvm-svn: 160851
2012-07-27 06:18:33 +00:00
NAKAMURA Takumi 075c89bc06 clang/lib: [CMake] Reformat, alphabetize lists.
llvm-svn: 160850
2012-07-27 06:18:12 +00:00
Chad Rosier ae7581dfd6 [driver crash diagnostics] Strip -internal-isystem and -internal-externc-isystem.
rdar://11949066

llvm-svn: 160752
2012-07-25 18:55:43 +00:00
Chad Rosier 7a42ff546a [driver crash diagnostics] Strip -idirafter, -iprefix, -iwithprefix,
-iwithprefixbefore, and -isystem options, per Matt's suggestion.
rdar://11949066

llvm-svn: 160750
2012-07-25 18:38:57 +00:00
Chad Rosier 959f0b3a07 [driver crash diagnostics] A few enhancements:
-Strip -iquote and -M options.
 -Quote -D options to avoid problems with command line macros that include
  parens.
rdar://11949066

llvm-svn: 160743
2012-07-25 17:52:16 +00:00
Chad Rosier d3957e57f6 Rename -fms-inline-asm to -fenable-experimental-ms-inline-asm.
llvm-svn: 160590
2012-07-20 23:12:26 +00:00
Chad Rosier ed94324e70 Add a new flag, -fms-inline-asm, that enables the output of MS-style inline
assembly.  

By default, we don't emit IR for MS-style inline assembly (see r158833 as to 
why).  This is strictly for testing purposes and should not be enabled with the
expectation that things will work.  This is a temporary flag and will be removed
once MS-style inline assembly is fully supported.

llvm-svn: 160573
2012-07-20 21:20:33 +00:00
Bob Wilson 6a039161d7 Define __FINITE_MATH_ONLY__ based on -ffast-math and -ffinite-math-only.
This macro was being unconditionally set to zero, preceded by a FIXME comment.
This fixes <rdar://problem/11845441>.  Patch by Michael Gottesman!

llvm-svn: 160491
2012-07-19 03:52:53 +00:00
Bob Wilson 25d3bfd895 Force the OS X version to 10.6 for old-style simulator builds.
The hack of recognizing a -D__IPHONE_OS_VERSION_MIN_REQUIRED option
in place of -mios-simulator-version-min leaves the Darwin version
unspecified.  It can be set separately with -mmacosx-version-min (which
makes no sense) or inferred to match the host version (which is unpredictable
and usually wrong).  This really needs to get cleaned up, but in the
meantime, force the OS X version to 10.6 so that the behavior is sane for
the iOS simulator.  Thanks for Argyrios for the patch.
<rdar://problem/11858187>

llvm-svn: 160484
2012-07-19 01:35:55 +00:00
NAKAMURA Takumi ed5bbe9020 [Win32] Rework crash-report since r145389.
- lib/Driver/Driver.cpp, tools/driver/driver.cpp: Exit status should not be propagated, although clang driver should catch exceptions.
  - test/Driver/crash-report.c: Add REQUIRES:shell for now.
    FIXME: setenv should work also on Lit.InternalShellRunner.
  - test/Driver/crash-report.c: Remove XFAIL.

Thanks to Chad, To point out the issue.

llvm-svn: 160343
2012-07-17 05:09:29 +00:00
David Chisnall df3045f0e3 Enable new linker behaviour on FreeBSD.
llvm-svn: 160231
2012-07-15 12:53:06 +00:00
NAKAMURA Takumi e5494ffe4f Revert r160052, "Default to -std=c++11 on Windows.", for now.
Failing Tests (3):
    Clang :: Index/complete-cxx-inline-methods.cpp
    Clang :: Index/recursive-cxx-member-calls.cpp
    Clang :: SemaTemplate/inject-templated-friend-post.cpp

llvm-svn: 160103
2012-07-12 03:14:56 +00:00
Chad Rosier 4dce73af05 [driver] Fix so that clang can find correct path prefix for libc object files
from GNU binutils supporting multi-arch folder for ARM target.
Patch by Jiangning Liu <jiangning.liu@arm.com>.

llvm-svn: 160060
2012-07-11 19:08:21 +00:00
Nico Weber cc19aec7ae Default to -std=c++11 on Windows.
llvm-svn: 160052
2012-07-11 16:46:17 +00:00
Chad Rosier 6213549751 80-column and whitespace.
llvm-svn: 159942
2012-07-09 17:31:28 +00:00
Ted Kremenek b22ea2acea Re-apply r159875 with fixes.
- Split pedantic driver flag test into separate test file, and XFAIL on cygwin,mingw32
- Fix bug in tablegen logic where a missing '{' caused errors to be included in -Wpedantic.

llvm-svn: 159892
2012-07-07 05:53:30 +00:00
NAKAMURA Takumi eec53e4069 Revert rr159875, "Implement -Wpedantic and --no-pedantic to complement -Weverything." It broke several builds.
I suspect FileCheck might match assertion failure, even if clang/test/Misc/warning-flags.c passed the test.

> 0. Program arguments: bin/./clang -### -pedantic -Wpedantic clang/test/Driver/warning-options.cpp

llvm-svn: 159886
2012-07-07 02:48:02 +00:00
Ted Kremenek 9877f689f2 Implement -Wpedantic and --no-pedantic to complement -Weverything.
This patch introduces some magic in tablegen to create a "Pedantic" diagnostic
group which automagically includes all warnings that are extensions.  This
allows a user to suppress specific warnings traditionally under -pedantic used
an ordinary warning flag.  This also allows users to use #pragma to silence
specific -pedantic warnings, or promote them to errors, within blocks of text
(just like any other warning).

-Wpedantic is NOT an alias for -pedantic.  Instead, it provides another way
to (a) activate -pedantic warnings and (b) disable them.  Where they differ
is that -pedantic changes the behavior of the preprocessor slightly, whereas
-Wpedantic does not (it just turns on the warnings).

The magic in the tablegen diagnostic emitter has to do with computing the minimal
set of diagnostic groups and diagnostics that should go into -Wpedantic, as those
diagnostics that already members of groups that themselves are (transitively) members
of -Wpedantic do not need to be included in the Pedantic group directly.  I went
back and forth on whether or not to magically generate this group, and the invariant
was that we always wanted extension warnings to be included in -Wpedantic "some how",
but the bookkeeping would be very onerous to manage by hand.

-no-pedantic (and --no-pedantic) is included for completeness, and matches many of the
same kind of flags the compiler already supports.  It does what it says: cancels out
-pedantic.  One discrepancy is that if one specifies --no-pedantic and -Weverything or
-Wpedantic the pedantic warnings are still enabled (essentially the -W flags win).  We
can debate the correct behavior here.

Along the way, this patch nukes some code in TextDiagnosticPrinter.cpp and CXStoredDiagnostic.cpp
that determine whether to include the "-pedantic" flag in the warning output.  This is
no longer needed, as all extensions now have a -W flag.

This patch also significantly reduces the number of warnings not under flags from 229
to 158 (all extension warnings).  That's a 31% reduction.

llvm-svn: 159875
2012-07-06 23:07:31 +00:00
Lang Hames aa53b936ec Add -ffp-contract = { fast | on | off } command line option support.
This flag sets the 'fp-contract' mode, which controls the formation of fused
floating point operations. Available modes are:

- Fast: Form fused operations anywhere. 
- On: Form fused operations where allowed by FP_CONTRACT. This is the default
      mode.
- Off: Don't form fused operations (in future this may be relaxed to forming
       fused operations where it can be proved that the result won't be
       affected).

Currently clang doesn't support the FP_CONTRACT pragma, so the 'On' and 'Off'
modes are equivalent.

llvm-svn: 159794
2012-07-06 00:59:19 +00:00
Simon Atanasyan 9c6f1f7f23 MIPS: Add -mdsp/-mno-dsp and -mdspr2/-mno-dspr2 command line options support.
llvm-svn: 159769
2012-07-05 19:23:00 +00:00
Simon Atanasyan 9b1932d4e4 MIPS: Factor out the code converting command line options to target features.
llvm-svn: 159767
2012-07-05 18:51:43 +00:00
Simon Atanasyan 6f23fa0f18 MIPS: Add -mips16 / -mno-mips16 command line support.
llvm-svn: 159747
2012-07-05 14:19:39 +00:00
David Chisnall da22535573 Hoist the logic for selecting the Objective-C dispatch method into the runtime
class, from the target.  No functionality change, just less duplicated logic.

llvm-svn: 159710
2012-07-04 11:52:24 +00:00
David Chisnall 314896c9fc A few more cleanups for the GNU family of ObjC runtimes.
llvm-svn: 159708
2012-07-04 10:37:03 +00:00
Bob Wilson ef285b4c22 Move a comment from the commit message into the code.
llvm-svn: 159696
2012-07-04 00:18:41 +00:00
David Chisnall b601c96892 Rename the GCC Objective-C runtime to gcc from gnu-fragile and the GNUstep
runtime to gnustep from gnu.  Fix EH for the GCC runtime.

llvm-svn: 159684
2012-07-03 20:49:52 +00:00
Bob Wilson 1e148fe064 When using -pg targeting OS X 10.8, pass -no_new_main to the linker.
By default on OS X 10.8, we don't link with a crt1.o file and the linker
knows to use _main as the entry point.  But, when compiling with -pg, we
need to link with the gcrt1.o file, and the linker needs to be told to use
the "start" symbol as the entry point.  The -no_new_main linker option does
that last part.  <rdar://problem/11491405>

llvm-svn: 159683
2012-07-03 20:42:10 +00:00
David Blaikie df9582cca5 Include -D files in crash report repro scripts. (PR13255)
Now that we're only using -frewrite-includes rather than full preprocessing
when producing repro source files, we should also include command line macro
definitions in the repro script.

I don't have a test case for this because I'm not sure if/how I can open the
crash report file when the name is only known by scraping the crash report
output. Suggestions welcome if anyone thinks it'd be helpful.

llvm-svn: 159592
2012-07-02 21:28:00 +00:00
David Blaikie 5d577a225e Use -frewrite-includes for crash reports.
In future changes we should:
* use __builtin_trap rather than derefing 'random' volatile pointers.
* avoid dumping temporary files into /tmp when running tests, instead
  preferring a location that is properly cleaned up by lit.

Review by Chandler Carruth.

llvm-svn: 159469
2012-06-29 22:03:56 +00:00
Hans Wennborg f60f6af9e8 Add -ftls-model command-line flag.
This allows for setting the default TLS model. (PR9788)

llvm-svn: 159336
2012-06-28 08:01:44 +00:00
Benjamin Kramer 09811c7dd5 Enable -mcpu=native and -march=native for arm targets.
This is only implemented on linux at the moment.

llvm-svn: 159232
2012-06-26 22:20:06 +00:00
Richard Trieu 9184423984 Add template type diffing to Clang. This feature will provide a better
comparison between two templated types when they both appear in a diagnostic.
Type elision will remove indentical template arguments, which can be disabled
with -fno-elide-type.  Cyan highlighting is applied to the differing types.

For more formatting, -fdiagnostic-show-template-tree will output the template
type as an indented text tree, with differences appearing inline. Template
tree works with or without type elision.

llvm-svn: 159216
2012-06-26 18:18:47 +00:00
John McCall f60e437168 Adjust this code so that it strictly honors
TargetSimulatroVersionFromDefines if present;  this also makes
it easier to chain things correctly.  Noted by an internal
review.

llvm-svn: 158926
2012-06-21 17:46:38 +00:00
Alexey Samsonov f50a9ffd0b Improve support for -g options accepted by Clang:
1. Accept flags -g[0-3], -ggdb[0-3], -gdwarf-[2-4] and collapse them to simple -g (except -g0/-ggdb0).
2. Produce driver error on unsupported formats (-gcoff, -gstabs, -gvms) and options (-gtoggle).
3. Recognize and ignore flags -g[no-]strict-dwarf, -g[no-]record-gcc-switches.

llvm-svn: 158906
2012-06-21 08:22:39 +00:00
Chandler Carruth 28969b4139 Remove a goofy CMake hack and use the standard CMake facilities to
express library-level dependencies within Clang.

This is no more verbose really, and plays nicer with the rest of the
CMake facilities. It should also have no change in functionality.

llvm-svn: 158888
2012-06-21 01:30:21 +00:00
Ted Kremenek c26328afa6 Revert "Provide a -no-pedantic to cancel out -pedantic." This needs to be designed
a bit further.  We may wish to just have -Wno flags to silence warnings, and not have a -no-pedantic.

llvm-svn: 158796
2012-06-20 07:03:37 +00:00
John McCall 5fb5df9c83 Restructure how the driver communicates information about the
target Objective-C runtime down to the frontend:  break this
down into a single target runtime kind and version, and compute
all the relevant information from that.  This makes it
relatively painless to add support for new runtimes to the
compiler.  Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z,
available at the driver level as a better and more general
alternative to -fgnu-runtime and -fnext-runtime.  This new
concept of an Objective-C runtime also encompasses what we
were previously separating out as the "Objective-C ABI", so
fragile vs. non-fragile runtimes are now really modelled as
different kinds of runtime, paving the way for better overall
differentiation.

As a sort of special case, continue to accept the -cc1 flag
-fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak.

I won't go so far as to say "no functionality change", even
ignoring the new driver flag, but subtle changes in driver
semantics are almost certainly not intended.

llvm-svn: 158793
2012-06-20 06:18:46 +00:00
Chad Rosier 103e2c9508 [driver] Per Bob's suggestion, emphasize the file dumps.
rdar://11684107

llvm-svn: 158734
2012-06-19 18:39:21 +00:00
Chad Rosier 8179f11841 [driver] Print the compiler version before the diagnostic messages.
llvm-svn: 158729
2012-06-19 17:51:34 +00:00
Chad Rosier 47297636fd [driver] Make the crash diagnostic message more visable. Bug reports are being
filed, but still missing the preprocessed source and associated run script.
rdar://11684107

llvm-svn: 158727
2012-06-19 17:48:02 +00:00
Rafael Espindola 66aa045fd9 Add a -fuse-init-array option to cc1 and map to the UseInitArray target
option. On the driver, check if we are using libraries from gcc 4.7 or newer
and if so pass -fuse-init-array to the frontend.
The crtbegin*.o files in gcc 4.7 no longer call the constructors listed in
.ctors, so we have to use .init_array.

llvm-svn: 158694
2012-06-19 01:26:10 +00:00
Michael J. Spencer e2f493604a [VS Toolchain] Correctly forward -l linker inputs to link.exe.
Patch by Nikola Smiljanic!

llvm-svn: 158664
2012-06-18 16:56:04 +00:00
David Blaikie 690f21e25c Support -f[no-]rewrite-includes from the driver.
Review by Chandler Carruth.

llvm-svn: 158463
2012-06-14 18:55:27 +00:00
John McCall 7dd1783c5e Provide a -no-pedantic to cancel out -pedantic.
llvm-svn: 158416
2012-06-13 19:48:01 +00:00
Hal Finkel 8eb5928514 Add PPC support for translating gcc-style -mcpu options into LLVM -target-cpu options.
This functionality is based on what is done on ARM, and enables selecting PPC CPUs
in a way compatible with gcc's driver. Also, mirroring gcc (and what is done on x86),
-mcpu=native support was added. This uses the host cpu detection from LLVM
(which will also soon be updated by refactoring code currently in backend).

In order for this to work, the target needs a list of valid CPUs -- we now accept all CPUs accepted by LLVM.
A few preprocessor defines for common CPU types have been added.

llvm-svn: 158334
2012-06-11 22:35:19 +00:00
Francois Pichet b27ea02784 Zap the /Za compiler switch from MSVC projects, the option is considered harmful even by Microsoft people and clang won't build using the MSVC 2012 RC if not removed.
Only 1 minor code change was necessary: can't use cdecl as variable name anymore.

llvm-svn: 158063
2012-06-06 12:00:10 +00:00
Jordan Rose 88bf06584b Remove AST and Parse from Driver's dependencies.
llvm-svn: 157933
2012-06-04 16:57:53 +00:00
Evgeniy Stepanov ea155f0153 Require -pie when linking with ASan on Android.
llvm-svn: 157923
2012-06-04 11:15:05 +00:00
Simon Atanasyan 590ad8f515 MIPS: Factor out code selects the float ABI as determined by -msoft-float,
-mhard-float, and -mfloat-abi= to the new function getMipsFloatABI. That
simplifies reuse of this code.

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

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

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

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

Fixes rdar://11356765.

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

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

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

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

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

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

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

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

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

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

OK'ed by Chad; thanks for the review.

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

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

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

Reviewed by Eric Christopher.

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

llvm-svn: 156117
2012-05-03 22:38:00 +00:00
Chad Rosier 45cf50f7b6 Use array_lengthof instead of sizeof trickery.
llvm-svn: 156104
2012-05-03 21:25:34 +00:00
Chad Rosier 1c5add6c5b [driver - crash diagnostics] Only write the failing command in the script.
Part of rdar://11285725

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

rdar://11252615

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

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

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

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

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

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

Please resubmit this patch with the relevant LLVM resubmission.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

rdar://11108618

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

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

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

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

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

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

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

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

rdar://11120518

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

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

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

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

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

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

llvm-svn: 153034
2012-03-19 15:00:03 +00:00