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.
David Majnemer [Mon, 27 Jul 2015 07:32:11 +0000 (07:32 +0000)]
[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".
Rename highly-confusing isWhitespace that returns false on \n to
isWhitespaceExceptNL. If that's wasn't bad enough, we have an identically
named function in Basic/CharInfo.h.
While at it, remove unnecessary includes, .str() calls and #ifdef.
Richard Smith [Mon, 27 Jul 2015 05:40:23 +0000 (05:40 +0000)]
[modules] Add an assert for redeclarations that we never added to their redecl
chain and fix the cases where it fires.
* Handle the __va_list_tag as a predefined decl. Previously we failed to merge
sometimes it because it's not visible to name lookup. (In passing, remove
redundant __va_list_tag typedefs that we were creating for some ABIs. These
didn't affect the mangling or representation of the type.)
* For Decls derived from Redeclarable that are not in fact redeclarable
(implicit params, function params, ObjC type parameters), remove them from
the list of expected redeclarable decls.
David Majnemer [Sun, 26 Jul 2015 09:02:26 +0000 (09:02 +0000)]
[MS Extensions] Remove support for the i128 integer literal suffix
There is currently no support in MSVC for using i128 as an integer
literal suffix. In fact, there appears to be no evidence that they have
ever supported this feature in any of their compilers. This was an over
generalization of their actual feature and is a nasty source of bugs.
Why is it a source of bugs? Because most code in clang expects that
evaluation of an integer constant expression won't give them something
that 'long long' can't represent. Instead of providing a meaningful
feature, i128 gives us cute ways of exploding the compiler.
This test failed on ninja-x64-msvc-RA-centos6.
We could probably get this and the previous three disabled in r243237
working on these builders if MSYS was updated to current MSYS2.
Benjamin Kramer [Sat, 25 Jul 2015 15:07:25 +0000 (15:07 +0000)]
[AST] Turn the callbacks of lookupInBases and forallBases into a function_ref
This lets us pass functors (and lambdas) without void * tricks. On the
downside we can't pass CXXRecordDecl's Find* members (which are now type
safe) to lookupInBases directly, but a lambda trampoline is a small
price to pay. No functionality change intended.
David Majnemer [Sat, 25 Jul 2015 05:57:24 +0000 (05:57 +0000)]
[CodeGen] Don't UBSan-ize the argument to __builtin_frame_address
__builtin_frame_address requires its argument to be a constant
expression which already implies that it cannot have undefined behavior.
However, we used EmitScalarExpr to emit the argument causing UBSan to
try to check for overflow.
Instead, use the constant expression emission system.
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.
DI: Make getOrCreateLimitedType() return DICompositeType, NFC
Change `getOrCreateLimitedType()` to return a `DICompositeType` and
remove the casts from its callers. Inside, I've strengthened a `cast`
from `DICompositeTypeBase`, but the casts in the callers already prove
that this is safe. There should be no functionality change here.
Select the highest version of the mingw toolchain found using Generic_GCC::GCCVersion
similar to the way Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple works.
These changes are for Android x86_64 targets to be compatible with current Android g++.
https://llvm.org/bugs/show_bug.cgi?id=23897
Use 'g' and 'Cg' for "long double" and "long double _Complex" mangled type names.
[code-completion] Strip outer nullability annotations when completing method implementations.
The outer nullability is transferred from the declaration to the implementation so including them is redundant.
The inner ones are not transferred so they are kept to match the exact types. When we transfer the inner ones as well
adding them in the implementation will become redundant and we should strip those as well.
Correcting some comments. (1) the function is named throughUsingDecl() and not throughUsingDeclaration(). (2) Testing shows that this does work for shadowed variables as well as shadowed functions. I could not find an example where this matcher was failing. NFC.
Add extensive tests for the mingw toolchain and remove trailing slash from Arch.
Address Richard Smith comments: remove the trailing seperator from the Arch
variable, implement six mingw_* trees under tools/clangtest/Driver/Inputs
and merge linux and Windows tests into a universal test that uses these trees.
David Majnemer [Fri, 24 Jul 2015 05:54:19 +0000 (05:54 +0000)]
[AST] Perform additional canonicalization for DependentSizedArrayType
We treated DependentSizedArrayTypes with the same element type but
differing size expressions as equivalently canonical. This would lead
to bizarre behavior during template instantiation.
Piotr Padlewski [Fri, 24 Jul 2015 04:04:49 +0000 (04:04 +0000)]
Generating available_externally vtables for outline virtual functions
Generating available_externally vtables for optimizations purposes.
Unfortunatelly ItaniumABI doesn't guarantee that we will be able to
refer to virtual inline method by name.
But when we don't have any inline virtual methods, and key function is
not defined in this TU, we can generate that there will be vtable and
mark it as available_externally.
This is patch will help devirtualize better.
Differential Revision: http://reviews.llvm.org/D11441
Steven Wu [Fri, 24 Jul 2015 02:12:43 +0000 (02:12 +0000)]
Fix the cc1as crash when it outputs assembly
In clang cc1as_main, when the output file type is “asm”, AsmStreamer
owns a formatted_raw_ostream which has a reference to FDOS
(raw_ostream), so AsmStreamer must be closed before FDOS is closed.
John McCall [Thu, 23 Jul 2015 23:54:07 +0000 (23:54 +0000)]
Fix the equal-vector-size rule for reinterpret_casts in C++
to consider the storage size of the vector instead of its
sizeof. In other words, ban <3 x int> to <4 x int> casts,
which produced invalid IR anyway.
Also, attempt to be a little more rigorous, or at least
explicit, about when enums are allowed in these casts.
InstrProf: Don't extend coverage regions into the catch keyword
The catch keyword isn't really part of a region, so it's fairly
meaningless to extend into it. This was usually harmless, but it could
crash when catch blocks involved macros in strange ways.
Sema: Split out helper from checkForFunctionCall(), NFC
Split out `hasRecursiveCallInPath()` from `checkForFunctionCall()` to
flatten nesting and clarify the code. This also simplifies a follow-up
patch that refactors the other logic in `checkForFunctionCall()`.
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.
David Majnemer [Wed, 22 Jul 2015 23:46:18 +0000 (23:46 +0000)]
[MS Compat] Allow _Atomic(Type) and 'struct _Atomic' to coexist
MSVC 2013 ships, as part of its STL implementation, a class named
'_Atomic'. This is unfortunate because this keyword is in conflict with
the C11 keyword with the same name. Our solution was to disable this
keyword when targeting MSVC 2013 and reenable it for 2015.
However, this makes it impossible for clang's headers to make use of
_Atomic. This is problematic in the case of libc++ as it makes heavy
use of this keyword.
Let the keywordness of _Atomic float under certain circumstances:
the body of a class named _Atomic, or a class with a base specifier
named _Atomic, will not have the keyword variant of _Atomic for the
duration of the class body. This is sufficient to allow us to correctly
handle _Atomic in the STL while permitting us to use _Atomic as a
keyword everywhere else.
Richard Smith [Wed, 22 Jul 2015 02:08:40 +0000 (02:08 +0000)]
[modules] Stop performing PCM lookups for all identifiers when building with C++ modules. Instead, serialize a list of interesting identifiers and mark those ones out of date on module import. Avoiding the identifier lookups here gives a 20-30% speedup in builds with large numbers of modules. No functionality change intended.
Richard Smith [Wed, 22 Jul 2015 01:28:05 +0000 (01:28 +0000)]
[modules] Change module manager visitation order to be a bit more stable when
more modules are added: visit modules depth-first rather than breadth-first.
The visitation is still (approximately) oldest-to-newest, and still guarantees
that a module is visited before anything it imports, so modules that are
imported by others sometimes need to jump to a later position in the visitation
order when more modules are loaded, but independent module trees don't
interfere with each other any more.
Davide Italiano [Wed, 22 Jul 2015 00:30:58 +0000 (00:30 +0000)]
[Sema] Diagnose use of declaration correctly.
Before we skipped that for virtual functions not fully qualified (r81507).
This commit basically reverts this to the older behaviour, which seems
more consistent. We now also correctly consider ill-formed calls to deleted
member functions, which were silently passed before in some cases.
The review contains the whole discussion.
Richard Smith [Tue, 21 Jul 2015 23:54:07 +0000 (23:54 +0000)]
[modules] In C++, stop serializing and deserializing a list of declarations in
the identifier table. This is redundant, since the TU-scope lookups are also
serialized as part of the TU DeclContext, and wasteful in a number of ways. We
still emit the decls for PCH / preamble builds, since for those we want
identical results, not merely semantically equivalent ones.
Richard Smith [Tue, 21 Jul 2015 18:07:47 +0000 (18:07 +0000)]
[modules] Produce an error if -cc1 wants to implicitly build a module and no
module cache has been provided, rather than creating one in the current
directory.
Fix mingw toolchain to honor sysroot on Linux and add tests.
It should now support three mingw distributions running on Windows
and three Linux distributions. The include directories for each are
listed in the comments.