Faisal Vali [Sat, 14 Dec 2013 00:40:05 +0000 (00:40 +0000)]
Quick-Fix pointer arithmetic when performing multi-D new-array initialization.
clang still doesn't emit the right llvm code when initializing multi-D arrays it seems.
For e.g. the following code would still crash for me on Windows 7, 64 bit:
auto f4 = new int[100][200][300]{{{1,2,3}, {4, 5, 6}}, {{10, 20, 30}}};
It seems that the final new loop that iterates through each outermost array and memsets it to zero gets confused with its final ptr arithmetic.
This patch ensures that it converts the pointer to the allocated type (int [200][300]) before incrementing it (instead of using the base type: 'int').
Richard somewhat squeamishly approved the patch (as a quick fix to potentially make it into 3.4) - while exhorting for a more optimized fix in the future. http://llvm-reviews.chandlerc.com/D2398
Hans Wennborg [Fri, 13 Dec 2013 18:34:23 +0000 (18:34 +0000)]
Tighten test regexes checking for __attribute__((thiscall)) on function types.
The tests were perhaps made too relaxed in r197164 when we switched to the new
MinGW ABI. This makes sure we check explicitly for an optional thiscall
attribute and nothing else.
We should still look into whether we should print these attributes at all in
these cases.
Objective-C. Do not issue warning when 'readonly'
property declaration has a memory management
attribute (retain, copy, etc.). Sich properties
are usually overridden to become 'readwrite'
via a class extension (which require the memory
management attribute specified). In the absence of class
extension override, memory management attribute is
needed to produce correct Code Gen. for the
property getter in any case and this warning becomes
confusing to user. // rdar://15641300
Tim Northover [Fri, 13 Dec 2013 16:05:12 +0000 (16:05 +0000)]
ARM MachO embedded: fix test without FileCheck line
Well, that's one way to pass a test, I suppose. Unfortunately actually doing
the testing means I didn't pass all I thought (embedded v7a is not supported,
apparently). I'll deal with that with the move to -none-macho rather than
putting heinous hacks in right now.
[objc] If we don't know for sure what the designated initializers of the superclass are,
assume that a [super init..] inside a designated initializer also refers to a designated one
and do not warn.
David Majnemer [Fri, 13 Dec 2013 00:54:42 +0000 (00:54 +0000)]
AST: Update URL for Itanium ABI spec
The old URL hasn't worked for quite some time. While we are here, also
change the link so that it will send us straight to the mangling portion
of the ABI doc.
Warren Hunt [Thu, 12 Dec 2013 23:23:28 +0000 (23:23 +0000)]
[ms-abi] Fixing bitfields sema arror for ms-mode
The check for bitfields that are longer than their base type needed to
be checked in microsoft mode (cl.exe does not support the C++ extnetion
for bitfields longer than their type).
Warren Hunt [Thu, 12 Dec 2013 22:33:37 +0000 (22:33 +0000)]
[ms-abi] Refactoring Non-virtual base layout in record layout
This refactor addresses bugzilla bug 18167 and simplifies the code at
the same time. Also I add a test case for the bug. Also I make a
non-functional change to the basic layout lit tests to make them more
reliable (using CHECK-NEXT instead of CHECK).
Alp Toker [Thu, 12 Dec 2013 21:23:03 +0000 (21:23 +0000)]
Unify type trait parsing
Type trait parsing is all over the place at the moment with unary, binary and
n-ary C++11 type traits that were developed independently at different points
in clang's history.
There's no good reason to handle them separately -- there are three parsers,
three AST nodes and lots of duplicated handling code with slightly different
implementations and diags for each kind.
This commit unifies parsing of type traits and sets the stage for further
consolidation.
No change in behaviour other than more consistent error recovery.
Bernard Ogden [Thu, 12 Dec 2013 13:27:11 +0000 (13:27 +0000)]
Refactor duplicate functions
getARMCPU and getLLVMArchSuffixForARM existed as very similar functions
in both ToolChain.cpp and Tools.cpp. Create a single implementation of
each in Tools.cpp, eliminate the duplicate and share via Tools.h.
Creates an 'arm' namespace in Tools.h to be used by any ARM-targetting tools.
Tim Northover [Thu, 12 Dec 2013 11:55:52 +0000 (11:55 +0000)]
Darwin-embedded: find correct libclang_rt for embedded targets.
This refactors some of the Darwin toolchain classification to give a more solid
distinction between the three primary Darwin platforms (OS X, IOS and IOS
simulator) so that a 4th choice can be added temporarily: embedded MachO
targets.
Longer term, this support will be factored out into a separate class and no
longer classified as "darwin-eabi", but the refactoring should still be useful.
Filter-out irrelevant command-line options in CommonOptionsParser.
Summary:
Leave only -help, -version and options from the specified category.
Updated clang-check and clang-tidy. As clang-tidy is in a separate repository,
here's the diff:
Index: tools/extra/clang-tidy/tool/ClangTidyMain.cpp
===================================================================
--- tools/extra/clang-tidy/tool/ClangTidyMain.cpp (revision 197024)
+++ tools/extra/clang-tidy/tool/ClangTidyMain.cpp (working copy)
@@ -39,7 +39,7 @@
// FIXME: Add option to list name/description of all checks.
Implemented GNU-style formatting for compound statements.
Summary:
Added BraceBreakingStyle::BS_GNU. I'm not sure about the correctness of
static initializer formatting, but compound statements should be fine.
Richard Smith [Thu, 12 Dec 2013 03:40:18 +0000 (03:40 +0000)]
PR17602: check accessibility when performing an implicit derived-to-base
conversion on the LHS of a .* or ->*. Slightly improve diagnostics in case
of an ambiguous base class.
Kevin Qin [Thu, 12 Dec 2013 02:17:35 +0000 (02:17 +0000)]
Fix Incorrect CHECK message [0-31]+ in test case.
In regular expression, [0-31]+ equals to [0-3]+, not the number from
0 to 31. So change it to [0-9]+.
Richard Smith [Thu, 12 Dec 2013 01:27:02 +0000 (01:27 +0000)]
PR18217: Rewrite JumpDiagnostics' handling of temporaries, to correctly handle
declarations that might lifetime-extend multiple temporaries. In passing, fix a
crasher (PR18217) if an initializer was dependent and exactly the wrong shape,
and remove a bogus function (Expr::findMaterializedTemporary) now its last use
is gone.
Objective-C migrator: when inferring 'readonly' property of an
Objective-C object conforming to 'NSCopying' protocol, infer
a 'copy' property, instead of 'strong'. // rdar://15525937
Hans Wennborg [Wed, 11 Dec 2013 23:40:50 +0000 (23:40 +0000)]
Change semantics of regex expectations in the diagnostic verifier
Previously, a line like
// expected-error-re {{foo}}
treats the entirety of foo as a regex. This is inconvenient when matching type
names containing regex characters. For example, to match
"void *(class test8::A::*)(void)" inside such a regex, one would have to type
"void \*\(class test8::A::\*\)\(void\)".
This patch changes the semantics of expected-error-re to only treat the parts
of the directive wrapped in double curly braces as regexes. This avoids the
escaping problem and leads to nicer patterns for those cases; see e.g. the
change to test/Sema/format-strings-scanf.c.
(The balanced search for closing }} of a directive also makes us handle the
full directive in test\SemaCXX\constexpr-printing.cpp:41 and :53.)
Aaron Ballman [Wed, 11 Dec 2013 22:27:44 +0000 (22:27 +0000)]
No longer accepting attribute spellings with prefix and suffix underscores except for GNU attributes, or C++11-style attributes in the GNU namespace. This prevents attributes such as __declspec(__dllexport__) or [[__noreturn__]] from being treated as known attributes.
[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.