[PowerPC] Support ELFv1/ELFv2 ABI selection via -mabi= option
While Clang now supports both ELFv1 and ELFv2 ABIs, their use is currently
hard-coded via the target triple: powerpc64-linux is always ELFv1, while
powerpc64le-linux is always ELFv2.
These are of course the most common scenarios, but in principle it is
possible to support the ELFv2 ABI on big-endian or the ELFv1 ABI on
little-endian systems (and GCC does support that), and there are some
special use cases for that (e.g. certain Linux kernel versions could
only be built using ELFv1 on LE).
This patch implements the Clang side of supporting this, based on the
LLVM commit 214072. The command line options -mabi=elfv1 or -mabi=elfv2
select the desired ABI if present. (If not, Clang uses the same default
rules as now.)
Specifically, the patch implements the following changes based on the
presence of the -mabi= option:
In the driver:
- Pass the appropiate -target-abi flag to the back-end
- Select the correct dynamic loader version (/lib64/ld64.so.[12])
In the preprocessor:
- Define _CALL_ELF to the appropriate value (1 or 2)
In the compiler back-end:
- Select the correct ABI in TargetInfo.cpp
- Select the desired ABI for LLVM via feature (elfv1/elfv2)
Richard Smith [Sun, 27 Jul 2014 05:12:49 +0000 (05:12 +0000)]
When looking for temporary dtors while building the CFG, do not walk into
lambda expressions (other than their capture initializers) nor blocks. Do walk
into default argument expressions and default initializer expressions.
These bugs were causing us to produce broken CFGs whenever a lambda expression
was used to initialize a libstdc++ std::function object!
Objective-C. Issue more warning diagnostic when certain
properties are not synthesized in property auto-synthesis,
as it can potentiall lead to runtime errors.
rdar://17774815
Richard Smith [Sat, 26 Jul 2014 06:37:51 +0000 (06:37 +0000)]
[modules] Improve abbreviations for C++:
* Add abbreviation for CXXMethodDecl and for FunctionProtoType. These come up
a *lot* in C++ modules.
* Allow typedef declarations to use the abbreviation if they're class members,
or if they're used.
In passing, add more record name records for Clang AST node kinds.
The downside is that we had already used up our allotment of 12 abbreviations,
so this pushes us to an extra bit on each record to support the extra abbrev
kinds, which increases file size by ~1%. This patch *barely* pays for that
through the other improvements, but we've got room for another 18 abbrevs,
so we should be able to make it much more profitable with future changes.
David Majnemer [Sat, 26 Jul 2014 05:41:31 +0000 (05:41 +0000)]
Parse: Don't crash on trailing whitespace before EOF
Parser::ParseDeclarationSpecifiers eagerly updates the source range of
the DeclSpec with the current token position. However, it might not
consume any more tokens.
Fix this by only setting the start of the range, not the end. This way
the SourceRange will be invalid if we don't consume any more tokens.
Jordan Rose [Sat, 26 Jul 2014 01:22:02 +0000 (01:22 +0000)]
Add a missing close quote in "while building module 'Foo:" diagnostic.
This isn't a real diagnostic kind, only a location note, and this form isn't even
used if the SourceManager can provide a valid presumed location. But still.
MS ABI: Ensure 'this' is first for byval+sret methods
Previously we were building up the inalloca struct in the usual pattern
of return type followed by arguments. However, on Windows, 'this'
always precedes the 'sret' parameter, so we need to insert it into the
struct first as a special case.
MS ABI: Don't push destructor cleanups for aggregate parameters in thunks
The target method of the thunk will perform the cleanup. This can't be
tested in 32-bit x86 yet because passing something by value would create
an inalloca, and we refuse to generate broken code for that.
Simon Atanasyan [Fri, 25 Jul 2014 11:20:21 +0000 (11:20 +0000)]
[Driver][Mips] Remove "fp64" directories from the mips-mti-linux-gnu toolchain
directories description. Released version of this toolchain has not separate
libraries for -mfp64 command line option.
James Molloy [Fri, 25 Jul 2014 10:19:47 +0000 (10:19 +0000)]
Revert part of r206963
Specifically the part where we removed a warning to be compatible with GCC, which has been widely regarded as a bad idea.
I'm not quite happy with how obtuse this warning is, especially in the fairly common case of a 32-bit integer literal, so I've got another patch awaiting review that adds a fixit to reduce confusion.
Richard Smith [Fri, 25 Jul 2014 04:40:03 +0000 (04:40 +0000)]
[modules] Substantially improve handling of #undef:
* Track override set across module load and save
* Track originating module to allow proper re-export of #undef
* Make override set properly transitive when it picks up a #undef
This fixes nearly all of the remaining macro issues with self-host.
Summary:
This patch extends the __asm parser to make it keep parsing input tokens
as inline assembly if a single-line __asm line is followed by another line
starting with __asm too. It also makes sure that we correctly keep
matching braces in such situations by separating the notions of how many
braces we are matching and whether we are in single-line asm block mode.
Richard Smith [Fri, 25 Jul 2014 01:12:44 +0000 (01:12 +0000)]
PR20445: Properly transform the initializer in a CXXNewExpr rather than running
it through the normal TreeTransform logic for Exprs (which will strip off
implicit parts of the initialization and never re-create them).
Richard Trieu [Fri, 25 Jul 2014 00:24:02 +0000 (00:24 +0000)]
Pass the PrintingPolicy when converting types to strings in template type
diffing. This removes extra "struct"/"class" in the type names and gives
"bool" instead of "_Bool" for booleans.
Richard Smith [Thu, 24 Jul 2014 02:27:39 +0000 (02:27 +0000)]
Take the canonical type when forming a canonical template argument with
'nullptr' value. Fixes profiling of such template arguments to always give the
same value.
Richard Smith [Thu, 24 Jul 2014 01:13:23 +0000 (01:13 +0000)]
Remove unused Prev pointer from MacroInfo chain.
Remove pointless MICache: it only ever contained up to 1 object, and was only
non-empty when recovering from an error. There's no performance or memory win
from maintaining this cache.
Richard Smith [Wed, 23 Jul 2014 23:50:25 +0000 (23:50 +0000)]
Replace r213816's fix with a different one. It's not meaningful to call
isOnePastTheEnd on an invalid designator, so assert and push the check into the
one caller that wasn't already checking.
Add a missing Invalid check to SubobjectDesignator::isOnePastEnd()
The class seems to have an invariant that Entries is non-empty if
Invalid is false. It appears this method was previously private, and
all internal uses checked Invalid. Now there is an external caller, so
check Invalid to avoid array OOB underflow.
This flag specifies that we are building an implementation file of the
module <name>, preventing importing <name> as a module. This does not
consider this to be the 'current module' for the purposes of doing
modular checks like decluse or non-modular-include warnings, unlike
-fmodule-name.
This is needed as a stopgap until:
1) we can resolve relative includes to a VFS-mapped module (or can
safely import a header textually and as part of a module)
and ideally
2) we can safely do incremental rebuilding when implementation files
import submodules.
Daniel Jasper [Wed, 23 Jul 2014 13:17:47 +0000 (13:17 +0000)]
Prevent assert in ASTMatchFinder.
If nodes without memoization data (e.g. TypeLocs) are bound to specific
names, that effectively prevents memoization as those elements cannot be
compared effectively. If it is tried anyway, this can lead to an assert
as demonstrated in the new test.
In the long term, the better solution will be to enable DynTypedNodes
without memoization data. For now, simply skip memoization instead.
Tim Northover [Wed, 23 Jul 2014 12:57:31 +0000 (12:57 +0000)]
AArch64: use aarch64_be instead of arm64_be in all tests.
arm64_be doesn't really exist; it was useful for testing while AArch64 and
ARM64 were separate, but now the only real way to refer to the system is
aarch64_be.
Tim Northover [Wed, 23 Jul 2014 12:32:58 +0000 (12:32 +0000)]
AArch64: update Clang for merged arm64/aarch64 triples.
The main subtlety here is that the Darwin tools still need to be given "-arch
arm64" rather than "-arch aarch64". Fortunately this already goes via a custom
function to handle weird edge-cases in other architectures, and it tested.
I removed a few arm64_be tests because that really isn't an interesting thing
to worry about. No-one using big-endian is also referring to the target as
arm64 (at least as far as toolchains go). Mostly they date from when arm64 was
a separate target and we *did* need a parallel name simply to test it at all.
Now aarch64_be is sufficient.
Benjamin Kramer [Wed, 23 Jul 2014 11:41:44 +0000 (11:41 +0000)]
ASTMatchers: Bound node results are always const, make selectFirst's template argument implicitly const.
This avoids adding const to every user of selectFirst and also allows it to
match TypeLocs which BoundNodes doesn't use magic const removal specializations
for. No functionality change.
Improve diagnostic on default-initializing const variables (PR20208).
This tweaks the diagnostic wording slighly, and adds a fixit on a note.
An alternative would be to add the fixit directly on the diagnostic, see
the review thread linked to from the bug for a few notes on that approach.
Richard Smith [Wed, 23 Jul 2014 03:17:06 +0000 (03:17 +0000)]
When pretty-printing a declaration of a pack, put the ellipsis before the name
being declared, not at the end. When pretty-printing a non-type template
parameter, put the name of the parameter in the middle of the type, not at the
end.
Summary:
If during constructing a standard conversion sequence, we resolve an
overload, we need to adjust the from type in the SCS according to the
resolved operator.
I found this bug when debugging PR20218. This doesn't seem to be
observable, so there is no good way of testing it.