[objcmt] When emitting a remap file, use a json format with the edit entries, instead of applying the changes
to a temp file directly.
This allows to combine the edits when they can be different based on whether you saw
the implementation or not, e.g. with the designated initializer migration.
[objcmt] When whitelisting the headers we want to modify, allow changing the
the ObjC implementation declarations, just don't change implementations for
classes that are not in the whitelisted headers.
For example, if we change a method to return 'instancetype' we should also
update the method definition in the implementation.
Chad Rosier [Wed, 11 Dec 2013 21:03:54 +0000 (21:03 +0000)]
[AArch64] Refactor the NEON scalar floating-point reciprocal step and
floating-point reciprocal square root step LLVM AArch64 intrinsics to
use f32/f64 types, rather than their vector equivalents.
Chad Rosier [Wed, 11 Dec 2013 21:03:52 +0000 (21:03 +0000)]
[AArch64] Refactor the NEON scalar floating-point reciprocal estimate, floating-
point reciprocal exponent, and floating-point reciprocal square root estimate
LLVM AArch64 intrinsics to use f32/f64 types, rather than their vector
equivalents.
Reid Kleckner [Wed, 11 Dec 2013 19:21:27 +0000 (19:21 +0000)]
[ms-cxxabi] Fix linkage of dtor thunks for anonymous classes
We were mistakengly giving linkonce_odr linkage instead of internal
linkage to the deleting and complete destructor thunks for classes in
anonymous namespaces.
Hans Wennborg [Wed, 11 Dec 2013 17:42:11 +0000 (17:42 +0000)]
Better diagnostic for static override when methods are thiscall by default
Methods are thiscall by default in the MS ABI, and also in MinGW targetting GCC 4.7 or later.
This changes the diagnostic from the technically correct but hard to understand:
virtual function 'foo' has different calling convention attributes ('void ()') than the function it overrides (which has calling convention 'void () __attribute__((thiscall))')
to the more intuitive and also correct:
'static' member function 'foo' overrides a virtual function
We already have a test for this. Let's just run it in both ABI modes.
David Tweed [Wed, 11 Dec 2013 13:39:46 +0000 (13:39 +0000)]
Add front-end infrastructure now address space casts are in LLVM IR.
With the introduction of explicit address space casts into LLVM, there's
a need to provide a new cast kind the front-end can create for C/OpenCL/CUDA
and code to produce address space casts from those kinds when appropriate.
Daniel Jasper [Wed, 11 Dec 2013 12:13:00 +0000 (12:13 +0000)]
Modules: Let -fmodules-decluse ignore headers that aren't in a module
Includes might always pull in arbitrary header or data files outside of
modules. Among others, this includes builtin includes, which do not have
a module (story) yet.
Also cleanup implementation of ModuleMap::findModuleForHeader() to be
non-recursive.
Tim Northover [Wed, 11 Dec 2013 12:01:21 +0000 (12:01 +0000)]
Only build ARM-specific runtimes if ARM is enabled
The soft-float variants of (embedded) libclang_rt only make sense for ARM, so
there's no point in trying to build them if the compiler is only capable of
targeting x86.
Renato Golin [Wed, 11 Dec 2013 09:35:10 +0000 (09:35 +0000)]
Turning IAS on by default on ARM/Thumb
This is an experimental feature, where -integrated-as will be
on by default on ARM/Thumb. We aim to detect the missing features
so that the next release is stable.
Richard Smith [Wed, 11 Dec 2013 01:40:16 +0000 (01:40 +0000)]
When performing an array new of a multidimensional array with an initializer
list, each element of the initializer list may provide more than one of the
base elements of the array. Be sure to initialize the right type and bump the
array pointer by the right amount.
Chad Rosier [Tue, 10 Dec 2013 21:34:21 +0000 (21:34 +0000)]
[AArch64] Refactor the NEON signed/unsigned floating-point convert to fixed-point
LLVM AArch64 intrinsics to use f32/f64, rather than their vector equivalents.
Justin Bogner [Tue, 10 Dec 2013 21:29:48 +0000 (21:29 +0000)]
Parse: Avoid crashing on unterminated top-level asm strings
When parsing invalid top-level asm statements, we were ignoring the
return code of the SkipUntil we used for recovery. This led to crashes
when we hit the end of file and tried to continue parsing anyway.
This fixes the crash and adds a couple of tests for parsing related
problems.
Ted Kremenek [Tue, 10 Dec 2013 19:43:48 +0000 (19:43 +0000)]
Rename attribute 'objc_suppress_protocol_methods' to 'objc_protocol_requires_explicit_implementation'.
That's a mouthful, and not necessarily the final name. This also
reflects a semantic change where this attribute is now on the
protocol itself instead of a class. This attribute will require
that a protocol, when adopted by a class, is explicitly implemented
by the class itself (instead of walking the super class chain).
Note that this attribute is not "done". This should be considered
a WIP.
David Peixotto [Tue, 10 Dec 2013 18:49:55 +0000 (18:49 +0000)]
Make the -via-file-asm an InternalDebugOpt
We do not need to expose this flag to the user. This commit makes
the flag an interal debug option that will only display its help
when printing with --help-hidden.
Jordan Rose [Tue, 10 Dec 2013 18:18:06 +0000 (18:18 +0000)]
[analyzer] Extend IdenticalExprChecker to check ternary operator results.
Warn if both result expressions of a ternary operator (? :) are the same.
Because only one of them will be executed, this warning will fire even if
the expressions have side effects.
Chad Rosier [Tue, 10 Dec 2013 16:11:55 +0000 (16:11 +0000)]
[AArch64] Refactor the Neon vector/scalar floating-point convert intrinsics so
that they use float/double rather than the vector equivalents when appropriate.
Allow predefined styles to define different options for different languages.
Summary:
Allow predefined styles to define different options for different
languages so that one can run:
clang-format -style=google file1.cpp file2.js
or use a single .clang-format file with "BasedOnStyle: Google" for both c++ and
JS files.
Added Google style for JavaScript with "BreakBeforeTernaryOperators" set to
false.
Support GNU style rule to put a space before opening parenthesis.
Summary:
The rule from the GNU style states:
"We find it easier to read a program when it has spaces before the open-parentheses and after the commas."
This patch makes clang-format adds an option to put spaces before almost all open parentheses, except the cases, where different behavior is dictated by the style rules or language syntax:
* preprocessor:
** function-like macro definitions can't have a space between the macro name and the parenthesis;
** `#if defined(...)` can have a space, but it seems, that it's more frequently used without a space in GCC, for example;
* never add spaces after unary operators;
* adding spaces between two opening parentheses is controlled with the `SpacesInParentheses` option;
* never add spaces between `[` and `(` (there's no option yet).
Richard Smith [Tue, 10 Dec 2013 08:25:00 +0000 (08:25 +0000)]
Implement DR1460: fix handling of default initializers in unions; don't allow
more than one such initializer in a union, make mem-initializers override
default initializers for other union members, handle anonymous unions with
anonymous struct members better. Fix a couple of semi-related bugs exposed by
the tests for same.
Warren Hunt [Tue, 10 Dec 2013 01:44:39 +0000 (01:44 +0000)]
[ms-abi] 64-bit fixes for r196549
In order to address latent bugs that were easier to expose in 64-bit
mode, we move the application of __declspec(align) to before the layout
of vbases rather than after.
Output destructors and constructors in a more natural order.
With this patch we output the in the order
C2
C1
D2
D1
D0
Which means that a destructor or constructor that call another is output after
the callee. This is a bit easier to read IHMO and a tiny bit more efficient
as we don't put a decl in DeferredDeclsToEmit.
Daniel Jasper [Mon, 9 Dec 2013 14:40:19 +0000 (14:40 +0000)]
clang-format: Be more conservative about braced list column layout.
Specifically disable it for nested braced lists as it commonly can look
really weird. Eventually, we'll want to become smarter and format some of
the nested lists better.
Alp Toker [Mon, 9 Dec 2013 12:41:02 +0000 (12:41 +0000)]
Make the -Wkeyword-compat diag message more accurate
Changed from:
keyword '__is_empty' will be treated as an identifier for the remainder of the translation unit
To:
keyword '__is_empty' will be made available as an identifier for the remainder of the translation unit
This is a more accurate description of clang's keyword compatibility feature,
given that some of the keywords are turned into context-sensitive keywords
(e.g. REVERTIBLE_TYPE_TRAIT) rather than being fully disabled.
David Majnemer [Mon, 9 Dec 2013 10:44:32 +0000 (10:44 +0000)]
[-cxx-abi microsoft] Mangle large integral constants correctly
Testing has revealed that large integral constants (i.e. > INT64_MAX)
are always mangled as-if they are negative, even in places where it
would not make sense for them to be negative (like non-type template
parameters of type unsigned long long).
To address this, we change the way we model number mangling: always
mangle as-if our number is an int64_t. This should result in correct
results when we have large unsigned numbers.
N.B. Bizarrely, things that are 32-bit displacements like vbptr offsets
are mangled as-if they are unsigned 32-bit numbers. This is a pretty
egregious waste of space, it would be a 4x savings if we could mangle it
like a signed 32-bit number. Instead, we explicitly cast these
displacements to uint32_t and let the mangler proceed.
Richard Smith [Mon, 9 Dec 2013 07:03:59 +0000 (07:03 +0000)]
Update compatibility page to list some GCC language extensions that Clang does
not support as a possible reason for choosing GCC instead of Clang (and vice
versa). Weaken some of the claimed advantages of Clang in light of GCC
improvements.
Before this patch GetOrCreateLLVMFunction would add a decl to
DeferredDeclsToEmit even when it was being called by the function trying to
emit that decl.
David Majnemer [Mon, 9 Dec 2013 04:28:34 +0000 (04:28 +0000)]
[-cxx-abi microsoft] Properly mangle enums
While testing our ability to mangle large constants (PR18175), I
incidentally discovered that we did not properly mangle enums correctly.
Previously, we would append the width of the enum in bytes after the
type-tag differentiator.
This would mean "enum : short" would be mangled as 'W2' while "enum :
char" would be mangled as 'W1'. Upon testing this with several versions
of MSVC, I found that this did not match their behavior: they always use
'W4'.
N.B. Quick testing uncovered that undname allows different numbers to
follow the 'W' in the following way: