Commit Graph

2146 Commits

Author SHA1 Message Date
Eugene Zelenko 8a76d2e3bd Fix some Clang-tidy modernize warnings, other minor fixes.
Differential revision: http://reviews.llvm.org/D14311


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252081 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-04 21:37:17 +00:00
Aaron Ballman 9e2aa8e15a Silence "enumeral and non-enumeral type in conditional expression" warning; NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252047 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-04 14:43:43 +00:00
Teresa Johnson 9a8bffc6b1 Clang format a few prior patches (NFC)
I had clang formatted my earlier patches using the wrong style.
Reformatted with the LLVM style.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251813 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-02 18:03:12 +00:00
Tim Northover 4f3b7565cd Disable SjLj exceptions for watchOS
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251709 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-30 16:30:41 +00:00
Tim Northover 9605ec4bd7 Watch and TV OS: wire up basic ABI choices
This sets the mostly expected Darwin default ABI options for these two
platforms. Active changes from these defaults for watchOS are in a later patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251708 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-30 16:30:36 +00:00
Tim Northover 56c5241273 Support watchOS and tvOS driver options
This patch should add support for almost all command-line options and
driver tinkering necessary to produce a correct "clang -cc1"
invocation for watchOS and tvOS.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251706 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-30 16:30:27 +00:00
Vasileios Kalintiris df2a595cc3 Revert "[mips] Add support for the new mips-mti-linux toolchain."
This reverts commits r251633. I'll investigate the test failure off trunk in
order to keep the buildbots clean.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251698 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-30 11:28:39 +00:00
Renato Golin 4f4b142134 Revert "Try to run and investigate the mips-mti-linux.c test failure on ARM buildbots."
This reverts commit r251695. Debug is meant to be done off tree, not use the buildbots
experiments. I'll help investigate this problem off trunk.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251696 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-30 11:12:36 +00:00
Vasileios Kalintiris 6d07a67d27 Try to run and investigate the mips-mti-linux.c test failure on ARM buildbots.
This should be a NFC for every toolchain other than mips-mti-linux (where we
print the list of directories searched for crt files). It will soon be
reverted once we hit the clang-cmake-armv7-a15-selfhost-neon buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251695 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-30 10:35:38 +00:00
Vasileios Kalintiris 938b22a8b3 [mips] Add support for the new mips-mti-linux toolchain.
The original commit in r249137 added the mips-mti-linux toolchain. However,
the newly added tests of that commit failed in few buildbots. This commit
re-applies the original changes but XFAILs the test file which caused
the buildbot failures. This will allow us to examine what's going wrong
without having to commit/revert large changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251633 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-29 15:33:53 +00:00
Saleem Abdulrasool 0e6de21771 Driver: CrossWindows sanitizers link support
Add the required libraries to the linker invocation when building with
sanitizers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251600 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-29 03:36:45 +00:00
Saleem Abdulrasool ed571a8fac Driver: inline some small arrays
Use an initializer list to remove a couple of small static arrays.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251599 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-29 03:36:42 +00:00
Benjamin Kramer ea62bd9c83 Put global classes into the appropriate namespace.
Most of the cases belong into an anonymous namespace. No functionality
change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251514 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 13:54:16 +00:00
Saleem Abdulrasool 3e66583b18 Driver: support -fuse-ld= on cross windows
Update the linker selection to support the `-fuse-ld=` option for selecting a
linker.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251493 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 04:45:58 +00:00
Daniel Sanders 83c707824a [mips] Separated mips specific -Wa options, so that they are not checked on other platforms.
Summary: This is a follow on to post review comments on revision r248276.

Patch by Scott Egerton.

Reviewers: vkalintiris, dsanders

Subscribers: joerg, rengolin, cfe-commits

Differential Revision: http://reviews.llvm.org/D13100


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251430 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-27 18:04:42 +00:00
John McCall abdd82457f Define weak and __weak to mean ARC-style weak references, even in MRC.
Previously, __weak was silently accepted and ignored in MRC mode.
That makes this a potentially source-breaking change that we have to
roll out cautiously.  Accordingly, for the time being, actual support
for __weak references in MRC is experimental, and the compiler will
reject attempts to actually form such references.  The intent is to
eventually enable the feature by default in all non-GC modes.
(It is, of course, incompatible with ObjC GC's interpretation of
__weak.)

If you like, you can enable this feature with
  -Xclang -fobjc-weak
but like any -Xclang option, this option may be removed at any point,
e.g. if/when it is eventually enabled by default.

This patch also enables the use of the ARC __unsafe_unretained qualifier
in MRC.  Unlike __weak, this is being enabled immediately.  Since
variables are essentially __unsafe_unretained by default in MRC,
the only practical uses are (1) communication and (2) changing the
default behavior of by-value block capture.

As an implementation matter, this means that the ObjC ownership
qualifiers may appear in any ObjC language mode, and so this patch
removes a number of checks for getLangOpts().ObjCAutoRefCount
that were guarding the processing of these qualifiers.  I don't
expect this to be a significant drain on performance; it may even
be faster to just check for these qualifiers directly on a type
(since it's probably in a register anyway) than to do N dependent
loads to grab the LangOptions.

rdar://9674298

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251041 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-22 18:38:17 +00:00
Xinliang David Li 37bc78dc7a clang driver toolchain refactoring
In this patch, the file static method addProfileRT is
moved to be a virtual member function of base ToolChain class.
This allows derived toolchain to override the default behavior
easily and make it consistent with Darwin toolchain (a TODO was
added for this refactoring - now removed). A new helper method
is also introduced to test if instrumentation profile option
is turned on or not.

Differential Revision: http://reviews.llvm.org/D13326


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250994 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-22 06:15:31 +00:00
Douglas Katzman 2ca27de5f3 [Myriad]: Always add -L paths even if -nostdlib is set.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250932 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-21 19:33:54 +00:00
Dimitry Andric 08ead09cfb Support linking against OpenMP runtime on FreeBSD.
Summary:
Similar to rL248426 (which was a followup to rL248379 and rL248424), add the
required libraries for OpenMP on the linker command line, and update the test
case.

Reviewers: emaste, theraven, joerg

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D13822

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250657 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-18 13:32:20 +00:00
Craig Topper f112eacb43 Make a bunch of static arrays const.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250647 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-18 05:29:26 +00:00
Filipe Cabecinhas 390d9b3e92 PS4: Make sure to add the sanitizer runtime before any linker input
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250514 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-16 15:07:48 +00:00
Teresa Johnson b30376f1ca Recommit "Clang support for -flto=thin."
This recommits r250398 with fixes to the tests for bot failures.

Add "-target x86_64-unknown-linux" to the clang invocations that
check for the gold plugin.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250455 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-15 20:35:53 +00:00
Teresa Johnson 681157a8a9 Revert "Clang support for -flto=thin." (bot failures)
Rolling this back for now since there are a couple of bot failures on
the new tests I added, and I won't have a chance to look at them in detail
until later this afternoon. I think the new tests need some restrictions on
having the gold plugin available.

This reverts commit r250398.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250402 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-15 13:41:51 +00:00
Teresa Johnson 7128e301f9 Clang support for -flto=thin.
Summary:
Add clang support for -flto=thin option, which is used to set the
EmitFunctionSummary code gen option on compiles.

Add -flto=full as an alias to the existing -flto.

Add tests to check for proper overriding of -flto variants on the
command line, and convert grep tests to FileCheck.

Reviewers: dexonsmith, joker.eph

Subscribers: davidxl, cfe-commits

Differential Revision: http://reviews.llvm.org/D11908

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250398 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-15 13:08:13 +00:00
Douglas Katzman 34847ba18a Remove unnecessary braces in single-line 'if'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250363 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-15 04:10:40 +00:00
Filipe Cabecinhas 5d7c81cfa5 Bring back r250262: PS4 toolchain
There was a minor problem with a test. Sorry for the noise yesterday.

This patch adds missing pieces to clang, including the PS4 toolchain
definition, added warnings, PS4 defaults, and Driver changes needed for
our compiler.

A patch by Filipe Cabecinhas, Pierre Gousseau and Katya Romanova!

Differential Revision: http://reviews.llvm.org/D13482

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250293 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-14 12:25:43 +00:00
Sean Silva 00a91779d6 Revert-to-green r250262 (PS4 toolchain patch)
It is breaking llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast
e.g. http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/1362

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250273 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-14 06:45:07 +00:00
Ekaterina Romanova fb7d1d842e I took care of the build problem in the commit 250252.
Resubmitting the patch. 

This patch adds missing pieces to clang, including the PS4 toolchain
definition, added warnings, PS4 defaults, and Driver changes needed for
our compiler.

A patch by Filipe Cabecinhas, Pierre Gousseau and Katya Romanova!

Differential Revision: http://reviews.llvm.org/D13482



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250262 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-14 01:09:02 +00:00
Ekaterina Romanova 08b6d449b7 reverting my patch, cause build problems
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250257 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-14 00:03:20 +00:00
Ekaterina Romanova 1254d89521 This patch adds missing pieces to clang, including the PS4 toolchain
definition, added warnings, PS4 defaults, and Driver changes needed for
our compiler.

A patch by Filipe Cabecinhas, Pierre Gousseau and Katya Romanova!

Differential Revision: http://reviews.llvm.org/D13482



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250252 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-13 23:40:02 +00:00
Douglas Katzman 96497ca976 Always pass a -dwarf-version argument to integrated as.
This removes the default of 3 hidden in the assembler previously.

Fixes breakage caused by r249655, reported by vsukharev.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250173 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-13 16:22:51 +00:00
Saleem Abdulrasool cc4221bf16 Support Debug Info path remapping
Add support for the `-fdebug-prefix-map=` option as in GCC.  The syntax is
`-fdebug-prefix-map=OLD=NEW`.  When compiling files from a path beginning with
OLD, change the debug info to indicate the path as start with NEW.  This is
particularly helpful if you are preprocessing in one path and compiling in
another (e.g. for a build cluster with distcc).

Note that the linearity of the implementation is not as terrible as it may seem.
This is normally done once per file with an expectation that the map will be
small (1-2) entries, making this roughly linear in the number of input paths.

Addresses PR24619.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250094 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-12 20:21:08 +00:00
Douglas Katzman c3966abdb3 [Myriad]: put libstdc++ and libc in the right order
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249893 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09 20:26:20 +00:00
Evgeniy Stepanov 9304fa7ea0 Use Triple.isAndroid() where possible.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249751 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 21:21:44 +00:00
Reid Kleckner 041cfae0d5 [clang-cl] Make /EHs turn on C++ EH once again
C++ exceptions are still off by default, which is similar to how C++
cleanups are off by default in MSVC.

If you use clang instead of clang-cl, exceptions are also still off by
default. In the future, when C++ EH is proven to be stable, we may flip
the default for that driver to be consistent with other platforms.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249704 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 17:29:07 +00:00
Benjamin Kramer 1b55f2b329 [Driver] Use Twine instead of itostr. NFC.
No need to construct temporary std::strings here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249676 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 10:31:17 +00:00
Douglas Katzman 24825ee43c Use itostr(), not std::to_string() because of Android.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249658 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 05:25:03 +00:00
Douglas Katzman adbb8c2aef Stop messing with the 'g' group of options in CompilerInvocation.
With this change, most 'g' options are rejected by CompilerInvocation.
They remain only as Driver options. The new way to request debug info
from cc1 is with "-debug-info-kind={line-tables-only|limited|standalone}"
and "-dwarf-version={2|3|4}". In the absence of a command-line option
to specify Dwarf version, the Toolchain decides it, rather than placing
Toolchain-specific logic in CompilerInvocation.

Also fix a bug in the Windows compatibility argument parsing
in which the "rightmost argument wins" principle failed.

Differential Revision: http://reviews.llvm.org/D13221

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249655 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 04:24:12 +00:00
Benjamin Kramer 032169da0a [VFS] Port driver tool chains to VFS.
There are still some loose ends here but it's sufficient so we can detect
GCC headers that are inside of a VFS.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249556 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-07 15:48:01 +00:00
Alexandros Lamprineas 7fd54c31fe The Driver does not set the +strict-align flag when targeting
[ARM] armv6m + netbsd. Tests are misssing for armv6m + darwin as well.

Differential Revision: http://reviews.llvm.org/D13217

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249308 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-05 12:45:10 +00:00
Vasileios Kalintiris c73b622cce Remove support for the mips-mti-linux toolchain.
There are two remaining buildbot failures that we'll have to
investigate before submitting this again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249298 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-05 10:34:46 +00:00
Vasileios Kalintiris f99078cf0e Re-commit "Add support for the new mips-mti-linux toolchain."
r249137 added support for the new mips-mti-linux toolchain. However,
the new tests of that commit, broke some buildbots because they didn't use
the correct regular expressions to capture the filename of Clang & LLD.

This commit re-applies the changes of r249137 and fixes the tests in
r249137 in order to match the filenames of the Clang and LLD executable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249294 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-05 09:12:36 +00:00
Saleem Abdulrasool e1cb12fa9b Add -f[no-]declspec to control recognition of __declspec as a keyword
In versions of clang prior to r238238, __declspec was recognized as a keyword in
all modes.  It was then changed to only be enabled when Microsoft or Borland
extensions were enabled (and for CUDA, as a temporary measure).  There is a
desire to support __declspec in Playstation code, and possibly other
environments.  This commit adds a command-line switch to allow explicit
enabling/disabling of the recognition of __declspec as a keyword.  Recognition
is enabled by default in Microsoft, Borland, CUDA, and PS4 environments, and
disabled in all other environments.

Patch by Warren Ristow!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249279 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-04 17:51:05 +00:00
Saleem Abdulrasool a049f0b610 Driver: follow WoA ABI recommendations
The Windows on ARM ABI recommends that FPO be disabled.  This is since the
Windows on ARM ABI uses the FP for fast stack walking.  By paying the slight
cost of the loss of registers, a much faster backtrace is possible by using the
frame pointer since the pdata need not be consulted.  Furthermore, even if pdata
is not available, you can still more easily reconstruct the stack.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249227 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-03 03:39:28 +00:00
Douglas Katzman fa376cc400 [Myriad]: Accept '-nostdlib' option
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249166 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-02 18:39:08 +00:00
Bruno Cardoso Lopes fd64a76785 [DarwinDriver] Reapply: Use -lto_library to specify the path for libLTO.dylib
Reapply r248935.

Usually, when using LTO with a clang installation newer than the
system's one, there's a libLTO.dylib version mismatch and LTO fails. One
solution to this is to make ld point to the right libLTO.dylib by
changing DYLD_LIBRARY_PATH.

However, ld64 supports specifying the complete path to the desired
libLTO.dylib through the -lto_library option. This commit adds support
for the clang driver to use this option whenever it's capable of finding
a libLTO.dylib in clang's installed library directory. This way, we
don't need to rely on DYLD_LIBRARY_PATH nor get caught by version
mismatches.

Differential Revision: http://reviews.llvm.org/D13117

rdar://problem/7363476

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249143 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-02 15:10:33 +00:00
Vasileios Kalintiris 775b9abf2f Revert "Add support for the new mips-mti-linux toolchain."
This reverts commit r249137 because it broke the Windows buildbots and
a Linux buildbot for LLD.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249141 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-02 15:00:55 +00:00
Douglas Katzman 46dc49705f Fix bogus comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249138 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-02 14:41:38 +00:00
Vasileios Kalintiris a8f984d5ed Add support for the new mips-mti-linux toolchain.
Summary:
This new toolchain uses primarily LLVM-based tools, eg. compiler-rt, lld,
libcxx, etc. Because of this, it doesn't require neither an existing GCC
installation nor a GNU environment. Ideally, in a follow-up patch we
would like to add a new --{llvm|clang}-toolchain option (similar to
--gcc-toolchain) in order to allow the use of this toolchain with
independent Clang builds. For the time being, we use the --sysroot
option just to test the correctness of the paths generated by the
driver.

Reviewers: atanasyan, dsanders, rsmith

Subscribers: jfb, tberghammer, danalbert, srhines, dschuff, cfe-commits

Differential Revision: http://reviews.llvm.org/D13340

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249137 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-02 14:38:23 +00:00
Vasileios Kalintiris 0d32e7d952 Allow a ToolChain to compute the path of a compiler-rt's component.
Summary:
This patch moves getCompilerRT() from the clang::driver::tools namespace to
the ToolChain class. This is needed for multilib toolchains that need to
place their libraries in Clang's resource directory with a layout that is
different from the default one.

Reviewers: atanasyan, rsmith

Subscribers: tberghammer, danalbert, srhines, cfe-commits

Differential Revision: http://reviews.llvm.org/D13339

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249030 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-01 16:54:58 +00:00
Bruno Cardoso Lopes a284baa10f Revert "[DarwinDriver] Use -lto_library to specify the path for libLTO.dylib"
Revert r248932. Bots complaining about new warnings where they shouldn't.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248935 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-30 20:11:02 +00:00
Bruno Cardoso Lopes a2ed8c0526 [DarwinDriver] Use -lto_library to specify the path for libLTO.dylib
Usually, when using LTO with a clang installation newer than the
system's one, there's a libLTO.dylib version mismatch and LTO fails. One
solution to this is to make ld point to the right libLTO.dylib by
changing DYLD_LIBRARY_PATH.

However, ld64 supports specifying the complete path to the desired
libLTO.dylib through the -lto_library option. This commit adds support
for the clang driver to use this option whenever it's capable of finding
a libLTO.dylib in clang's installed library directory. This way, we
don't need to rely on DYLD_LIBRARY_PATH nor get caught by version
mismatches.

Differential Revision: http://reviews.llvm.org/D13117

rdar://problem/7363476

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248932 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-30 19:55:07 +00:00
Douglas Katzman e9134a5e3f Alias "-ggdbN" to "-gN" options, fixing some incompatibilities.
* assembling from a .s file mistook -ggdb0 for -g
* -ggdb1 is supposed to mean basically -g1, not -gN for N>1

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248912 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-30 15:55:59 +00:00
Saleem Abdulrasool 33307a3cd9 Driver: support ARM/HF on a single toolchain
ARM EABI adds target attributes to the object file.  Amongst the attributes that
are emitted is the VFP argument passing (Hard vs Soft).  The linker is
responsible for checking these attributes and erroring on mismatches.  This
causes problems for the compiler-rt builtins when targeting both hard and
soft.  Because both of these options name the builtins compiler-rt component
the same (libclang_rt.builtins-arm.a or libclang_rt.builtins-arm-android).  GCC
is able to get away with this as it does one target per toolchain.  This
changes the naming convention for the ARM compiler-rt builtins to differentiate
between HF and Soft.  Although this means that compiler-rt may be duplicated, it
enables supporting both variants from a single toolchain.  A similar approach is
taken by the Darwin toolchain, naming the library to differentiate between the
calling conventions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248649 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-26 03:26:44 +00:00
Greg Bedwell fc7ebbf512 Revert "This patch adds missing pieces to clang, including the PS4 toolchain definition, added warnings, PS4 defaults, and Driver changes needed for our compiler."
This reverts commit r248546 to get our bot green again while we discuss the best way forward.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248578 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-25 16:11:00 +00:00
Ekaterina Romanova 41604ec4c1 This patch adds missing pieces to clang, including the PS4 toolchain
definition, added warnings, PS4 defaults, and Driver changes needed for
our compiler.

A patch by Filipe Cabecinhas, Pierre Gousseau and Katya Romanova!

Differential Revision: http://reviews.llvm.org/D11279



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248546 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-24 22:06:52 +00:00
Benjamin Kramer d408bb64af Drop useless const in for-range loops.
StringRefs always point to immutable memory so the const doesn't add value
here. Also quiets clang's -Wrange-loop-analysis which warns about the implicit
copying.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248496 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-24 14:48:49 +00:00
Daniel Sanders f138c78edd [mips] Relax -mnan=2008 acceptance to permit MIPS32R2 and MIPS64R2.
Summary:
Strictly speaking, the MIPS*R2 ISA's should not permit -mnan=2008 since this
feature was added in MIPS*R3. However, other toolchains permit this and we
should do the same.

Reviewers: atanasyan

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D13057

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248481 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-24 10:22:17 +00:00
Vladimir Sukharev a638ce2afc [ARM] Follow-up to fix crash "-target arm -mcpu=generic", without "-march="
Fix of dangling StringRef after temporary std::string is destroyed

Follow-up to: http://reviews.llvm.org/rL248479

Reviewers: alexfh

Subscribers: cfe-commits



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248480 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-24 10:06:44 +00:00
Vladimir Sukharev 0aace7a99c [ARM] Follow-up to fix crash "-target arm -mcpu=generic", without "-march="
Fix of dangling StringRef after temporary std::string is destroyed

Follow-up to: http://reviews.llvm.org/rL248370

Reviewers: alexfh

Subscribers: cfe-commits



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248479 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-24 09:55:08 +00:00
Joerg Sonnenberger fb5a0360b1 Support linking against OpenMP runtime on NetBSD.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248426 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-23 20:11:00 +00:00
Joerg Sonnenberger 80deb58759 Push OpenMP linker flags after linker input on Darwin. Don't add any
libraries if -nostdlib is specified. Test.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248424 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-23 20:07:56 +00:00
Joerg Sonnenberger b4bac0831b Refactor library decision for -fopenmp support from Darwin into a
function for sharing with other platforms.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248379 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-23 14:06:52 +00:00
John Brawn 9dcbcab85c Add -fplugin=name.so option to the driver
This translates to -load name.so in the cc1 command. We can't name the driver
option -load, as that means "link against oad", so instead we follow GCC's lead
and name the option -fplugin.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248378 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-23 13:55:40 +00:00
Vladimir Sukharev 575a21a977 [ARM] Fix crash "-target arm -mcpu=generic", without "-march="
An assertion hit has been fixed for cmdlines like

$ clang --target=arm-linux-gnueabi -mcpu=generic hello.c

Related to: http://reviews.llvm.org/rL245445

Reviewers: rengolin

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D13013



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248370 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-23 09:29:32 +00:00
Daniel Sanders 309886d909 [mips] Added support for using the command line options -Wa,-msoft-float and -Wa,-mhard-float.
Patch by Scott Egerton.

Reviewers: vkalintiris, dsanders

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D12600


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248276 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-22 13:52:32 +00:00
Craig Topper dd28883f11 Don't pass StringRefs around by const reference. Pass by value instead per coding standards. NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248137 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-21 00:20:04 +00:00
Saleem Abdulrasool 87cea1fd73 Driver: alter the getARMFloatABI signature
This changes getARMFloatABI to use the ToolChain and Args instead of Driver,
Args, Triple.  Although this pushes the Triple calculation/parsing into the
function itself, it enables the use of the function for a future change.  The
reason to sink the triple calculation here is to avoid threading the Triple
through multiple layers in a future change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248095 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-19 20:40:16 +00:00
Saleem Abdulrasool e93fbf3055 Driver: tweak ARM target feature calculation
Rather than using re-calculating the effective triple, thread the already
calculated value down into AddARMTargetArgs.  This avoids both recreating the
triple, as well as re-parsing the triple as it was already done in the previous
frame.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248094 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-19 18:19:44 +00:00
Saleem Abdulrasool 5c9ee3a97f Driver: avoid unnecessary string ops
Use an enumeration for the Floating Point ABIs supported on MIPS.  This is
replicating the ARM change to avoid string based tracking of the floating point
ABI.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248083 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-19 04:33:38 +00:00
Saleem Abdulrasool c507b4076c Driver: avoid unnecessary string based operations
Use an enumeration and change the use of the FloatABI from a string to the
enumeration.  This avoids the use of string values to represent an enumeration.
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247967 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-18 05:32:23 +00:00
Douglas Katzman c8cabd545c [Shave]: Drive sparc-myriad-elf-ld directly rather than via gcc.
Differential Revision: http://reviews.llvm.org/D12541

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247924 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-17 19:56:40 +00:00
Piotr Padlewski ac87852f57 Emiting llvm.invariant.group.barrier when dynamic type changes
For more goto:
http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html

http://reviews.llvm.org/D12312

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247723 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-15 21:46:47 +00:00
Rafael Espindola 7d8d0667a1 [Solaris] Default to -fno-cxa-finalize.
There is no __cxa_finalize symbol available on recent Solaris OS
versions, so we need this flag to make non trivial C++ programs run.

Also stop looking for cxa_finalize.o, since it won't be there.

Patch by Xan López!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247634 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-14 23:21:31 +00:00
Gabor Horvath 87498c8ee9 [Static Analyzer] Turn on some nullability checks by default.
Differential Revision: http://reviews.llvm.org/D12858



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247614 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-14 20:34:06 +00:00
Douglas Katzman 39cd18c57a Driver should forward at most one gdwarf-N flag to cc1as.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247611 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-14 20:31:28 +00:00
Rafael Espindola 4094cbc6af [Solaris] Add -lc also when linking shared libraries
This is actually needed, otherwise libc won't be added at all. For
instance when building libclang.so all the libc symbols won't be
found, with ld warning about libc being an "implicit dependency".

Patch by Xan López!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247603 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-14 19:30:53 +00:00
Douglas Katzman 572aaf1e47 [Shave]: pass -isystem dirs and "-Wa," args to moviAsm
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247474 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 21:13:46 +00:00
Akira Hatanaka 218bc14fa5 Record function attribute "stackrealign" instead of using backend option
-force-align-stack.

Also, make changes to the driver so that -mno-stack-realign is no longer
an option exposed to the end-user that disallows stack realignment in
the backend.

Differential Revision: http://reviews.llvm.org/D11815


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247451 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 18:55:09 +00:00
Richard Smith e8c9862f42 [modules] Don't load files specified by -fmodule-file= when modules are
disabled. (We still allow this via -cc1 / -Xclang, primarily for testing.)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247384 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 03:58:07 +00:00
Reid Kleckner abd4ffe16c [Driver] Use UniversalCRT on Windows if available
Summary:
With Visual Studio 2015 release, a part of runtime library was extracted
and now comes with Windows Kits. This patch enables clang to use
Universal CRT library if  %INCLUDE or %LIB environment varaibles are not
specified.

See also https://llvm.org/bugs/show_bug.cgi?id=24741

Patch by Igor Kudrin

Reviewers: zturner, hans, rnk

Subscribers: ruiu, cfe-commits

Differential Revision: http://reviews.llvm.org/D12695

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247362 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 00:09:39 +00:00
Alexey Bataev dcc54531b6 [OPENMP] Generate threadprivates as TLS variables by default.
If target supports TLS all threadprivates are generated as TLS. If target does not support TLS, use runtime calls for proper codegen of threadprivate variables.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247273 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 12:06:58 +00:00
Douglas Katzman 121239861a [Shave]: add a -MT option to moviCompile if there wasn't one
Differential Revision: http://reviews.llvm.org/D12622

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247052 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-08 19:29:55 +00:00
Dan Gohman ff7b957464 [WebAssembly] Initial WebAssembly support in clang
This implements basic support for compiling (though not yet assembling
or linking) for a WebAssembly target. Note that ABI details are not yet
finalized, and may change.

Differential Revision: http://reviews.llvm.org/D12002


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246814 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-03 22:51:53 +00:00
Daniel Sanders 639a364a05 [mips] Added support for choosing between traps and breaks in the integrated assembler macros.
Summary: The command line options for these are -Wa,--trap and -Wa,--break.

Patch by Scott Egerton.

Reviewers: vkalintiris, dsanders

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D11676


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246765 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-03 12:58:39 +00:00
Oliver Stannard 7b8d166854 [ARM] Allow passing/returning of __fp16 arguments
The ACLE (ARM C Language Extensions) 2.0 allows the __fp16 type to be
used as a functon argument or return type (ACLE 1.1 did not).

The current public release of the AAPCS (2.09) states that __fp16 values
should be converted to single-precision before being passed or returned,
but AAPCS 2.10 (to be released shortly) changes this, so that they are
passed in the least-significant 16 bits of either a GPR (for base AAPCS)
or a single-precision register (for AAPCS-VFP). This does not change how
arguments are passed if they get passed on the stack.

This patch brings clang up to compliance with the latest versions of
both of these specs.

We can now set the __ARM_FP16_ARGS ACLE predefine, and we have always
been able to set the __ARM_FP16_FORMAT_IEEE predefine (we do not support
the alternative format).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246764 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-03 12:40:58 +00:00
Oliver Stannard 4880d582bd Revert 246755 as it breaks buildbots
Original commit message:
[ARM] Allow passing/returning of __fp16 arguments

The ACLE (ARM C Language Extensions) 2.0 allows the __fp16 type to be
used as a functon argument or return type (ACLE 1.1 did not).

The current public release of the AAPCS (2.09) states that __fp16 values
should be converted to single-precision before being passed or returned,
but AAPCS 2.10 (to be released shortly) changes this, so that they are
passed in the least-significant 16 bits of either a GPR (for base AAPCS)
or a single-precision register (for AAPCS-VFP). This does not change how
arguments are passed if they get passed on the stack.

This patch brings clang up to compliance with the latest versions of
both of these specs.

We can now set the __ARM_FP16_ARGS ACLE predefine, and we have always
been able to set the __ARM_FP16_FORMAT_IEEE predefine (we do not support
the alternative format).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246760 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-03 11:46:24 +00:00
Oliver Stannard 2998469baf [ARM] Allow passing/returning of __fp16 arguments
The ACLE (ARM C Language Extensions) 2.0 allows the __fp16 type to be
used as a functon argument or return type (ACLE 1.1 did not).

The current public release of the AAPCS (2.09) states that __fp16 values
should be converted to single-precision before being passed or returned,
but AAPCS 2.10 (to be released shortly) changes this, so that they are
passed in the least-significant 16 bits of either a GPR (for base AAPCS)
or a single-precision register (for AAPCS-VFP). This does not change how
arguments are passed if they get passed on the stack.

This patch brings clang up to compliance with the latest versions of
both of these specs.

We can now set the __ARM_FP16_ARGS ACLE predefine, and we have always
been able to set the __ARM_FP16_FORMAT_IEEE predefine (we do not support
the alternative format).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246755 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-03 09:34:53 +00:00
Douglas Katzman fbd2901a30 Remove inadvertent debug output from prior change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246715 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 21:18:10 +00:00
Douglas Katzman 740dd7fc7c Use new utility function to clean leading junk from pathnames. NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246714 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 21:14:53 +00:00
Douglas Katzman ad51310219 [Shave]: pass through more clang options to moviCompile
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246652 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 13:42:43 +00:00
Rafael Espindola ce8ac555c9 Stop hardcoding GCC paths in crt/ld.so lookup.
This patch refactors the code to use the GCC installation detector
(modified so that it works in Solaris), and uses
ToolChain::GetFilePath everywhere once it works.

Patch by Xan López <xan@igalia.com>!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246473 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 19:17:51 +00:00
Chandler Carruth a9262e954a Update for several APIs in LLVM that now use StringRefs rather than
const char pointers. In turn, push this through Clang APIs as well,
simplifying a number of bits of code that was handling the oddities of
nullptrs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246375 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-30 07:51:18 +00:00
Chandler Carruth b2f21554da Update for API change in LLVM: ARMTargetParser class is just the ARM
namespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246368 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-30 02:16:36 +00:00
Sylvestre Ledru f0862b4488 Support Debian s390x multiarch paths
Summary: Patch by Steven Chamberlain <steven@pyro.eu.org>

Reviewers: uweigand

Differential Revision: http://reviews.llvm.org/D12430

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246295 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 12:26:09 +00:00
Adrian Prantl 7bbf57e36a Add a -gmodules option to the driver and a -dwarf-ext-refs to cc1
to enable the use of external type references in the debug info
(a.k.a. module debugging).

The driver expands -gmodules to "-g -fmodule-format=obj -dwarf-ext-refs"
and passes that to cc1. All this does at the moment is set a flag
codegenopts.

http://reviews.llvm.org/D11958

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246192 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27 19:46:20 +00:00
Akira Hatanaka 6b46f883be [ARM] Error out if float-ab=hard and abi=apcs-gnu on macho platforms.
Error out if -mfloat-abi=hard or -mhard-float is specified on the command
line and the target ABI is APCS. Previously clang issued no warnings or
errors and just passed the option to the backend, which had no effect on
code generation for targets using APCS.

This commit corrects the patch commited in r245866, which didn't take into
account the fact that not all darwin targets use APCS.

rdar://problem/22257950

http://reviews.llvm.org/D12344


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246054 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 19:00:11 +00:00
Akira Hatanaka a50f1763b0 Revert r245866.
This commit was causing buildbot failures.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245871 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-24 20:30:57 +00:00
Akira Hatanaka e35de8288e [ARM] Error out on apple darwin platforms if float-abi is "hard".
Error out if the user tries to use float-abi="hard" since it isn't
supported on darwin platforms. Previously clang issued no warnings or
erros and just passed the option to the backend, which had no effect on
code generation for targets using apcs.

rdar://problem/22257950

Differential Revision: http://reviews.llvm.org/D12155


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245866 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-24 19:50:35 +00:00
James Y Knight 2163e6004d Stop treating -static as overriding -fPIC: they are distinct.
For some reason, clang had been treating a command like:
 clang -static -fPIC foo.c
as if it should be compiled without the PIC relocation model.

This was incorrect: -static should be affecting only the linking
model, and -fPIC only the compilation.

This new behavior also matches GCC.

This is a follow-up from a review comment on r245447.

Differential Revision: http://reviews.llvm.org/D12208

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245667 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-21 04:14:55 +00:00
Evgeniy Stepanov ba9bf87ed9 Revert r245344.
That change is causing strange test failures on Fedora 22 (PR24503),
and it does not have any effect with Gold linker anyway (PR15823,
https://sourceware.org/bugzilla/show_bug.cgi?id=18859).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245619 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 21:47:16 +00:00
Douglas Katzman 7cb05e8039 [Sparc] Add '-EL' when invoking gcc to link little-endian binaries.
Differential Revision: http://reviews.llvm.org/D12201

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245595 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 18:32:26 +00:00
Aaron Ballman 41edf4ec73 Silence a "not all control paths return a value" warning; NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245562 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 13:31:16 +00:00
James Y Knight 7b4b02675a Properly pass through the PIC mode to the integrated assembler when
doing assembly-only, and unify the Driver's PIC argument parsing.

On a few architectures, parsing of assembly files annoyingly depends
on whether PIC is enabled or not. This was handled for external 'as'
already (passing -KPIC), but was missed for calls to the standalone
internal assembler.

The integrated-as.s test needed to be modified to not expect
-fsanitize=address to be unused, as now fsanitize *IS* used for
assembly, since -fsanitize=memory can sometimes imply -fPIE, which the
assembler needs to know (gack!!).

Differential Revision: http://reviews.llvm.org/D11845

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245447 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 15:12:02 +00:00
Vladimir Sukharev 2b7ae4f81e [ARM] Proper generic cpus handling
"generic" cpu was wrongly handled as exact real CPU name of ARMv8.1A architecture.

This has been fixed, now it is abstract name, suitable for any arch.

Reviewers: rengolin

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D11640


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245445 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 14:50:18 +00:00
Alexey Bataev 932ae974a7 [OPENMP] Link libomp.lib on Windows
Adds libomp.lib for -fopenmp=libomp and libiomp5md.lib for -fopenmp=libiomp5 on Windows
Differential Revision: http://reviews.llvm.org/D11932


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245414 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 04:49:01 +00:00
Evgeniy Stepanov f254fc49ce [sanitizer] Add -lutil to static runtime link flags.
This is needed to prevent breakage of -Wl,-as-needed link when
interceptors for functions in libutil are added. See PR15823.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245344 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 20:36:11 +00:00
James Y Knight 17af55fb42 Tiny cleanup: move some Triple variables up to the top of the
function, and remove a duplicate var.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245154 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-15 03:45:25 +00:00
John Brawn 4b12a3a5a2 [Driver] Fix handling of -fbuiltin/-fcommon when combined with -mkernel
-mkernel enables -fno-builtin and -fno-common by default, but allows -fbuiltin
and -fcommon to override that. However "-fbuiltin -fno-builtin" is treated the
same as "-fbuiltin" which is wrong, so fix that. Also fixes similar behaviour
when -fno-common is default.

Differential Revision: http://reviews.llvm.org/D11459


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244437 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 11:11:28 +00:00
Yaron Keren 14d62ae679 Teach mingw toolchain driver to properly emit static or dynamic linking of ligcc.
Implemented in MinGW::Linker::AddLibGCC since AddLibgcc is a logic puzzle even
before adding one more boolean. A first step towards simplification of AddLibgcc
would be to factor out the Android AddLibgcc code into its own routine.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244407 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-09 00:24:07 +00:00
Diego Novillo e1c5733de6 Add -fno-coverage-mapping flag.
This new flag allows the user to disable a previous instance of
-fcoverage-mapping, if needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244170 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 23:27:40 +00:00
Diego Novillo 41544940b4 Add flags to disable profile generation.
This patch adds flags -fno-profile-instr-generate and
-fno-profile-instr-use, and the GCC aliases -fno-profile-generate and
-fno-profile-use.

These flags are used in situations where users need to disable profile
generation or use for specific files in a build, without affecting other
files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244153 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 21:49:51 +00:00
Reid Kleckner 9579b106d6 Add -gcodeview and -gdwarf to control which type Clang emits
Summary:
By default, 'clang' emits dwarf and 'clang-cl' emits codeview.  You can
force emission of one or both by passing -gcodeview and -gdwarf to
either driver.

Reviewers: dblaikie, hans

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D11742

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244097 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 18:51:13 +00:00
Douglas Katzman 8312a2e12f Claim arguments that belong to 'clang_ignored_gcc_optimization_f_Group'
This seems preferable to printing two warnings per unsupported option-
one warning about not supporting it, and one about not using it.
It also makes the '-Wno-' option do what you mean.

Differential Revision: http://reviews.llvm.org/D11766

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244079 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 18:03:47 +00:00
Douglas Katzman 1b3a539a70 [SHAVE] Pass all -f, -g, -O, -W options through directly to moviCompile.
Differential Revision: http://reviews.llvm.org/D11581

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243878 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-03 14:34:22 +00:00
David Blaikie d50fd8aa0d Split DWARF: Allow -gmlt/-gsplit-dwarf to override rather than complement each other
It doesn't make any sense to enable -gmlt with -gsplit-dwarf, since
-gmlt is designed for on-line symbolication (and -gsplit-dwarf normally
emits all the -gmlt data into the .o anyway - so there's nothing to
split out except redundant/duplicate info).

With this change they override each other, -gmlt -gsplit-dwarf is the
same as -gsplit-dwarf and -gsplit-dwarf -gmlt is the same as -gmlt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243694 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-30 21:42:22 +00:00
Renato Golin 4fbead8a5e [ARM] Allow setting the generic features for native cpus
Copying the already existing code for x86 to ARM to set the correct CPU
features when using -mcpu=native. We can already detect the CPU name
but we were not setting the correct feature bits.

Moving fpu/hwdiv down to make sure they override whatever we set the
default to be.

No tests because this is native detection, and not all ARM-enabled builds
will hapen at a specific CPU, or even ARM. I have tested locally and it
works as expected.

Fixes PR12794.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243656 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-30 16:40:17 +00:00
Ulrich Weigand 8b1a0203ec Add support for System z vector language extensions
The z13 vector facility has an associated language extension,
closely modeled on AltiVec/VSX.  The main differences are:

- vector long, vector float and vector pixel are not supported

- vector long long and vector double are supported (like VSX)

- comparison operators return a vector rather than a scalar integer

- shift operators behave like the OpenCL shift operators

- vector bool is only supported as argument to certain operators;
  some operators allow mixing a bool with a non-bool vector 

This patch adds clang support for the extension.  It is closely modelled
on the AltiVec support.  Similarly to the -faltivec option, there's a
new -fzvector option to enable the extensions (as well as an -mzvector
alias for compatibility with GCC).  There's also a separate LangOpt.

The extension as implemented here is intended to be compatible with
the -mzvector extension recently implemented by GCC.

Based on a patch by Richard Sandiford.

Differential Revision: http://reviews.llvm.org/D11001



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243642 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-30 14:08:36 +00:00
Douglas Katzman 4998493239 Use the AddAllArgs overload which accepts an ArrayRef of OptSpecifier.
Differential Revision: http://reviews.llvm.org/D11599

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243552 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-29 18:39:14 +00:00
Akira Hatanaka d7f4cbb43f [AArch64] Pass subtarget feature "+strict-align".
This commit changes the driver to save subtarget feature "+strict-align"
to the IR instead of using backend option "aarch64-strict-align". This is
needed for LTO.

rdar://problem/21529937

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243518 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-29 14:25:58 +00:00
Akira Hatanaka 036f393cf9 [ARM] Pass subtarget feature "+strict-align".
This commit changes the driver to save subtarget feature "+strict-align" to the
IR instead of using backend option "arm-strict-align". This is needed for LTO.

Also, move the logic in ARM backend that was deciding whether strict alignment
should be forced to the front-end.

rdar://problem/21529937

http://reviews.llvm.org/D11472

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243489 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-28 22:26:45 +00:00
Chih-Hung Hsieh 9ec907c078 Add -femulated-tls flag to select the emulated TLS model.
This will be used for old targets like Android that do not
support ELF TLS models.

Differential Revision: http://reviews.llvm.org/D10524


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243441 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-28 16:27:56 +00:00
Alexandros Lamprineas 63bd83cc6b Use TargetParser to parse -mhwdiv command line option in Driver.
Change-Id: I2ebc40f77af75ec6b43ce8364d6d5a1d29988bd6
Phabricator: http://reviews.llvm.org/D11501

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243398 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-28 09:08:03 +00:00
Renato Golin 985185b16c [ARM] Implement -Wa,-mfpu and friends for assemblers
This patch allows Clang to pass on -Wa,-mfpu, -Wa,-mhwdiv and
-Wa,-mcpu to the integrated assembler (via target-features), but
-march is still not being passed, but validated.

In case the command line has both -mxxx and -Wa,-mxxx, we warn
that the naked one will not be used in assembler mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243353 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-27 23:44:45 +00:00
Renato Golin a83035ec20 [ARM] Changes to Arch/CPU handling to help with -Wa,-mfpu etc. (nfc)
To be able to handle -Wa, options in the assembler (ClangAs), we need to
make the handling of options based on the value of the options, not direct
Arguments from the list, since the list is immutable.

No functional change in this patch, but this allows validating of -Wa,-mfpu
and friends in the same way we validate -mfpu and friends, *just* for the
assembler.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243352 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-27 23:44:42 +00:00
Akira Hatanaka 3e0535eabb [AArch64] Unconditionally pass subtarget feature reserve-x18 on Darwin.
After r243308, the front-end is responsible for checking the target OS and
passing reserve-x18 if the target is Darwin.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243310 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-27 19:29:04 +00:00
Douglas Katzman 4fe5acf720 Rename {Hexagon,NaCl}_TC to {Hexagon,NaCl}ToolChain respectively. NFC
Also rename XCore (the toolchain) to XCoreToolChain since XCore is
also a namespace for its tools.

Differential Revision: http://reviews.llvm.org/D10609

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243279 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-27 16:53:08 +00:00
Renato Golin 90cbf30ef1 Setting ARM dynamic linker name from commandline
Currently trigger to select hard-float linker is only based of -gnueabihf
appearing in target triplet, but we should also select it when hardfloat
is requested via cmdline.

Patch by Khem Raj.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243262 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-27 09:56:37 +00:00
David Majnemer 4562db24b3 [clang-cl] Handle -O correctly
We had multiple bugs here:
- We didn't support multiple optimization options in one argument.
  e.g. -O2y-
- We didn't correctly expand -O[12dx] to their respective options.
- We treated -O1 as clang -O1 instead of clang -Os.
- We treated -Ox as clang -O3 instead of clang -O2.  In fact, cl's -Ox
  option is *less* powerful than cl's -O2 option despite -Ox described
  as "Full Optimization".

This fixes PR24003.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243261 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-27 07:32:11 +00:00
David Majnemer 96a43cf07e [clang-cl] Add fallback support for /Zl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243207 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-25 06:07:59 +00:00
Akira Hatanaka c870493a19 [AArch64] Pass subtarget feature "+reserve-x18" instead of passing backend
option "-aarch64-reserve-x18".

This change is needed since backend options do not make it to the backend
when doing LTO and are not capable of changing the behavior of code-gen
passes on a per-function basis.

rdar://problem/21529937

Differential Revision: http://reviews.llvm.org/D11462


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243185 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-25 00:18:00 +00:00
David Majnemer 7acbe3f9c1 [clang-cl] Implement support for the /Zl flag
The flag allows users to specify that they do not want the object file
to have any implicit /defaultlib directives.

This fixes PR24236.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243097 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-24 06:49:13 +00:00
Renato Golin b33750c50c [Compiler-RT] Remove dependency on libgcc_s/eh
Currently, for --rtlib=compiler-rt on GNU systems, we're assuming
that one has libgcc_s and libgcc_eh as low-level libraries, which
when used in conjunction with -lunwind or -lc++abi, breaks that
assumption.

My original fix was wrong, and this patch reverts it to prepare for
a new flag to choose the unwinder/C++ libraries. For the time being,
people can use "-lgcc_s -lgcc_eh" or "-lunwind -lc++abi" or any
combination they need explicitly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243025 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-23 17:24:41 +00:00
Reid Kleckner fe716e557b [mingw] Add support for -rtlib option and -stdlib option to the mingw driver
Now clang should be able to use compiler-rt and libc++ on mingw.

Based on a patch by Martell Malone.

Differential Revision: http://reviews.llvm.org/D11237

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242905 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-22 16:01:38 +00:00
Renato Golin 69756a8a5c Pass -I options to integrates and external assemblers
Fixes PR21000.

Patch by Artem Belevich.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242904 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-22 15:32:36 +00:00
Akira Hatanaka c2e7bae2f2 [ARM] Pass subtarget feature "+reserve-r9" instead of passing backend
option "-arm-reserve-r9".

This recommits r242736, which had to be reverted because the llvm-side
change that was committed in r242737 caused the number of subtarget
features to go over the limit of 64.

This change is needed since backend options do not make it to the backend
when doing LTO and are not capable of changing the behavior of code-gen
passes on a per-function basis.

rdar://problem/21529937

Differential Revision: http://reviews.llvm.org/D11319


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242755 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 01:41:08 +00:00
Akira Hatanaka dc9de2d1a5 Revert r242736.
r242737 caused builds to fail with the following error message, so I'm
reverting the clang side change too:

error:Too many subtarget features! Bump MAX_SUBTARGET_FEATURES.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242741 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-20 23:53:02 +00:00
Akira Hatanaka dfc9065566 [ARM] Pass subtarget feature "+reserve-r9" instead of passing backend
option "-arm-reserve-r9".
        
This change is needed since backend options do not make it to the backend
when doing LTO and are not capable of changing the behavior of code-gen
passes on a per-function basis.

rdar://problem/21529937

Differential Revision: http://reviews.llvm.org/D11319


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242736 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-20 23:20:53 +00:00
Artem Belevich c2ab93aeca Fixed style issues pointed out by Justin Bogner.
Differential Revision: http://reviews.llvm.org/D11273

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242698 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-20 20:02:54 +00:00
Gabor Ballabas 9de1936315 Allow case-insensitive values for -mtune for AArch64 target in line with GCC.
GCC allows case-insensitive values for -mcpu, -march and -mtune options.
This patch implements the same behaviour for the -mtune option for the AArch64 target.

Differential Revision: http://reviews.llvm.org/D10563


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242663 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-20 11:28:20 +00:00
Tom Stellard e218034adf Driver/ToolChain/AMDGPU: Attempt to fix buildbots after r242601
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242602 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-18 02:11:07 +00:00
Tom Stellard 6d3eda0e90 Driver: Add AMDGPU toolchain
Summary:
This is a minimal toolchain, which sets the integrated assembler as default,
and uses lld for linking.

Reviewers: arsenm, mcrosier

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D10700

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242601 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-18 01:49:05 +00:00
Steven Wu 8d9f241210 Fix -save-temp when using objc-arc, sanitizer and profiling
Currently, -save-temp will cause ObjCARC optimization to be dropped,
sanitizer pass to run early in the pipeline, and profiling
instrumentation to run twice.
Fix the issue by properly disable all passes in the optimization
pipeline when generating bitcode output and parse some of the Language
Options even when the input is bitcode so the passes can be setup
correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242565 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-17 20:09:56 +00:00
Petar Jovanovic f76b90d2c3 [Mips] Set mips64r6 as default CPU for MIPS64 Android
Change default CPU for MIPS64 Android. Now it is mips64r6.

Differential Revision: http://reviews.llvm.org/D11294


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242522 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-17 12:57:30 +00:00
Justin Bogner a5899c86b6 Driver: Determine file names for crash reports more reliably
Guessing which file name to replace based on the -main-file-name
argument to -cc1 is flawed. Instead, keep track of which arguments are
inputs to each command.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242504 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-17 03:35:54 +00:00
Akira Hatanaka cd0f3da09c [ARM] Pass subtarget feature "+no-movt" instead of passing backend option
"-arm-use-movt=0".
        
This change is needed since backend options do not make it to the backend
when doing LTO and are not capable of changing the behavior of code-gen
passes on a per-function basis.

rdar://problem/21529937

Differential Revision: http://reviews.llvm.org/D11025


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242368 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-16 00:43:00 +00:00
Reid Kleckner 6ee7a0968c [clang-cl] Disable C++ exceptions a different way
Rather than making -fexceptions a core option that enables C++ EH in
clang-cl, users can use the '-Xclang -fexceptions -Xclang
-fcxx-exceptions' flag set. We weren't going to expose -fexceptions in
clang-cl in the long run, so this way we don't add and then remove a
flag.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242176 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-14 18:16:48 +00:00
Yaron Keren 41095bc72a Add support for -fuse-ld= in the mingw toolchain driver.
We will still default to ld until such a time lld become a 
stable release. lld supports arm NT under the machine name "thumb2pe".

http://reviews.llvm.org/D11088

Patch by Martell Malone
Reviewed by Reid Kleckner



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242121 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-14 05:23:34 +00:00
Artem Belevich da2d19c6cd [cuda] Driver changes to compile and stitch together host and device-side CUDA code.
NOTE: reverts r242077 to reinstate r242058, r242065, 242067
        and includes fix for OS X test failures.

  - Changed driver pipeline to compile host and device side of CUDA
    files and incorporate results of device-side compilation into host
    object file.

  - Added a test for cuda pipeline creation in clang driver.

  New clang options:
  --cuda-host-only   - Do host-side compilation only.
  --cuda-device-only - Do device-side compilation only.

  --cuda-gpu-arch=<ARCH> - specify GPU architecture for device-side
    compilation. E.g. sm_35, sm_30. Default is sm_20. May be used more
    than once in which case one device-compilation will be done per
    unique specified GPU architecture.

  Differential Revision: http://reviews.llvm.org/D9509

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242085 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-13 23:27:56 +00:00
Samuel Antao fcf87ff162 [OpenMP] Add TLS-based implementation for threadprivate directive.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242080 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-13 22:54:53 +00:00
Rafael Espindola c5920d0289 This reverts commit r242058, r242065, r242067.
The tests were failing on OS X.

Revert "[cuda] Driver changes to compile and stitch together host and device-side CUDA code."
Revert "Fixed regex to properly match '64' in the test case."
Revert "clang/test/Driver/cuda-options.cu REQUIRES clang-driver, at least."

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242077 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-13 22:26:30 +00:00
Artem Belevich 05f39953d6 [cuda] Driver changes to compile and stitch together host and device-side CUDA code.
- Changed driver pipeline to compile host and device side of CUDA
    files and incorporate results of device-side compilation into host
    object file.

  - Added a test for cuda pipeline creation in clang driver.

  New clang options:
  --cuda-host-only   - Do host-side compilation only.
  --cuda-device-only - Do device-side compilation only.

  --cuda-gpu-arch=<ARCH> - specify GPU architecture for device-side
    compilation. E.g. sm_35, sm_30. Default is sm_20. May be used more
    than once in which case one device-compilation will be done per
    unique specified GPU architecture.

  Differential Revision: http://reviews.llvm.org/D9509

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242058 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-13 20:21:06 +00:00
Reid Kleckner 4cda45a64b Disable C++ EH by default for clang-cl and MSVC environments
We don't need any more bug reports from users telling us that MSVC-style
C++ exceptions are broken. Developers and adventurous users can still
test the existing functionality by passing along -fexceptions to either
clang or clang-cl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241952 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-10 22:25:44 +00:00
Eric Christopher 473abe5237 Refactor PPC ABI handling to accept and silently ignore -mabi=altivec.
All of the ABIs we support are altivec style anyhow and so the option
doesn't make much sense with the modern ABIs. We could make this a more
noisy ignore, but it would break builds for projects that just pass
it along by default because of historical reasons.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241925 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-10 18:25:54 +00:00
Diego Novillo a1bd00dc2d Factor PGO and coverage flag processing out of Clang::ConstructJob
The function is massively large and GCC is emitting stack overflow
errors when building it (stack, as counted by the compiler, grows to
more than 16Kb).

The new flag processing logic added in r241825 took it over the limit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241918 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-10 18:00:07 +00:00
Daniel Jasper 2e8f7e9423 Re-use a single SmallString instance to reduce the stack frame size
In certain builds (msan), this can otherwise exceed the stack frame
limit set for certain environments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241894 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-10 08:25:54 +00:00
Diego Novillo 9b5c02e4fa Add GCC-compatible flags -fprofile-generate and -fprofile-use.
This patch adds support for specifying where the profile is emitted in a
way similar to GCC. These flags are used to specify directories instead
of filenames. When -fprofile-generate=DIR is used, the compiler will
generate code to write to <DIR>/default.profraw.

The patch also adds a couple of extensions: LLVM_PROFILE_FILE can still be
used to override the directory and file name to use and -fprofile-use
accepts both directories and filenames.

To simplify the set of flags used in the backend, all the flags get
canonicalized to -fprofile-instr-{generate,use} when passed to the
backend. The decision to use a default name for the profile is done
in the driver.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241825 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-09 17:23:53 +00:00
Petar Jovanovic 335cc9e22d [MIPS] Add support for direct-to-nacl in Clang
For Mips direct-to-nacl, the goal is to be close to le32 front-end and
use Mips32EL backend. This patch defines new NaClMips32ELTargetInfo and
modifies it slightly to be close to le32. It also adds necessary parts,
inline with ARM and X86.

Differential Revision: http://reviews.llvm.org/D10739


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241678 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-08 13:07:31 +00:00
Akira Hatanaka 37f3a94e95 Add a comment to explain how the decision to pass feature "+long-calls" is made.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241568 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-07 08:28:42 +00:00
Akira Hatanaka 51c58cc298 [ARM] Pass subtarget feature "+long-calls" instead of passing backend option
"-arm-long-calls".

This change allows using -mlong-calls/-mno-long-calls for LTO and enabling or
disabling long call on a per-function basis.

rdar://problem/21529937

Differential Revision: http://reviews.llvm.org/D9414


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241565 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-07 06:42:05 +00:00
Yaron Keren 40ed9998a7 Support -pthread in mingw toolchain.
"-pthread" appends -lpthread after the object files list passed to the linker.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241485 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-06 18:52:19 +00:00
Teresa Johnson 0cef88b2d8 Resubmit "Pass down the -flto option to the -cc1 job" (r239481)
The patch is the same except for the addition of a new test for the
issue that required reverting the dependent llvm commit.

--Original Commit Message--

Pass down the -flto option to the -cc1 job, and from there into the
CodeGenOptions and onto the PassManagerBuilder. This enables gating
the new EliminateAvailableExternally module pass on whether we are
preparing for LTO.

If we are preparing for LTO (e.g. a -flto -c compile), the new pass is not
included as we want to preserve available externally functions for possible
link time inlining.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241467 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-06 16:23:00 +00:00
Yaron Keren 99d997e97a Support mingw-w64 and mingw.org toolchains at any install location.
No more hardcoded paths: clang will use -sysroot as gcc root location if
provided. Otherwise, it will search for gcc on the path. If not found it
will use the driver installed location.

 http://reviews.llvm.org/D5268

Patch by Ruben Van Boxem, Martell Malone, Yaron Keren.
Reviewed by Reid Kleckner.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241241 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-02 04:45:27 +00:00
Peter Collingbourne 3b090ab87c Make getArchNameForCompilerRTLib return the right thing on 32-bit Windows. Fixes the tests there.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241228 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-02 02:07:43 +00:00
Peter Collingbourne 939db77413 Driver: add support for linking the UBSan runtime library on Windows.
On Windows the user may invoke the linker directly, so we might not have an
opportunity to add runtime library flags to the linker command line. Instead,
instruct the code generator to embed linker directive in the object file
that cause the required runtime libraries to be linked.

We might also want to do something similar for ASan, but it seems to have
its own special complexities which may make this infeasible.

Differential Revision: http://reviews.llvm.org/D10862

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241225 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-02 01:48:12 +00:00
Reid Kleckner 11fd95dc82 [clang-cl] Use /arch: to set the base target CPU
The main effect of this change is that /arch:IA32 will use i386 as the
CPU, while clang-cl will continue to default to pentium4 (aka SSE2 plus
the usual other features).

/arch:AVX and /arch:AVX2 will also now enable the other features
available in sandybridge and haswell respectively, which is consistent
with MSDN.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241077 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-30 16:32:04 +00:00
Douglas Katzman 474f8bc148 More range-based for loops. NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240984 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-29 19:12:56 +00:00
Douglas Katzman 4b79c45a24 Comment fixes. NFC.
- Hexagon options were physically next to to ones that had a
  preceding comment saying "Double dash options", which they aren't.

- The 'ld' tool classes are named Linker, not Link.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240980 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-29 18:42:16 +00:00
Douglas Katzman e9bb2d1882 clang-format some of the files in lib/Driver. NFC
Nothing was hand edited afterward except a few literal strings
and comments that were poorly broken.

Differential Revision: http://reviews.llvm.org/D10689

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240791 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-26 15:47:46 +00:00
Douglas Katzman bd1134d7d4 Use more range-based for loops
Differential Revision: http://reviews.llvm.org/D10738

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240674 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-25 18:51:37 +00:00
Douglas Katzman ffe58864d3 Pedantically rename all Tool subclasses to be nouns, not verbs. NFC
Classes in Tools.h inherit ultimately from Tool, which is a noun,
but subclasses of Tool were named for their operation, such as "Compile",
wherein the constructor call "Compile(args...)" could be misconstrued
as actually causing a compile to happen.

Likewise various other methods were not harmonious with their effect,
in that "BuildLinker()" returned a "new namespace::Link(...)"
instead of a "new namespace::Linker(...)" which it now does.

Exceptions: Clang and ClangAs are un-renamed. Those are their rightful names.
And there is no particulary great way to name the "Lipo-er" and a few others.

Differential Revision: http://reviews.llvm.org/D10595

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240455 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 20:42:09 +00:00
Jim Grosbach a0e0967f2d Driver: Pass -I options to cc1as for .include search paths.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240432 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 18:20:13 +00:00
Alexander Kornienko 8ca7705aa3 Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240353 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 23:07:51 +00:00
Alexander Kornienko ac58acc7f2 Fixed/added namespace ending comments using clang-tidy. NFC
The patch is generated using this command:

  $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \
      -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \
      work/llvm/tools/clang

To reduce churn, not touching namespaces spanning less than 10 lines.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240270 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 09:47:44 +00:00
Alexey Samsonov 340eaaf2d3 [CFI] Require -flto instead of implying it.
Summary:
This is unfortunate, but would let us land http://reviews.llvm.org/D10467,
that makes ToolChains responsible for computing the set of sanitizers
they support.

Unfortunately, Darwin ToolChains doesn't know about actual OS they
target until ToolChain::TranslateArgs() is called. In particular, it
means we won't be able to construct SanitizerArgs for these ToolChains
before that.

This change removes SanitizerArgs::needsLTO() method, so that now
ToolChain::IsUsingLTO(), which is called very early, doesn't need
SanitizerArgs to implement this method.

Docs and test cases are updated accordingly. See
https://llvm.org/bugs/show_bug.cgi?id=23539, which describes why we
start all these.

Test Plan: regression test suite

Reviewers: pcc

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D10560

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240170 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-19 19:57:46 +00:00
Douglas Katzman 68aba8bade Add nominal support for 'shave' target.
This change passes through C and assembler jobs to Movidius tools by
constructing commands which are the same as ones produces by the examples
in the SDK. But rather than reference MV_TOOLS_DIR to find tools,
we will assume that binaries are installed wherever the Driver would
find its native tools. Similarly, this change assumes that -I options
will "just work" based on where SDK headers get installed, rather than
baking into the Driver some magic paths.

Differential Revision: http://reviews.llvm.org/D10440

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240134 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-19 14:55:19 +00:00
Gabor Ballabas b5892a68e2 Allow case-insensitive values for -march for AArch64 target in line with GCC.
GCC allows case-insensitive values for -mcpu, -march and -mtune options.
This patch implements the same behaviour for the -march option for the AArch64 target.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240019 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-18 14:23:12 +00:00
Toma Tabacu ddd46efad4 [mips] Don't propagate -mfpxx by default if soft/single float were also set.
Summary:
If the driver is only given -msoft-float/-mfloat-abi=soft or -msingle-float,
we should refrain from propagating -mfpxx, unless it was explicitly given on the
command line.

Reviewers: atanasyan, dsanders

Reviewed By: atanasyan, dsanders

Subscribers: cfe-commits, mpf

Differential Revision: http://reviews.llvm.org/D10387

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239818 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-16 13:54:13 +00:00
Richard Smith 1991fe29ae [modules] Rename -fmodule-maps to -fimplicit-module-maps (and likewise for
-fno-module-maps). The old names are preserved for compatibility.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239792 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-16 00:20:23 +00:00
Richard Smith 6e03dd94ce [modules] Simplify -cc1 interface for enabling implicit module maps.
We used to have a flag to enable module maps, and two more flags to enable
implicit module maps. This is all redundant; we don't need any flag for
enabling module maps in the abstract, and we don't usually have -fno- flags for
-cc1. We now have just a single flag, -fimplicit-module-maps, that enables
implicitly searching the file system for module map files and loading them.

The driver interface is unchanged for now. We should probably rename
-fmodule-maps to -fimplicit-module-maps at some point.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239789 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-16 00:08:24 +00:00
Peter Collingbourne 4d2986d891 Protection against stack-based memory corruption errors using SafeStack: Clang command line option and function attribute
This patch adds the -fsanitize=safe-stack command line argument for clang,
which enables the Safe Stack protection (see http://reviews.llvm.org/D6094
for the detailed description of the Safe Stack).

This patch is our implementation of the safe stack on top of Clang. The
patches make the following changes:

- Add -fsanitize=safe-stack and -fno-sanitize=safe-stack options to clang
  to control safe stack usage (the safe stack is disabled by default).

- Add __attribute__((no_sanitize("safe-stack"))) attribute to clang that can be
  used to disable the safe stack for individual functions even when enabled
  globally.

Original patch by Volodymyr Kuznetsov and others at the Dependable Systems
Lab at EPFL; updates and upstreaming by myself.

Differential Revision: http://reviews.llvm.org/D6095

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239762 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-15 21:08:13 +00:00
James Y Knight c19a4e87de [Sparc] Make soft-float emit an error.
LLVM does not and has not ever supported a soft-float ABI mode on
Sparc, so don't pretend that it does.

Also switch the default from "soft-float" -- which was actually
hard-float because soft-float is unimplemented -- to hard-float.

Differential Revision: http://reviews.llvm.org/D10457

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239755 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-15 20:51:24 +00:00
Gabor Ballabas b1fa2e3d13 Allow case-insensitive values for -mcpu for AArch64 target in line with GCC.
GCC allows case-insensitive values for -mcpu, -march and -mtune options.
This patch implements the same behaviour for the -mcpu option for the AArch64 target.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239619 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-12 17:33:37 +00:00
Teresa Johnson 0ad64379ab Revert commit r239481 as it is dependent on reverted llvm commit r239480.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239588 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-12 03:11:50 +00:00
Sanjay Patel f459f9ec11 add the -mrecip driver flag and process its options (3rd try)
The 1st and 2nd tries to land this (r238055, r238851) were reverted due to
bot failures caused by the LLVM part of the patch. That was hopefully fixed 
after r239001.

This is the front-end counterpart to D8982.

The -mrecip option interface is based on maintaining compatibility with gcc:
https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/i386-and-x86-64-Options.html#index-mrecip_003dopt-1627
https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/RS_002f6000-and-PowerPC-Options.html#index-mrecip-2289

...while adding more functionality (allowing users to specify the number of refinement steps for each
estimate type).

Differential Revision: http://reviews.llvm.org/D8989



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239536 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-11 14:53:41 +00:00
Gabor Ballabas 3f8eb8f1fd Allow case-insensitive values for -march for ARM in line with GCC.
GCC allows case-insensitive values for -mcpu, -march and -mtune options.
This patch implements the same behaviour for the -march option for ARM.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239527 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-11 12:29:56 +00:00
Toma Tabacu 03cf4b775a [mips] Pass on -m{single,double}-float to GAS.
Summary: We already pass these to the IAS, but not to GAS.

Reviewers: dsanders, atanasyan

Reviewed By: atanasyan

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D10358

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239525 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-11 12:13:18 +00:00
Teresa Johnson 68c98251b7 Pass down the -flto option to the -cc1 job, and from there into the
CodeGenOptions and onto the PassManagerBuilder. This enables gating
the new EliminateAvailableExternally module pass on whether we are
preparing for LTO.

If we are preparing for LTO (e.g. a -flto -c compile), the new pass is not
included as we want to preserve available externally functions for possible
link time inlining.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239481 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-10 17:49:45 +00:00
Sean Silva 3f7a3dbf41 range-for'ify Args->filtered_begin(...) loops
We already have Args->filtered(...) which is a drop-in range-for
replacement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239381 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 01:57:17 +00:00
David Majnemer 411fab5c85 [Driver] Inject the MSVC compatibility version into the triple
Encoding the version into the triple will allow us to communicate to
LLVM what functions it can expect to depend upon in the implementation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239273 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 00:22:46 +00:00
John Brawn dd9bf939b7 [ARM] Use TargetParser to determine FPU subtarget features
The main effect of this is to fix anomalies where certain -mfpu options didn't
disable everything that they should causing strange behaviour when combined
with -mcpu or -march values that themselves enabled fpu subtarget features,
e.g. -mfpu=fpv5-dp-d16 with -march=armv7em previously behaved the same as
-mfpu=fpv5-sp-d16 due to fp-only-sp not being disabled.

Invalid -mfpu options now also give an error, which is consistent with the
handling of the .fpu directive.

Differential Revision: http://reviews.llvm.org/D10239


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239152 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 13:34:11 +00:00
Artyom Skrobov f18a256b31 Simplify ARMTargetParser::parseArch(ARMTargetParser::getCanonical()), following r239099
Reviewers: rengolin

Reviewed By: rengolin

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D10256


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239101 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 21:31:41 +00:00
Gabor Ballabas c906d40ab1 Allow case-insensitive values for -mcpu for ARM
GCC allows case-insensitive values for -mcpu, -march and -mtune options.
This patch implements the same behaviour for the -mcpu option.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239059 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 17:56:32 +00:00
Brad Smith c44a112efe Use the appropriate PIE level for OpenBSD/sparc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239028 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 08:45:23 +00:00
Douglas Katzman 91b67ebe78 Save getArch() in a local var instead of calling it 20 times, etc.
Differential Revision: http://reviews.llvm.org/D10224

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238992 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 00:15:00 +00:00
Rafael Espindola 04b62e3ee2 Revert "add the -mrecip driver flag and process its options (2nd try)"
This reverts commit r238851.

It depends on a llvm commit that was reverted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238904 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 05:44:28 +00:00
Sanjay Patel d1c4ddae4b add the -mrecip driver flag and process its options (2nd try)
The first try to land this (r238055) was reverted due to bot failures
caused by the LLVM part of the patch. That was hopefully fixed by r238788,
and the LLVM patch was resubmitted at r238842.

This is the front-end counterpart to D8982.

The -mrecip option interface is based on maintaining compatibility with gcc:
https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/i386-and-x86-64-Options.html#index-mrecip_003dopt-1627
https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/RS_002f6000-and-PowerPC-Options.html#index-mrecip-2289

...while adding more functionality (allowing users to specify the number of refinement steps for each
estimate type).

Differential Revision: http://reviews.llvm.org/D8989



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238851 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 16:55:12 +00:00
Benjamin Kramer b7b56528f9 Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types
If the type isn't trivially moveable emplace can skip a potentially
expensive move. It also saves a couple of characters.


Call sites were found with the ASTMatcher + some semi-automated cleanup.

memberCallExpr(
    argumentCountIs(1), callee(methodDecl(hasName("push_back"))),
    on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))),
    hasArgument(0, bindTemporaryExpr(
                       hasType(recordDecl(hasNonTrivialDestructor())),
                       has(constructExpr()))),
    unless(isInTemplateInstantiation()))

No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238601 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 19:42:19 +00:00
John Brawn 195ea91eac [ARM] Adjust -march checking
getCanonicalArchName can return an empty string for an architecture
that is well-formed but meaningless. Use parseArch to determine if
it's actually valid or not.

Differential Revision: http://reviews.llvm.org/D10120


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238553 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 13:10:44 +00:00
Chandler Carruth 3348c819ca [omp] Fix a typo in a comment and a line I forgot to clang-format that
Justin pointed out in post-commit review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238498 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 21:10:31 +00:00
Renato Golin 1eb96d85f0 [ARMTargetParser] FIXME on getLLVMArchSuffixForARM. NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238430 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 15:05:53 +00:00
Chandler Carruth 81e187390e [omp] Re-work Clang's handling of -fopenmp and undo r237769.
This isn't an actual revert of r237769, it just restores the behavior of
the Clang driver prior to it while completely re-implementing how that
behavior works.

This also re-does the work of making the default OpenMP runtime
selectable at CMake (or configure) time to work in the way all of our
other such hooks do (config.h, configure and cmake hooks, etc.).

I've re-implemented how we manage the '-fopenmp' flagset in an important
way. Now, the "default" hook just makes '-fopenmp' equivalent to
'-fopenmp=<default>' rather than a separate special beast. Also, there
is an '-fno-openmp' flag which does the obvious thing. Also, the code is
shared between all the places to select a known OpenMP runtime and act
on it.

Finally, and most significantly, I've taught the driver to inspect the
selected runtime when choosing whether to propagate the '-fopenmp' flag
to the frontend in the CC1 commandline. Without this, it isn't possible
to use Clang with libgomp, even if you were happy with the serial,
boring way in which it worked previously (ignoring all #pragmas but
linking in the library to satisfy direct calls into the runtime).

While I'm here, I've gone ahead and sketched out a path for the future
name of LLVM's OpenMP runtime (libomp) and the legacy support for its
current name (libiomp5) in what seems a more reasonable way.

To re-enable LLVM's OpenMP runtime (which I think should wait until the
normal getting started instructions are a reasonable way for falks to
check out, build, and install Clang with the runtime) all that needs to
change is the default string in the CMakeLists.txt and configure.ac
file. No code changes necessary.

I also added a test for the driver's behavior around OpenMP since it was
*completely missing* previously. Makes it unsurprising that we got it
wrong.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238389 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 01:52:38 +00:00
David Majnemer 9a5a6f0e14 [Driver] Unbreak hexagon build bots
AddHexagonTargetArgs didn't respect the driver flags by unconditionally
pushing -fno-signed-char.  Instead, add Hexagon handling to
isSignedCharDefault.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238106 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 19:23:55 +00:00
David Majnemer 68906e4175 [Driver] Handle -fno-signed-char and -fno-unsigned-char
GCC maps -fno-unsigned-char to -fsigned-char and -fno-signed-char to
-funsigned-char.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238105 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 18:48:37 +00:00
Rafael Espindola 9f50d2f551 This reverts commit r238064 and r238055.
They depend on a reverted llvm commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238076 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 00:30:33 +00:00
Sanjay Patel f3abc1c277 add the -mrecip driver flag and process its options
This is the front-end counterpart to D8982 (LLVM r238051).

The -mrecip option interface is based on maintaining compatibility with gcc:
https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/i386-and-x86-64-Options.html#index-mrecip_003dopt-1627
https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/RS_002f6000-and-PowerPC-Options.html#index-mrecip-2289

...while adding more functionality (allowing users to specify the number of refinement steps for each
estimate type).

Differential Revision: http://reviews.llvm.org/D8989



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238055 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 21:42:10 +00:00
Rafael Espindola c8e9dddb56 Make unique section names the default again.
Using non unique names found a bug in the ICF inplementation in gold:

https://sourceware.org/bugzilla/show_bug.cgi?id=18440

This reverts commit r234143.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238048 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 20:44:03 +00:00
Renato Golin c7f06de7cf Use profile and version parsers from ARMTargetParser
Now that ARMTargetParser can parse profile and version numbers,
use them instead of the local implementation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238037 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 18:18:25 +00:00
John Brawn 8bfeeffa35 [ARM] Restructure cpu handling in the driver to mostly use the triple
Using the target cpu to determine some behaviour is sprinkled in
several places in the driver, but in almost all the information that
is needed can be found in the triple. Restructure things so that the
triple is used, and the cpu is only used if the exact cpu name is
needed.

Also add a check that the -mcpu argument is valid, and correct the
-march argument checking so that it handles -march=native correctly. I
would have liked to move these checks into the computation of the
triple, but the triple is calculated several times in several places
and that would lead to multiple error messages for the same thing.

Differential Revision: http://reviews.llvm.org/D9879


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237894 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 12:19:49 +00:00
Richard Smith 090194f4ad [OpenMP] Make default OpenMP library (the one selected with just -fopenmp)
configurable in the CMake build. There shouldn't be any change in default
behavior.

Derived from a patch by Daniel Jasper!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237850 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 22:48:44 +00:00
Alexey Bataev 4b96eb8f82 [OPENMP] -fopenmp enables OpenMP support (fix for http://llvm.org/PR23492)
-fopenmp turns on OpenMP support and links libiomp5 as OpenMP library. Also there is -fopenmp={libiomp5|libgomp} option that allows to override effect of -fopenmp and link libgomp library (if -fopenmp=libgomp is specified).
Differential Revision: http://reviews.llvm.org/D9736


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237769 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 04:24:19 +00:00
David Majnemer cd432f5ea2 [clang-cl] Enable C++14 when targeting 2015 compatibility
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237553 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 04:49:30 +00:00
Ikhlas Ajbar 3ac6c9b178 Remove unused function HasPICArg().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237374 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-14 17:42:20 +00:00
Ikhlas Ajbar 24f8609892 Factor out SmallDataThreshold
This patch factors out SmallDataThreshold code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237364 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-14 13:52:08 +00:00
Vladimir Sukharev b1e6d16339 [ARM] Add v8.1a architecture
Add support for ARMv8.1a architecture. 

Briefly it is described on http://community.arm.com/groups/processors/blog/2014/12/02/the-armv8-a-architecture-and-its-ongoing-development

Reviewers: 	jmolloy, rengolin

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8799


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237349 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-14 08:25:18 +00:00
Renato Golin 36a485732a Change TargetParser enum names to avoid macro conflicts (clang)
sys/time.h on Solaris (and possibly other systems) defines "SEC" as "1"
using a cpp macro.  The result is that this fails to compile.

Fixes https://llvm.org/PR23482

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237113 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-12 10:34:10 +00:00
Justin Bogner 251e47cd07 Re-apply "Driver: Make profiling flags work with -nostdlib on Darwin"
This time without a stray "true" in an argument list.

This reverts r237077, restoring r237074.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237091 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-12 05:44:36 +00:00
Justin Bogner a8da87d88a Revert "Driver: Make profiling flags work with -nostdlib on Darwin"
This revert r237074. These tests are failing all over the place.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237077 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-12 01:04:33 +00:00
Justin Bogner e5907a0647 Driver: Make profiling flags work with -nostdlib on Darwin
Compiler-rt's Profiling library isn't part of the stdlib, so -nostdlib
shouldn't prevent it from being linked. This makes Darwin behave like
other toolchains, and link in the profile runtime irrespective of
-nostdlib, since the resulting program can't be run unless you link
this.

I've also added a test to show that other toolchains already behave
like this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237074 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-12 00:31:33 +00:00
Douglas Katzman ced6e32e73 [Sparc] Add support for 'sparcel' to clang.
Differential Revision: http://reviews.llvm.org/D8784

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237001 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-11 15:21:44 +00:00
Ikhlas Ajbar 8784523886 Factor out Hexagon code to build args.
This patch factor out the code in hexagon::Link::ConstructJob to be reused
in other functions. No functionality change intended.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236926 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-09 02:13:25 +00:00
Renato Golin 3d06cfd100 Using ARMTargetParser in Clang
This is a starting point for using the TargetParser in Clang, in a simple
enough part of the code that can be used without disrupting the crazy
platform support that we need to be compatible with other toolchains.

Also adding a few FIXME on obvious places that need replacing, but those
cases will indeed break a few of the platform assumptions, as arch/cpu names
change multiple times in the driver.

Finally, I'm changing the "neon-vfpv3" behaviour to match standard NEON, since
-mfpu=neon implies vfpv3 by default in both Clang and LLVM. That option
string is still supported as an alias to "neon".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236901 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-08 21:04:50 +00:00
Renato Golin edde108831 Revert "Allow case-insensitive values for -mcpu for ARM and AArch64"
This reverts commit r236859, as it broke multiple builds. I'll investigate
and reapply when safe.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236869 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-08 15:44:36 +00:00
Renato Golin 82157e148d Allow case-insensitive values for -mcpu for ARM and AArch64
GCC allows case-insensitive values for -mcpu, -march and -mtune options.
This patch implements the same behaviour for the -mcpu option.

Patch by Gabor Ballabas.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236859 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-08 14:50:32 +00:00
John Brawn a67054279c [ARM] Give an error on invalid -march values
llvm::Triple::getARMCPUForArch now returns nullptr for invalid -march
values, instead of silently translating it to arm7tdmi. Use this to
give an error message, which is consistent with how gcc behaves.

Differential Revision: http://reviews.llvm.org/D9602


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236846 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-08 12:52:18 +00:00
Artem Belevich eb3e7a271d [driver] Cosmetic change to use Input instead of Inputs[0].
Differential Revision: http://reviews.llvm.org/D9506

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236621 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 18:20:23 +00:00
Ulrich Weigand a731c44cae [SystemZ] Add support for z13 and its vector facility
This patch adds support for the z13 architecture type.  For compatibility
with GCC, a pair of options -mvx / -mno-vx can be used to selectively
enable/disable use of the vector facility.

When the vector facility is present, we default to the new vector ABI.
This is characterized by two major differences:
- Vector types are passed/returned in vector registers
  (except for unnamed arguments of a variable-argument list function).
- Vector types are at most 8-byte aligned.

The reason for the choice of 8-byte vector alignment is that the hardware
is able to efficiently load vectors at 8-byte alignment, and the ABI only
guarantees 8-byte alignment of the stack pointer, so requiring any higher
alignment for vectors would require dynamic stack re-alignment code.

However, for compatibility with old code that may use vector types, when
*not* using the vector facility, the old alignment rules (vector types
are naturally aligned) remain in use.

These alignment rules are not only implemented at the C language level,
but also at the LLVM IR level.  This is done by selecting a different
DataLayout string depending on whether the vector ABI is in effect or not.

Based on a patch by Richard Sandiford.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236531 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-05 19:35:52 +00:00
Justin Bogner cc56792acc InstrProf: Support for setting profile output from command line
This change is the third of 3 patches to add support for specifying
the profile output from the command line via -fprofile-instr-generate=<path>,
where the specified output path/file will be overridden by the
LLVM_PROFILE_FILE environment variable.

This patch adds the necessary support to the clang frontend, and adds a
new test.

The compiler-rt and llvm parts are r236055 and r236288, respectively.

Patch by Teresa Johnson. Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236289 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 23:49:42 +00:00
Nico Weber 96fd31fe5d Revert r236060, it caused PR23375.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236159 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 21:16:40 +00:00
Eric Christopher 535c8ba7a1 Stop emitting the soft-float and soft-float-abi target features
for ARM while the backend will only ignore them. No functional
change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236060 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-28 23:18:33 +00:00
Alexey Samsonov fc89bfc52c Introduce tsan_cxx and msan_cxx libraries (Clang part).
For now tsan_cxx and msan_cxx contain only operator new/delete
replacements. In the future, when we add support for running UBSan+TSan
and UBSan+MSan, they will also contain bits ubsan_cxx runtime.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235924 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-27 22:07:50 +00:00
Artem Belevich 7808a191be Revert "PR21000: pass -I options to assembler" as the test was failing on hexagon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235919 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-27 21:11:08 +00:00
Artem Belevich 07b604d353 PR21000: pass -I options to assembler
Pass -I options to assembly so it can find files included with
.include.

Differential Revision: http://reviews.llvm.org/D7472

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235915 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-27 20:51:44 +00:00
Paul Robinson cc44eec4a2 Support generating NMake/Jom-style depfiles.
NMake is a Make-like builder that comes with Microsoft Visual Studio.
Jom (https://wiki.qt.io/Jom) is an NMake-compatible build tool.
Dependency files for NMake/Jom need to use double-quotes to wrap
filespecs containing special characters, instead of the backslash
escapes that GNU Make wants.

Adds the -MV option, which specifies to use double-quotes as needed
instead of backslash escapes when writing the dependency file.

Differential Revision: http://reviews.llvm.org/D9260


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235903 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-27 18:14:32 +00:00
Vladimir Sukharev 53680ccdfa [AArch64] Add v8.1a architecture
Add support for AArch64 v8.1 architecture. Briefly it is described on http://community.arm.com/groups/processors/blog/2014/12/02/the-armv8-a-architecture-and-its-ongoing-development

Reviewers: jmolloy

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8493


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235110 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-16 15:53:09 +00:00
Duncan P. N. Exon Smith dce722961a uselistorder: -mllvm -preserve-bc-use-list-order => -emit-llvm-uselists
Stop relying on `cl::opt` to pass along the driver's decision to
preserve use-lists.  Create a new `-cc1` option called
`-emit-llvm-uselists` that does the right thing (when -emit-llvm-bc).
Note that despite its generic name, it *doesn't* do the right thing when
-emit-llvm (LLVM assembly) yet.  I'll hook that up soon.

This doesn't really change the behaviour of the driver.  The default is
still to preserve use-lists for `clang -emit-llvm` and `clang
-save-temps`, and nothing else.  But it stops relying on global state
(and also is a nicer interface for hackers using `clang -cc1`).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234962 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-15 01:16:18 +00:00
Duncan P. N. Exon Smith ae0b514686 IR: Change clang to set -preserve-bc-uselistorder
Change `clang` to set `-preserve-bc-uselistorder` for the driver options
`-emit-llvm` and `-save-temps`.  The former is useful for reproducing
results from `clang` in `opt` or `llc`, while the latter prevents
`-save-temps` from affecting the output.  This is part of PR5680.

`-preserve-bc-uselistorder=true` is currently on by default, but a
follow-up commit in LLVM will reverse it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234920 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-14 18:30:13 +00:00
Petar Jovanovic 9cbad60fe5 [Mips] Generate warning for invalid '-mnan' and '-march' combinations
This patch generates a warning for invalid combination of '-mnan' and
'-march' options, it properly sets NaN encoding for a given '-march',
and it passes a proper NaN encoding to the assembler.

Patch by Vladimir Radosavljevic.

Differential Revision: http://reviews.llvm.org/D8170


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234882 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-14 12:49:08 +00:00
Ahmed Bougacha 070ffd29fb [Driver] Properly support -mglobal-merge using explicit options.
Follow-up to r234666.  With this, the -m[no-]global-merge options
have the expected behavior. Previously, -mglobal-merge was ignored,
and there was no way of enabling the optimization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234668 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-11 00:10:44 +00:00
Derek Schuff 3ec9ae83a9 NaCl ARM: fix assembler float abi flags
Summary:
tools::arm::getARMFloatABI() was falling back to guessing soft-float because
it wasn't seeing the GNUEABIHF environment from ComputeEffectivClangTriple
when it was called from gnutools::Assemble::ConstructJob.

Fix by using the effective clang triple in gnutools::Assemble, which now
matches the -triple flag used by cc1 and ClangAs jobs.

Reviewers: jvoung

Subscribers: rengolin, jfb, aemerson, cfe-commits

Differential Revision: http://reviews.llvm.org/D8902

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234661 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-10 23:07:19 +00:00
Sanjay Patel d2eccb2430 Process the -freciprocal-math optimization flag (PR20912)
The driver currently accepts but ignores the -freciprocal-math flag.
This patch passes the flag through and enables 'arcp' fast-math-flag
generation in IR.

Note that this change does not actually enable the optimization for
any target. The reassociation optimization that this flag specifies
was implemented by http://reviews.llvm.org/D6334 :
http://llvm.org/viewvc/llvm-project?view=revision&revision=222510

Because the optimization is done in the backend rather than IR,
the backend must be modified to understand instruction-level
fast-math-flags or a new function-level attribute must be created.

Also note that -freciprocal-math is independent of any target-specific
usage of reciprocal estimate hardware instructions. That requires
its own flag ('-mrecip').

https://llvm.org/bugs/show_bug.cgi?id=20912


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234493 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09 15:03:23 +00:00
Javed Absar 16eb22d1df [ARM] add support for Cortex-R4/R4F
Adds ARM Cortex-R4 and R4F support and tests in Clang. Though Cortex-R4
support was present, the support for hwdiv in thumb-mode was not defined
or tested properly. This has also been added.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234488 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09 14:12:10 +00:00
Rafael Espindola 29aa637b37 This reverts commit r234104, bringing back 233393 now that ARM is fixed.
Original message:

Don't use unique section names by default if using the integrated as.

This saves some IO and ccache space by not creating long section names. It
should work with every ELF linker.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234143 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-06 04:36:45 +00:00
Rafael Espindola 5e1318d69b Revert "Revert "Revert "Don't use unique section names by default if using the integrated as."""
This reverts commit r234101. I will debug what went wrong with ARM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234104 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-04 19:32:41 +00:00
Rafael Espindola b8f131b2b9 Revert "Revert "Don't use unique section names by default if using the integrated as.""
This reverts commit r233398, bringing back 233393 now that LLVM is fixed.

Original message:

Don't use unique section names by default if using the integrated as.

This saves some IO and ccache space by not creating long section names. It
should work with every ELF linker.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234101 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-04 18:21:14 +00:00
Eric Christopher 98ecad7a11 Complete comment. Reflow conditional.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234083 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-04 03:34:43 +00:00
Alexey Samsonov d841fb4694 [UBSan] Embed UBSan into ASan runtime (Clang part).
Summary:
Change the way we use ASan and UBSan together. Instead of keeping two
separate runtimes (libclang_rt.asan and libclang_rt.ubsan), embed UBSan
into ASan and get rid of libclang_rt.ubsan. If UBSan is not supported on
a platform, all UBSan sources are just compiled into dummy empty object
files. UBSan initialization code (e.g. flag parsing) is directly called
from ASan initialization, so we are able to enforce correct
initialization order.

This mirrors the approach we already use for ASan+LSan. This change doesn't
modify the way we use standalone UBSan.

Test Plan: regression test suite

Reviewers: kubabrecka, zaks.anna, kcc, rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8645

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233860 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-01 22:42:25 +00:00
Ulrich Weigand 5f71cb31d8 [SystemZ] Support transactional execution on zEC12
The zEC12 provides the transactional-execution facility.  This is exposed
to users via a set of builtin routines on other compilers.  This patch
adds clang support to enable those builtins.  In partciular, the patch:

- enables the transactional-execution feature by default on zEC12
- allows to override presence of that feature via the -mhtm/-mno-htm options
- adds a predefined macro __HTM__ if the feature is enabled
- adds support for the transactional-execution GCC builtins
- adds Sema checking to verify the __builtin_tabort abort code
- adds the s390intrin.h header file (for GCC compatibility)
- adds s390 sections to the htmintrin.h and htmxlintrin.h header files

Since this is first use of target-specific intrinsics on the platform,
the patch creates the include/clang/Basic/BuiltinsSystemZ.def file and
hooks it up in TargetBuiltins.h and lib/Basic/Targets.cpp.

An associated LLVM patch adds the required LLVM IR intrinsics.

For reference, the transactional-execution instructions are documented
in the z/Architecture Principles of Operation for the zEC12:
http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/download/DZ9ZR009.pdf
The associated builtins are documented in the GCC manual:
http://gcc.gnu.org/onlinedocs/gcc/S_002f390-System-z-Built-in-Functions.html
The htmxlintrin.h intrinsics provided for compatibility with the IBM XL
compiler are documented in the "z/OS XL C/C++ Programming Guide".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233804 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-01 12:54:25 +00:00
Craig Topper e382524eee [X86] Use getHostCPUFeatures when 'native' is specified for cpu.
This is necessary because not aall Sandybridge, Ivybrige, Haswell, and Broadwell CPUs support AVX. Currently we modify the CPU name back to Nehalem for this case, but that turns off additional features for these CPUs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233672 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-31 05:45:00 +00:00
Derek Schuff 1d94133561 Add driver support for Native Client SDK
Add Tool and ToolChain support for clang to target the NaCl OS using the NaCl
SDK for x86-32, x86-64 and ARM.

Includes nacltools::Assemble and Link which are derived from gnutools. They
are similar to Linux but different enought that they warrant their own class.
Also includes a NaCl_TC in ToolChains derived from Generic_ELF with library
and include paths suitable for an SDK and independent of the system tools.

Differential Revision: http://reviews.llvm.org/D8590

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233594 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 20:31:33 +00:00
Rafael Espindola 326442a322 Revert "Don't use unique section names by default if using the integrated as."
This reverts commit r233393 while a debug a bot failure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233398 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-27 19:01:14 +00:00
Rafael Espindola 3f1423bde2 Don't use unique section names by default if using the integrated as.
This saves some IO and ccache space by not creating long section names. It
should work with every ELF linker.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233393 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-27 17:55:23 +00:00
Ed Schouten 5c5a446244 Enable -ffunction-sections and -fdata-sections for CloudABI by default.
Unlike most of the other platforms supported by Clang, CloudABI only
supports static linkage, for the reason that global filesystem access is
prohibited. Functions provided by dlfcn.h are not present. As we know
that applications will not try to do any symbol lookups at run-time, we
can garbage collect unused code quite aggressively. Because of this, it
makes sense to enable -ffunction-sections and -fdata-sections by
default.

Object files will be a bit larger than usual, but the resulting binary
will not be affected, as the sections are merged again. However, when
--gc-sections is used, the linker is able to remove unused code far more
more aggressively. It also has the advantage that transitive library
dependencies only need to be provided to the linker in case that
functionality is actually used.

Differential Revision:	http://reviews.llvm.org/D8635
Reviewed by:	echristo


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233299 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26 17:50:28 +00:00
Ed Schouten 1900e229c0 Let Clang invoke CloudABI's linker.
Now that CloudABI's target information and header search logic for Clang
has been submitted, the only thing that remains to be done is adding
support for CloudABI's linker.

CloudABI uses Binutils ld, although there is some work to use lld
instead. This means that this code is largely based on what we use on
FreeBSD. There are some exceptions, however:

- Only static linking is performed. CloudABI does not support any
  dynamically linked executables.
- CloudABI uses compiler-rt, libc++ and libc++abi unconditionally. Link
  in these libraries instead of using libgcc_s, libstdc++, etc.
- We must ensure that the .eh_frame_hdr is present to make C++
  exceptions work properly.


Differential Revision:	http://reviews.llvm.org/D8250


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233269 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26 11:13:44 +00:00
Alexey Samsonov c9c173402a [UBSan] Introduce "ubsan_standalone" library (Clang part).
Get rid of "libclang_rt.san" library that used to contain
sanitizer_common pieces required by UBSan if it's used in a standalone
mode. Instead, build two variants of UBSan runtime: "ubsan" and
"ubsan_standalone" (same for "ubsan_cxx" and "ubsan_standalone_cxx").

Later "ubsan" and "ubsan_cxx" libraries will go away, as they will
embedded it into corresponding ASan runtimes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233010 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 20:05:42 +00:00
Eric Christopher ffc858c6f8 Fix and update comments and a small reformatting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232997 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 19:26:05 +00:00
Scott Douglass 5bd812a052 handle armeb/thumb/thumbeb consistently in gnutools::Assemble::ConstructJob
Differential Revision: http://reviews.llvm.org/D8196


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232940 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 10:54:24 +00:00
Scott Douglass 799d9c0dcd Convert cascading if-else-if to switch. NFC
Differential Revision: http://reviews.llvm.org/D8485


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232939 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 10:46:28 +00:00
David Majnemer 4ea46f54b3 MS ABI: Implement driver-level support for thread-safe statics
Decide whether or not to use thread-safe statics depending on whether or
not we have an explicit request from the driver.  If we don't have an
explicit request, infer which behavior to use depending on the
compatibility version we are targeting.

N.B. CodeGen support is still ongoing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232906 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-22 08:39:22 +00:00
Filipe Cabecinhas b690b4e662 Only add -fno-rtti if KernelOrKext or in C++ mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232869 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-20 23:51:15 +00:00
Reid Kleckner 79bcca2647 C++14: Disable sized deallocation by default due to ABI breakage
There are no widely deployed standard libraries providing sized
deallocation functions, so we have to punt and ask the user if they want
us to use sized deallocation. In the future, when such libraries are
deployed, we can teach the driver to detect them and enable this
feature.

N3536 claimed that a weak thunk from sized to unsized deallocation could
be emitted to avoid breaking backwards compatibility with standard
libraries not providing sized deallocation. However, this approach and
other variations don't work in practice.

With the weak function approach, the thunk has to have default
visibility in order to ensure that it is overridden by other DSOs
providing sized deallocation. Weak, default visibility symbols are
particularly expensive on MachO, so John McCall was considering
disabling this feature by default on Darwin. It also changes behavior
ELF linking behavior, causing certain otherwise unreferenced object
files from an archive to be pulled into the link.

Our second approach was to use an extern_weak function declaration and
do an inline conditional branch at the deletion call site. This doesn't
work because extern_weak only works on MachO if you have some archive
providing the default value of the extern_weak symbol. Arranging to
provide such an archive has the same challenges as providing the symbol
in the standard library. Not to mention that extern_weak doesn't really
work on COFF.

Reviewers: rsmith, rjmccall

Differential Revision: http://reviews.llvm.org/D8467

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232788 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-20 00:31:07 +00:00
Manuel Klimek a6cf41a8be Add option to switch off putting header modules into the dependency file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232721 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-19 12:00:22 +00:00
Yaron Keren 9bd91b686a Remove many superfluous SmallString::str() calls.
Now that SmallString is a first-class citizen, most SmallString::str()
calls are not required. This patch removes a whole bunch of them, yet
there are lots more.

There are two use cases where str() is really needed:
1) To use one of StringRef member functions which is not available in
SmallString.
2) To convert to std::string, as StringRef implicitly converts while 
SmallString do not. We may wish to change this, but it may introduce
ambiguity.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232622 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-18 10:17:07 +00:00
Michael Zolotukhin a8b3a0a3bf Imply linker arguments from '-fveclib' option.
Summary: As discussed in D8097, we should provide corresponding linking flags when 'fveclib' is specified.

Reviewers: hfinkel

Differential Revision: http://reviews.llvm.org/D8362

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232556 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-17 22:13:05 +00:00
Michael Zolotukhin 7ebce5ede9 Add fveclib option.
Review: http://reviews.llvm.org/D8097

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232533 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-17 20:03:11 +00:00
Renato Golin 5d49667147 [ARM] Add support for ARMV6K subtarget (Clang)
ARMv6K is another layer between ARMV6 and ARMV6T2. This is the Clang
side of the changes.

ARMV6 family LLVM implementation.

+-------------------------------------+
| ARMV6                               |
+----------------+--------------------+
| ARMV6M (thumb) | ARMV6K (arm,thumb) | <- From ARMV6K and ARMV6M processors
+----------------+--------------------+    have support for hint instructions
| ARMV6T2 (arm,thumb,thumb2)          |    (SEV/WFE/WFI/NOP/YIELD). They can
+-------------------------------------+    be either real or default to NOP.
| ARMV7 (arm,thumb,thumb2)            |    The two processors also use
+-------------------------------------+    different encoding for them.

Patch by Vinicius Tinti.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232469 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-17 11:55:43 +00:00
Nico Weber 99cd39bae6 Fix grammar in a comment, wrap to 80 columns. No behavior change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232087 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-12 19:37:10 +00:00
Hal Finkel e2b305315b [PowerPC] ABI support for the QPX vector instruction set
Support for the QPX vector instruction set, used on the IBM BG/Q supercomputer,
has recently been added to the LLVM PowerPC backend. This vector instruction
set requires some ABI modifications because the ABI on the BG/Q expects
<4 x double> vectors to be provided with 32-byte stack alignment, and to be
handled as native vector types (similar to how Altivec vectors are handled on
mainline PPC systems). I've named this ABI variant elfv1-qpx, have made this
the default ABI when QPX is supported, and have updated the ABI handling code
to provide QPX vectors with the correct stack alignment and associated
register-assignment logic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231960 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-11 19:14:15 +00:00
Nico Weber 523c80ce73 Gender-neutralize a comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231891 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-11 00:05:26 +00:00
Chandler Carruth 8cd8681110 Much like we silence warnings about -flto in many cases to facilitate
simplicity in build systems, silence '-stdlib=libc++' when linking. Even
if we're not linking C++ code per-se, we may be passing this flag so
that when we are linking C++ code we pick up the desired standard
library. While most build systems already provide separate C and C++
compile flags, many conflate link flags. Sadly, CMake is among them
causing this warning in a libc++ selfhost.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231559 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-07 10:01:29 +00:00
Hans Wennborg 4c95c7eb80 Pass -dll to link.exe when building with -shared (PR22697)
And start building a test for non-clang-cl link.exe invocations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231312 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-04 23:16:21 +00:00
Dan Albert 0a196eb464 Don't force -pie for Android.
Summary:
There is no -no-pie flag that can override this, so making it default
to being on for Android means it is no longer possible to create
non-PIE executables on Android. While current versions of Android
support (and the most recent requires) PIE, ICS and earlier versions
of Android cannot run PIE executables, so this needs to be optional.

Reviewers: srhines

Reviewed By: srhines

Subscribers: thakis, volkalexey, cfe-commits

Differential Revision: http://reviews.llvm.org/D8015

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231091 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-03 18:24:57 +00:00
Fariborz Jahanian 91398c5c47 [SDK modernizer]. Patch fixes driver's lack of
recognition of mernizer's -objcmt-migrate-property-dot-syntax
option with a new test in test/Driver. rdar://19994452


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231080 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-03 17:15:38 +00:00
Daniel Jasper eb4587857f Revert r231008 (and dependent r231019).
As Chandler responded on the initial commit, just directly setting the
triple through -Xclang option to the driver creates havoc on other
platforms. The driver test should specifically go into test/Driver and
test the cc1 commandline itself.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231063 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-03 10:02:53 +00:00
Fariborz Jahanian dc0a9b8ea1 [SDK modernizer]. Patch fixes driver's lack of
recognition of mernizer's -objcmt-migrate-property-dot-syntax
option. rdar://19994452


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231008 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02 20:43:32 +00:00
Bob Wilson a6fe515da6 Add clang support for Objective-C application extensions.
This adds the -fapplication-extension option, along with the
ios_app_extension and macosx_app_extension availability attributes.
Patch by Ted Kremenek

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230989 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02 19:01:14 +00:00
Benjamin Kramer 30dd297774 Add missing include.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230910 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-01 21:36:40 +00:00
Reid Kleckner 91a68a7abe Add -fuse-line-directive flag to control usage of #line with -E
Currently -fms-extensions controls this behavior, which doesn't make
much sense. It means we can't identify what is and isn't a system header
when compiling our own preprocessed output, because #line doesn't
represent this information.

If someone is feeding Clang's preprocessed output to another compiler,
they can use this flag.

Fixes PR20553.

Reviewers: rsmith

Differential Revision: http://reviews.llvm.org/D5217

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230587 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-26 00:17:25 +00:00
Reid Kleckner 7a2fdca13e -fms-extensions: Bump the default _MSC_VER from 1700 to 1800, aka VS2013
VS 2013 is the minimum supported version, so it's reasonable for Clang
to simulate this by default. This also simplifies the clang-cl
self-host, since we have the 18.00 version check.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230243 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 19:25:48 +00:00
Larisse Voufo e373ffa9df Move -fdefine-sized-deallocation and -fno-sized-deallocation options from driver into CC1 for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230112 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-21 01:03:48 +00:00
Simon Atanasyan 7dc6740ba8 [Mips] Support mips32r3, mips32r5, mips64r3, mips64r5 MIPS ISA names
The patch teaches the clang's driver to understand new MIPS ISA names,
pass appropriate options to the assembler, defines corresponding macros etc

http://reviews.llvm.org/D7737

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230092 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 23:37:40 +00:00
Peter Collingbourne f9d64b33eb Implement Control Flow Integrity for virtual calls.
This patch introduces the -fsanitize=cfi-vptr flag, which enables a control
flow integrity scheme that checks that virtual calls take place using a vptr of
the correct dynamic type. More details in the new docs/ControlFlowIntegrity.rst
file.

It also introduces the -fsanitize=cfi flag, which is currently a synonym for
-fsanitize=cfi-vptr, but will eventually cover all CFI checks implemented
in Clang.

Differential Revision: http://reviews.llvm.org/D7424

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230055 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 20:30:56 +00:00
Rafael Espindola acdbdefe39 Add -funique-section-names and -fno-unique-section-names options.
For now -funique-section-names is the default, so no change in default behavior.

The total .o size in a build of llvm and clang goes from 241687775 to 230649031
bytes if -fno-unique-section-names is used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230031 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 18:08:57 +00:00
Manuel Klimek 9eb2516a4d Add -fno-implicit-modules.
If this flag is set, we error out when a module build is required. This is
useful in environments where all required modules are passed via -fmodule-file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230006 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 11:44:41 +00:00
Larisse Voufo 92f642d7a4 Add -fno-sized-deallocation option for completeness of fix in r229241 in documentation in r229818.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229950 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 02:07:22 +00:00
Filipe Cabecinhas bdc1288ac8 Improve our handling of rtti/sanitize=vptr/sanitize=undefined
This patch removes the huge blob of code that is dealing with
rtti/exceptions/sanitizers and replaces it with:

A ToolChain function which, for a given set of Args, figures out if rtti
should be:
  - enabled
  - disabled implicitly
  - disabled explicitly

A change in the way SanitizerArgs figures out what sanitizers to enable
(or if it should error out, or warn);

And a check for exceptions/rtti interaction inside addExceptionArgs.

The RTTIMode algorithm is:
  - If -mkernel, -fapple-kext, or -fno-rtti are passed, rtti was disabled explicitly;
  - If -frtti was passed or we're not targetting the PS4, rtti is enabled;
  - If -fexceptions or -fcxx-exceptions was passed and we're targetting
    the PS4, rtti was enabled implicitly;
  - If we're targetting the PS4, rtti is disabled implicitly;
  - Otherwise, rtti is enabled;

Since the only flag needed to pass to -cc1 is -fno-rtti if we want to
disable it, there's no problem in saying rtti is enabled if we're
compiling C code, so we don't look at the input file type.

addExceptionArgs now looks at the RTTIMode and warns that rtti is being
enabled implicitly if targetting the PS4 and exceptions are on. It also
errors out if, targetting the PS4, -fno-rtti was passed, and exceptions
were turned on.

SanitizerArgs now errors out if rtti was disabled explicitly and the vptr
sanitizer was enabled implicitly, but just turns off vptr if rtti is
disabled but -fsanitize=undefined was passed.

Also fixed tests, removed duplicate name from addExceptionArgs comment,
and added one or two surrounding lines when running clang-format.
This changes test/Driver/fsanitize.c to make it not expect a warning when
passed -fsanitize=undefined -fno-rtti, but expect vptr to not be on.

Removed all users and definition of SanitizerArgs::sanitizesVptr().

Reviewers: samsonov

Subscribers: llvm-commits, samsonov, rsmith

Differential Revision: http://reviews.llvm.org/D7525

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229801 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-19 01:04:49 +00:00
Bradley Smith 10300321f9 [ARM] Add missing M/R class CPUs
Add some of the missing M and R class Cortex CPUs, namely:

Cortex-M0+ (called Cortex-M0plus for GCC compatibility)
Cortex-M1
SC000
SC300
Cortex-R5


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229661 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-18 10:34:48 +00:00
Larisse Voufo cb59dc9022 Rename flags and options to match current naming: from -fdef-sized-delete to -fdefine-sized-deallocation, and from DefaultSizedDelete to DefineSizedDeallocation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229597 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-18 01:04:10 +00:00
Benjamin Kramer 9b0180957d Replace snprintf with a Twine. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229264 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-14 18:19:55 +00:00
Larisse Voufo 4ecf89a2f4 Revise the implementation logic of sized deallocation: Do not automatically generate weak definitions of the sized operator delete (in terms of unsized operator delete). Instead, provide the funcitonality via a new compiler flag, -fdef-sized-delete.
The current implementation causes link-time ODR violations when the delete symbols are exported into the dynamic table.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229241 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-14 05:42:57 +00:00
David Majnemer 1fc307f60c Revert "Revert r229082 for a bit, it caused PR22577."
This reverts commit r229123.  It was a red herring, the bug was present
without r229082.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229205 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-14 01:35:12 +00:00
Nico Weber 5047124372 Revert r229082 for a bit, it caused PR22577.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229123 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-13 16:27:00 +00:00
David Majnemer a9bdd3bc26 MS ABI: Implement /volatile:ms
The /volatile:ms semantics turn volatile loads and stores into atomic
acquire and release operations.  This distinction is important because
volatile memory operations do not form a happens-before relationship
with non-atomic memory.  This means that a volatile store is not
sufficient for implementing a mutex unlock routine.

Differential Revision: http://reviews.llvm.org/D7580

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229082 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-13 07:55:47 +00:00
Bill Schmidt af10efb26d [PowerPC] Remove the --no-tls-optimize workaround from the clang driver
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228739 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-10 20:36:08 +00:00
Steven Wu 05d323a0bb -iframework option should be forwarded to linker
Summary:
-iframework option is used to specified System framework path so the
path specified should be passed to linker as -F option
rdar://problem/18234544

Reviewers: bob.wilson

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7106

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228413 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-06 18:08:29 +00:00
Bill Schmidt 48c576c877 [PowerPC] Re-disable linker optimizations for now
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228402 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-06 15:31:03 +00:00
Reid Kleckner 86837b8582 Re-land r228258 and make clang-cl's /EHs- disable -fexceptions again
After r228258, Clang started emitting C++ EH IR that LLVM wasn't ready
to deal with, even when exceptions were disabled with /EHs-. This time,
make /EHs- turn off -fexceptions while still emitting exceptional
constructs in functions using __try.  Since Sema rejects C++ exception
handling constructs before CodeGen, landingpads should only appear in
such functions as the result of a __try.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228329 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-05 18:56:03 +00:00
Bill Schmidt 789b2f7698 [PowerPC] Revert workaround for TLS linker bug
In r227480, Ulrich Weigand introduced a workaround for a linker
optimization bug that can create mis-optimized code for accesses to
general-dynamic or local-dynamic TLS variables.  The linker
optimization bug only occurred for Clang/LLVM because of some
inefficient code being generated for these TLS accesses.  I have
recently corrected LLVM to produce the efficient code sequence
expected by the linkers, so this workaround is no longer needed.
Therefore this patch reverts r227480.

I've tested that the previous bootstrap failure no longer occurs with
the workaround reverted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228253 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-05 01:12:24 +00:00
Reid Kleckner 525b519161 Driver: Stop forcing frame pointer usage on Windows
Previously, we would use a frame pointer by default on non-Linux OSs. On
Linux, any optimization flags imply -fomit-frame-pointer. XCore always
defaulted to -fomit-frame-pointer.

Now x86 Windows matches our behavior on Linux. All other ISAs supported
by Windows (ARM, x64) use xdata information, and frame pointers aren't
useful. Frame pointers are now off by default for such targets, but can
be forced via -fno-omit-frame-pointer and code using alloca().

In fact, on Win64 our frame-pointer prologue is not describable with
UNWIND_INFO. This change is a workaround to avoid using the broken FP
using prologue for most functions. This is PR22467.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228236 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-04 23:45:07 +00:00
Ben Langmuir 4301794358 Replace isalnum with isAlphanumeric per review
Thanks Dmitri!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228163 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-04 18:34:23 +00:00
Renato Golin 7fc56c94ba Teaches the Clang driver to accept Cortex-A72
A previous commit added Cortex-A72 to LLVM, this teaches Clang to
accept it as well.

Patch by Ranjeet Singh.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228141 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-04 13:31:56 +00:00
Ben Langmuir 3ccf5ebba0 Make the default module cache user-specific
Appends the username to the first component (after the temp dir) of the
module cache path.  If the username contains a character that shouldn't
go into a path (for now conservatively allow [a-zA-Z0-9_]), we fallback
to the user id.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228013 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-03 19:28:37 +00:00
Rafael Espindola 620d7d7b07 Use CLANG_LIBDIR_SUFFIX when looking for the gold plugin.
Patch by İsmail Dönmez!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227979 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-03 16:33:53 +00:00
Reid Kleckner 6153ae466b PR 17421: Implemented -save-temps={obj|cwd} option
-save-temps=cwd is equivalent to -save-temps
-save-temps=obj saves temporary file in the same directory as output

This helps to avoid clobbering of temp files in case of parallel
compilation with -save-temps of the files that have the same name
but located in different directories.

Patch by Artem Belevich

Reviewed By: rnk

Differential Revision: http://reviews.llvm.org/D7304

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227886 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-02 22:41:48 +00:00
Filipe Cabecinhas e6fe5beb8f Tweak behavior due to -fexceptions, in C++ mode, imply -fcxx-exceptions
Added test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227695 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-31 23:05:51 +00:00
Eric Christopher 50d3f296d0 Fix regression in r227409 where we were passing -fsyntax-only
in all cases.

Patch by Artem Belevich.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227591 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-30 18:22:23 +00:00
Daniel Sanders 8f3cbdeb86 [mips] Pass ABI name via -target-abi instead of target-features
Patch by Vladimir Medic

Reviewers: echristo, atanasyan, dsanders

Reviewed By: atanasyan, dsanders

Subscribers: llvm-commits, echristo, atanasyan

Differential Revision: http://reviews.llvm.org/D6091


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227583 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-30 17:35:23 +00:00
Filipe Cabecinhas 210d1346e2 Remove unneeded code
We don't really care about enabling RTTI with -fexceptions, only with
-fcxx-exceptions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227567 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-30 11:17:56 +00:00
Reid Kleckner f400660d7f clang-cl: Enable -fexceptions but not -fcxx-exceptions by default
This enables proper IRgen of SEH constructs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227528 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-30 01:04:16 +00:00
Filipe Cabecinhas d816be98bb Add some more PS4 driver settings related to rtti and exceptions.
Summary:
The PS4 defaults to -fno-rtti, and has to have rtti enabled when enabling
exceptions.

This commit makes clang add the -fno-rtti by default on the PS4, unless
-frtti was passed in.

It also diagnoses misuses for the PS4:
- Exceptions need rtti. Warn and enable rtti if no rtti flag was passed,
  error if -fno-rtti was passed.

I also added a more general warning for when -fno-rtti is the default
(currently it's only on the PS4) and the vptr sanitizer is on.

Fixed a few tests, due to different flag order when passing cc1 arguments.

Reviewers: chandlerc

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7250

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227518 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-29 23:56:43 +00:00
Ulrich Weigand c863fa3468 [PowerPC] Work around TLS linker bug
Work around a bug in GNU ld (and gold) linker versions up to 2.25
that may mis-optimize code generated by this version of clang/LLVM
to access general-dynamic or local-dynamic TLS variables.

Bug is fixed here:
https://sourceware.org/ml/binutils/2015-01/msg00318.html



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227480 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-29 19:08:51 +00:00
Eric Christopher 51d7ae2eab Ensure that -fsyntax-only with fortran 90 passes along silently
to the underlying gcc.
PR22234

Patch by Artem Belevich.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227409 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-29 00:56:17 +00:00
Joerg Sonnenberger 816d62a7d2 For the --be8 flag, check explicitly for pre-v7 / pre-v6m cores.
Those used the old Big Endian support on ARM and don't need flags.
Refactor the logic in a separate common function, which also looks at
-march. Add corresponding logic for the Linux toolchain.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227393 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-28 23:30:39 +00:00
Dan Albert 31f279a4ca [clang] Use -android environment for all compiler-rt libs.
Summary:
This was already done for the sanitizers, but it needs to be done for
the profile and builtin libs as well.

Reviewers: srhines, timmurray, eugenis, samsonov

Reviewed By: samsonov

Subscribers: compnerd, cfe-commits

Differential Revision: http://reviews.llvm.org/D7187

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227392 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-28 23:23:36 +00:00
Filipe Cabecinhas 351e556bab Fix part of r227215. PS4 code just omits leaf frame pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227219 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 18:08:32 +00:00
Filipe Cabecinhas 71fa1edf92 Added more PS4 defaults for code generation
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227215 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 17:27:37 +00:00
Joerg Sonnenberger d6bdd30501 For NetBSD/ARM-EB, link with --be8. Support for the older BE32 is
currently not planned.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227088 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-26 12:30:16 +00:00
Renato Golin b3c49e956e Allows Clang to use LLVM's fixes-x18 option
This patch allows clang to have llvm reserve the x18
platform register on AArch64. FreeBSD will use this in the kernel for
per-cpu data but has no need to reserve this register in userland so
will need this flag to reserve it.

This uses llvm r226664 to allow this register to be reserved.

Patch by Andrew Turner.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227062 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-25 23:17:48 +00:00
Sanjay Patel 836904e7cf Process the -fno-signed-zeros optimization flag (PR20870)
The driver currently accepts but ignores the -fno-signed-zeros flag. 
This patch passes the flag through and enables 'nsz' fast-math-flag 
generation in IR.

The existing OpenCL flag for the same functionality is made into an
alias here. It may be removed in a subsequent patch.

This should resolve bug 20870 ( http://llvm.org/bugs/show_bug.cgi?id=20870 );
patches for the optimizer were checked in at:
http://llvm.org/viewvc/llvm-project?view=revision&revision=225050
http://llvm.org/viewvc/llvm-project?view=revision&revision=224583

Differential Revision: http://reviews.llvm.org/D6873



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226915 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 16:40:50 +00:00
Hans Wennborg f561230eea Implement command line options for stack probe space
This code adds the -mstack-probe-size command line option and implements the /Gs
compiler switch for clang-cl.

This should fix http://llvm.org/bugs/show_bug.cgi?id=21896

Patch by Andrew H!

Differential Revision: http://reviews.llvm.org/D6685

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226601 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-20 19:45:50 +00:00
Steven Wu 49fad97bc9 Adding option -fno-inline-asm to disallow inline asm
Summary:
This patch add a new option to dis-allow all inline asm.
Any GCC style inline asm will be reported as an error.

Reviewers: rnk, echristo

Reviewed By: rnk, echristo

Subscribers: bob.wilson, rnk, echristo, rsmith, cfe-commits

Differential Revision: http://reviews.llvm.org/D6870

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226340 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 23:05:28 +00:00
JF Bastien 21f4ef7237 Revert "Insert random noops to increase security against ROP attacks (clang)"
This reverts commit:
http://reviews.llvm.org/D3393

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225947 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 05:24:11 +00:00
JF Bastien b62cce9cec Insert random noops to increase security against ROP attacks (clang)
A pass that adds random noops to X86 binaries to introduce diversity with the goal of increasing security against most return-oriented programming attacks.

Command line options:
  -noop-insertion // Enable noop insertion.
  -noop-insertion-percentage=X // X% of assembly instructions will have a noop prepended (default: 50%, requires -noop-insertion)
  -max-noops-per-instruction=X // Randomly generate X noops per instruction. ie. roll the dice X times with probability set above (default: 1). This doesn't guarantee X noop instructions.

In addition, the following 'quick switch' in clang enables basic diversity using default settings (currently: noop insertion and schedule randomization; it is intended to be extended in the future).
  -fdiversify

This is the clang part of the patch.
llvm part: D3392

http://reviews.llvm.org/D3393
Patch by Stephen Crane (@rinon)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225910 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:07:51 +00:00
Saleem Abdulrasool 1928b9aa41 Driver: begin threading frontend support for SymbolRewriter
Allow blessed access to the symbol rewriter from the driver. Although the
symbol rewriter could be invoked through tools like opt and llc, it would not
accessible from the frontend. This allows us to read the rewrite map files in
the frontend rather than the backend and enable symbol rewriting for actually
performing the symbol interpositioning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225504 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 05:10:20 +00:00
Tom Stellard e60e78c886 R600: Handle amdgcn triple
For now there is no difference between amdgcn and r600.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225294 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06 20:34:47 +00:00
Brad Smith 94b0e1bbde Set the default ISA for OpenBSD/mips64 to MIPS III.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225241 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06 02:53:17 +00:00
Rafael Espindola d50c05658f Fix formatting. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225168 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-05 13:44:59 +00:00
Rafael Espindola a7a652900d Really don't warn about -flto/fno-lto :-(
This should fix the last bots.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225100 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-03 00:06:04 +00:00
Rafael Espindola a8492cf5ba Also avoid warning on -flto/-fno-lto on linux.
On OS X a .s file is preprocessed, it is not on linux, which is why the warning was still
showing up on linux but not OS X.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225095 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-02 23:23:52 +00:00
Rafael Espindola 14880bfff3 Don't warn on unused -fno-lto.
It is somewhat common for CFLAGS to be used with .s files. We were
already ignoring -flto. This patch just does the same for -fno-lto.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225093 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-02 22:56:15 +00:00
Saleem Abdulrasool 34bc9da0c8 Driver: honour the clang-cl behaviour on ARM as well
Unfortunately, MSVC does not indicate to the driver what target is being used.
This means that we cannot correctly select the target architecture for the
clang_rt component.  This breaks down when targeting windows with the clang
driver as opposed to the clang-cl driver.  This should fix the native ARM
buildbot tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225089 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-02 21:47:33 +00:00
Saleem Abdulrasool 3d124dd14b Driver: reuse getCompilerRT in place of addSanitizerRTWindows
The logic for addSanitizerRTWindows was performing the same logical operation as
getCompilerRT, which was previously fully generalised for Linux and Windows.
This avoids having a duplication of the logic for building up the name of a
clang_rt component.  This change does move the current limitation for Windows
into getArchNameForCompilerRTLib, where it is assumed that the architecture for
Windows is always i386.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225087 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-02 20:00:55 +00:00
Saleem Abdulrasool a4645df6fd Driver: unify compiler-rt component selection
Unify the component handling for compiler-rt.  The components are regularly
named, built up from:

  ${LIBRARY_PREFIX}clang_rt.${component}-${arch}[-${environment}]${LIBRARY_SUFFIX}

Unify the handling for all the various components, into a single path to link
against the various components in a number of places.  This reduces duplication
of the clang_rt library name construction logic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225013 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-30 22:52:08 +00:00
Saleem Abdulrasool c179560fcd Driver: whitespace
Fixup some whitespace/style issues.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225012 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-30 22:52:06 +00:00
Saleem Abdulrasool c6a3d63ce3 Driver: use the canonical library prefix on Windows
Unlike Unices, Windows does not use a library prefix.  Use the traditional
naming scheme even for Windows itanium environments.  This makes the builtins
behave more like the sanitisers as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224996 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-30 18:55:37 +00:00
Saleem Abdulrasool 43e0fd173c Driver: unify addClangRT{Linux,Windows}
The differences are pretty superficial:
- .lib vs .a extensions
- whether or not to link (potentially) incorrectly against libgcc_s

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224975 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-30 02:10:36 +00:00
Nico Weber f370b84036 Add driver flags -ftrigraphs, -fno-trigraphs.
-trigraphs is now an alias for -ftrigraphs.  -fno-trigraphs makes it possible
to explicitly disable trigraphs, which couldn't be done before.

  clang -std=c++11 -fno-trigraphs

now builds without GNU extensions, but with trigraphs disabled.  Previously,
trigraphs were only disabled in GNU modes or with -std=c++1z.

Make the new -f flags the cc1 interface too.  This requires changing -trigraphs
to -ftrigraphs in a few cc1 tests.

Related to PR21974.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224790 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-23 22:32:37 +00:00
Bob Wilson 8d7e45e9e3 Reapply "Change -save-temps to emit unoptimized bitcode files."
This reapplies r224503 along with a fix for compiling Fortran by having the
clang driver invoke gcc (see r224546, where it was reverted). I have added
a testcase for that as well.

Original commit message:
It is often convenient to use -save-temps to collect the intermediate
results of a compilation, e.g., when triaging a bug report. Besides the
temporary files for preprocessed source and assembly code, this adds the
unoptimized bitcode files as well.

This adds a new BackendJobAction, which is mostly mechanical, to run after
the CompileJobAction. When not using -save-temps, the BackendJobAction is
combined into one job with the CompileJobAction, similar to the way the
integrated assembler is handled. I've implemented this entirely as a
driver change, so under the hood, it is just using -disable-llvm-optzns
to get the unoptimized bitcode.

Based in part on a patch by Steven Wu.
rdar://problem/18909437

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224688 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-21 07:00:00 +00:00
Saleem Abdulrasool 549d5bb6f2 Driver: hoist an assertion
Remove an unnecessary conditional, hoisting the assertion.  Minor style
tweaks/reflowing.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224654 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-19 23:56:31 +00:00
Saleem Abdulrasool f41c4490a1 Driver: refactor a local variable
Pull out a getToolChain() into a local variable to share the call across to all
the uses.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224653 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-19 23:56:28 +00:00
Reid Kleckner bf1b608af4 Revert "Change -save-temps to emit unoptimized bitcode files."
This reverts commit r224503.

It broke compilation of fortran through the Clang driver. Previously
`clang -c t.f` would invoke `gcc t.f` and `clang -cc1as`, but now it
tries to call `clang -cc1 t.f` which fails for obvious reasons.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224546 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-18 23:07:04 +00:00
Richard Barton a15a93d4e0 Correction to -mfu=neon-vfpv4 to pass the correct backend feature name
Change-Id: I4dbfe1d97670fc4e626368ef1f91fc008778dfca

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224523 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-18 16:31:18 +00:00
Bob Wilson 23cf9d557e Change -save-temps to emit unoptimized bitcode files.
It is often convenient to use -save-temps to collect the intermediate
results of a compilation, e.g., when triaging a bug report. Besides the
temporary files for preprocessed source and assembly code, this adds the
unoptimized bitcode files as well.

This adds a new BackendJobAction, which is mostly mechanical, to run after
the CompileJobAction. When not using -save-temps, the BackendJobAction is
combined into one job with the CompileJobAction, similar to the way the
integrated assembler is handled. I've implemented this entirely as a
driver change, so under the hood, it is just using -disable-llvm-optzns
to get the unoptimized bitcode.

Based in part on a patch by Steven Wu.
rdar://problem/18909437

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224503 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-18 06:08:26 +00:00
Eric Christopher f9795ef075 Reinstate aapcs as the default arm abi.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224490 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-18 02:08:51 +00:00
Nick Lewycky fbb501f488 Add a new flag, -fspell-checking-limit=<number> to control how many times we'll do spell checking. Note that spell checking will change the produced AST, so we don't automatically change this value when someone sets -ferror-limit=. With this, merge test typo-correction-pt2.cpp into typo-correction.cpp.
Remove Sema::UnqualifiedTyposCorrected, a cache of corrected typos. It would only cache typo corrections that didn't provide ValidateCandidate of which there were few left, and it had a bug when we had the same identifier spelled wrong twice. See the last two tests in typo-correction.cpp for cases this fires.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224375 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16 21:39:02 +00:00
Eric Christopher f1759e4d2a Add a FIXME for unifying ARM target abi handling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223977 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-10 22:58:34 +00:00
Eric Christopher b11ce4c259 Revert the default changing behavior part of r216662 until we
can change the backend to be the same default. Leave the
modified/new testcases with the exception of the default behavior
since it increases our testing footprint.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223976 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-10 22:58:32 +00:00
David Majnemer 0a2e4f2c12 Revert "Driver: Objective-C should respect -fno-exceptions"
This reverts commit r223455.  It's been succesfully argued that
-fexceptions (at the driver level) is a misnomer and has little to do
with -fobjc-exceptions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223723 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-09 00:12:30 +00:00
David Majnemer 64a12add36 Driver: Objective-C should respect -fno-exceptions
Clang attempted to replicate a GCC bug: -fobjc-exceptions forces
-fexceptions to be enabled.  However, this has unintended effects and
other awkard side effects that Clang doesn't "correctly" ape (e.g. it's
impossible to turn off C++ exceptions in ObjC++ mode).

Instead, -f[no]objc-exceptions and -f[no]cxx-exceptions now have an
identical relationship with -f[no]exceptions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223455 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 08:56:55 +00:00
David Majnemer ee0543ee7a Driver: Cleanup -fexceptions behavior
No functionality change is intended, just a cleanup of the logic clang
uses to determine what -fexceptions/-fno-exceptions ends up doing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223453 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 08:11:58 +00:00