Tim Northover [Thu, 21 Nov 2013 12:36:34 +0000 (12:36 +0000)]
ARM: define & use __ARM_NEON on ARM32 (as per ACLE)
There seem to be quite a few references to the old macro __ARM_NEON__ on the
internet, so I don't think it's a good idea to remove it entirely (at least
yet), but the canonical name does not have the trailing underscores so we
should use that ourselves.
Ted Kremenek [Thu, 21 Nov 2013 07:57:53 +0000 (07:57 +0000)]
Revert "Add new attribute 'objc_suppress_protocol' to suppress protocol conformance for a class."
After implementing this patch, a few concerns about the language
feature itself emerged in my head that I had previously not considered.
I want to resolve those design concerns first before having
a half-designed language feature in the tree.
Ted Kremenek [Thu, 21 Nov 2013 07:20:42 +0000 (07:20 +0000)]
Add new attribute 'objc_suppress_protocol' to suppress protocol conformance for a class.
The idea is to allow a class to stipulate that its methods (and those
of its parents) cannot be used for protocol conformance in a subclass.
A subclass is then explicitly required to re-implement those methods
of they are present in the class marked with this attribute.
Currently the attribute can only be applied to an @interface, and
not a category or class extension. This is by design. Unlike
protocol conformance, where a category can add explicit conformance
of a protocol to class, this anti-conformance really needs to be
observed uniformly by all clients of the class. That's because
the absence of the attribute implies more permissive checking of
protocol conformance.
This unfortunately required changing method lookup in ObjCInterfaceDecl
to take an optional protocol parameter. This should not slow down
method lookup in most cases, and is just used for protocol conformance.
Hans Wennborg [Thu, 21 Nov 2013 03:17:44 +0000 (03:17 +0000)]
Provide better diagnostic wording for initializers on static
data member definitions when the variable has an initializer
in its declaration.
For the following code:
struct S {
static const int x = 42;
};
const int S::x = 42;
This patch changes the diagnostic from:
a.cc:4:14: error: redefinition of 'x'
const int S::x = 42;
^
a.cc:2:20: note: previous definition is here
static const int x = 42;
^
to:
a.cc:4:18: error: static data member 'x' already has an initializer
const int S::x = 42;
^
a.cc:2:24: note: previous initialization is here
static const int x = 42;
^
Richard Smith [Thu, 21 Nov 2013 01:53:02 +0000 (01:53 +0000)]
PR10837: Warn if a null pointer constant is formed by a zero integer constant
expression that is not a zero literal, in C. This is a different, and more
targeted, approach than that in r194540.
Daniel Jasper [Thu, 21 Nov 2013 01:46:33 +0000 (01:46 +0000)]
clang-format: Improve formatting of ObjC method expressions.
In particular, make breaking after a parameter's ":" more of a last
resort choice as it significantly affects the readability gained by
aligning the parameters.
Before (in Chromium style - which doesn't allow bin-packing):
{
popup_window_.reset([[RenderWidgetPopupWindow alloc]
initWithContentRect:
NSMakeRect(
origin_global.x, origin_global.y, pos.width(), pos.height())
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO]);
}
Richard Smith [Wed, 20 Nov 2013 23:40:57 +0000 (23:40 +0000)]
Fix new check for missing semicolon after struct definition to deal with the
case where the type in the following declaration is specified as a template-id,
and refactor for clarity.
Aaron Ballman [Wed, 20 Nov 2013 22:22:04 +0000 (22:22 +0000)]
There is no such thing as __declspec(ms_struct), this is a GNU attribute. Switched the attribute to have the proper spelling, gave it a subject, updated the warning to be more accurate, and updated the test case as appropriate.
Aaron Ballman [Wed, 20 Nov 2013 21:41:42 +0000 (21:41 +0000)]
Removed a duplicate diagnostic related to attribute subjects for thread safety annotations, and replaced it with the more general attribute diagnostic. Updated the test case in the one instance where wording changed. No functional change intended.
Aaron Ballman [Wed, 20 Nov 2013 21:40:13 +0000 (21:40 +0000)]
Updated the thread safety attribute definitions to have subjects defined. These are based off what SemaDeclAttr.cpp is checking for in terms of diagnostic reporting. No functional change intended.
Ted Kremenek [Wed, 20 Nov 2013 17:24:03 +0000 (17:24 +0000)]
Refine 'deprecated' checking for Objective-C classes/methods.
- If a deprecated class refers to another deprecated class, do not warn.
- @implementations of a deprecated class can refer to other deprecated things.
Added an option to allow short function bodies be placed on a single line.
Summary:
The AllowShortFunctionsOnASingleLine option now controls short function
body placement on a single line independent of the BreakBeforeBraces option.
Updated tests using BreakBeforeBraces other than BS_Attach.
Reid Kleckner [Tue, 19 Nov 2013 23:23:00 +0000 (23:23 +0000)]
Add a mangler entry point for TBAA rather than using RTTI directly
Summary:
RTTI is not yet implemented for the Microsoft C++ ABI and isn't expected
soon. We could easily add the mangling, but the error is what prevents
us from silently miscompiling code that expects RTTI.
Instead, add a new mangleTypeName entry point that simply forwards to
mangleName or mangleType to produce a string that isn't part of the ABI.
Itanium can continue to use RTTI names to avoid unecessary test
breakage.
This also seems like the right design. The fact that TBAA names happen
to be RTTI names is now an implementation detail of the mangler, rather
than part of TBAA.
Richard Smith [Tue, 19 Nov 2013 22:47:36 +0000 (22:47 +0000)]
PR9547: If we're parsing a simple-declaration that contains a tag definition,
and we see an ill-formed declarator that would probably be well-formed if the
tag definition were just missing a semicolon, use that as the diagnostic
instead of producing some other mysterious error.
Warren Hunt [Tue, 19 Nov 2013 22:11:09 +0000 (22:11 +0000)]
Microsoft Record Layout: zero sized base after base with vbtbl fix
Microsoft adds an extra byte of padding before laying out zero sized
non-virtual bases if the non-virtual base before it contains a vbptr.
This patch adds the same behavior to clang.
John Thompson [Tue, 19 Nov 2013 17:28:21 +0000 (17:28 +0000)]
YAML I/O - Added default trait support for std:string. Making another attempt at this, this time doing a clean build on Linux, and running the LLVM, clang, and extra tests, to try to make sure there's no problems.
Samuel Benzaquen [Tue, 19 Nov 2013 14:17:28 +0000 (14:17 +0000)]
Change VariadicOperatorMatcherInterface<> to take an ArrayRef<DynTypedMatcher>.
Summary:
Change VariadicOperatorMatcherInterface<> to take an ArrayRef<DynTypedMatcher>.
This simplifies its implementation and use.
Also reduces the number of symbols in Registry.cpp.o, which we are always in need.
Simon Atanasyan [Tue, 19 Nov 2013 12:22:38 +0000 (12:22 +0000)]
[Mips] Do not adjust float-abi flags in case of MIPS16 mode. This code
should be isolated in the backend (r195123). From the frontend point
of view in case of "-mhard-float -mips16" combination of flags the float
ABI mode should remain unchanged.
Aaron Ballman [Tue, 19 Nov 2013 04:08:34 +0000 (04:08 +0000)]
Improving calling convention test coverage by adding tests for things not currently handled. Specifically: the diagnostics in SemaDeclAttr.cpp, and ensuring that calling convention attributes are applied to ObjC method declarations. No functional changes.
Kevin Enderby [Mon, 18 Nov 2013 23:30:29 +0000 (23:30 +0000)]
Change the clang driver with the use of -no-integrated-as for darwin to use
the -Q flag to the as(1) assembler driver.
We will soon be switching the darwin as(1) assembler driver to call clang(1)
and use the intergated assembler by default. To do this and still support
clang(1)'s -no-integrated-as flag, when clang(1) runs the as(1) assembler
driver and -no-integrated-as is used it needs to pass the -Q flag to as(1)
so it uses its GNU based assembler, and not turn around and call clag(1)'s
integrated assembler.
Rafael Espindola [Mon, 18 Nov 2013 22:40:04 +0000 (22:40 +0000)]
The attached patch is a follow up from my previous one. The existing
logic was not handling typedefs as free functions. This was not
causing problems with the existing tests, but does with the microsoft
abi where they have to get a different calling convention.
I will try to refactor this into a method on Declarator in a second.
Aaron Ballman [Mon, 18 Nov 2013 20:11:50 +0000 (20:11 +0000)]
The code using the StmtPrinterHelper object failed to account for a null object in many cases, which could have led to crashes were it ever to be null. Now passing the object by reference instead of by pointer because it is never null in practice. No functional changes intended.
Rafael Espindola [Mon, 18 Nov 2013 20:05:33 +0000 (20:05 +0000)]
Use the default method CC in GetFullTypeForDeclarator.
Before this patch explicit template instatiations of member function templates
were failing with the microsoft abi and 32 bits. This was happening because
the expected and computed function types had different calling conventions.
This patch fixes it by considering the default calling convention in
GetFullTypeForDeclarator.
Samuel Benzaquen [Mon, 18 Nov 2013 14:53:42 +0000 (14:53 +0000)]
Add partial support for the hasDeclaration() matcher in the dynamic layer.
Summary:
Add partial support for the hasDeclaration() matcher in the dynamic layer.
This matcher has some special logic to allow any type that has a getDecl() method. We do not support this right now.
Alp Toker [Sun, 17 Nov 2013 18:13:43 +0000 (18:13 +0000)]
RewriteBuffer::write(): Add a doc comment about non-portable use
The function isn't strictly at fault but there are callers using it
incorrectly, causing crashes with in-place edits of 64KB or larger files on
Windows.
Alp Toker [Sun, 17 Nov 2013 16:49:24 +0000 (16:49 +0000)]
Remove a bad string compare from r194968
lib/Tooling/CompilationDatabase.cpp:275:34: warning: result of comparison against a string literal is unspecified (use strncmp instead) [-Wstring-compare]
This assert() should probably be fixed and added back at some point.
Edwin Vane [Sun, 17 Nov 2013 16:08:04 +0000 (16:08 +0000)]
Relax some preconditions for using FixedCompilationDatabase.
FixedCompilationDatabase (FCD) requires that the arguments it consumes after
'--' must not include positional parameters or the argv[0] of the tool. This
patch relaxes those restrictions.
Hal Finkel [Sun, 17 Nov 2013 16:03:29 +0000 (16:03 +0000)]
Add -freroll-loops to enable loop rerolling
This adds -freroll-loops (and -fno-reroll-loops in the usual way) to enable
loop rerolling as part of the optimization pass manager. This transformation
can enable vectorization, reduce code size (or both).
Briefly, loop rerolling can transform a loop like this:
Anton Yartsev [Sun, 17 Nov 2013 09:18:48 +0000 (09:18 +0000)]
[analyzer] Better modeling of memcpy by the CStringChecker (PR16731).
New rules of invalidation/escape of the source buffer of memcpy: the source buffer contents is invalidated and escape while the source buffer region itself is neither invalidated, nor escape.
In the current modeling of memcpy the information about allocation state of regions, accessible through the source buffer, is not copied to the destination buffer and we can not track the allocation state of those regions anymore. So we invalidate/escape the source buffer indirect regions in anticipation of their being invalidated for real later. This eliminates false-positive leaks reported by the unix.Malloc and alpha.cplusplus.NewDeleteLeaks checkers for the cases like