Rafael Espindola [Sat, 23 Nov 2013 16:40:57 +0000 (16:40 +0000)]
Don't use the gcc driver for assembling.
Clang knows how to use the gnu assembler directly from doing so on linux and
hurd. The existing support worked out of the box on cygwin and mingw and I was
able to bootstrap clang with it in both systems (with pending patches for the
new mingw abi, but that is independent of the assembler).
Benjamin Kramer [Sat, 23 Nov 2013 10:57:32 +0000 (10:57 +0000)]
Enable non-fragile ABI for the ObjFW runtime
The following patch enables the non-fragile ABI for the ObjFW runtime.
However, I noticed that it is not possible anymore to disable it with
-fno-objc-nonfragile-abi like it was before. I think this functionality should
be restored, but I guess this is not in scope for 3.4 anymore.
Daniel Jasper [Sat, 23 Nov 2013 10:22:59 +0000 (10:22 +0000)]
clang-format: Prefer column layout if possible.
Add a severe penalty for not using column layout for braced lists. If
there are solutions with column layout, these are generally preferable
over bin-packed solutions.
Richard Smith [Sat, 23 Nov 2013 04:06:09 +0000 (04:06 +0000)]
Generate a marker token when entering or leaving a submodule when building a
module. Use the marker to diagnose cases where we try to transition between
submodules when not at the top level (most likely because a closing brace was
missing at the end of a header file, but is also possible if submodule headers
attempt to do something fundamentally non-modular, like our .def files).
Ted Kremenek [Sat, 23 Nov 2013 01:01:34 +0000 (01:01 +0000)]
Add back experimental attribute objc_suppress_protocol_methods (slightly renamed).
This is still an experimental attribute, but I wanted it in tree
for review. It may still get yanked.
This attribute can only be applied to a class @interface, not
a class extension or category. It does not change the type
system rules for Objective-C, but rather the implementation checking
for Objective-C classes that explicitly conform to a protocol.
During protocol conformance checking, clang recursively searches
up the class hierarchy for the set of methods that compose
a protocol. This attribute will cause the compiler to not consider
the methods contributed by a super class, its categories, and those
from its ancestor classes. Thus this attribute is used to force
subclasses to redeclare (and hopefully re-implement) methods if
they decide to explicitly conform to a protocol where some of those
methods may be provided by a super class.
This attribute intentionally leaves out properties, which are associated
with state. This attribute only considers methods (at least right now)
that are non-property accessors. These represent methods that "do something"
as dictated by the protocol. This may be further refined, and this
should be considered a WIP until documentation gets written or this
gets removed.
Ted Kremenek [Sat, 23 Nov 2013 01:01:29 +0000 (01:01 +0000)]
Change ObjCIntefaceDecl::lookupMethod() to have optional 'followsSuper' argument.
This enables a micro-optimization in protocol conformance checking
to not examine the class hierarchy twice per method.
As part of this change, remove the default arguments from lookupInstanceMethod()
and lookupClassMethod(). It was becoming very redundant. For clients
needing the default arguments, have them use the full API instead of
these convenience methods.
Remove uninstantiable constructor from DeclTemplate.h
Patch by Kim Gräsman!
Laszlo Nagy and me both ran into the same issue with SpecIterator from DeclTemplate.h causing an error:
tools/clang/include/clang/AST/DeclTemplate.h:560:22: error:
no matching constructor for initialization of 'SetIteratorType' (aka
'FoldingSetVectorIterator<clang::FunctionTemplateSpecializationInfo,
typename SmallVector<FunctionTemplateSpecializationInfo *, 8>::iterator>')
SpecIterator() : SetIter() {}
(see e.g. http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-November/033642.html)
The problem is the SpecIterator default constructor which needs a non-existent SetIter default constructor. SpecIterator's default constructor is evidently dead code as any call to it would fail with the above error.
ObjectiveC. Remove warning diagnostic which checks
attribute on method declaration and implementation
match. This makes no sense. Most annotations are
meant for declarations only and one is for implementation.
This has been constant source of regresions and hackery to
get around special cases. I am removing this check.
Such checks must be done on a case by case basis and
when it makes sense. For example, it makes sense
for availability/deprecated and I will file a radar
for that. // rdar://15531984
Aaron Ballman [Fri, 22 Nov 2013 22:49:31 +0000 (22:49 +0000)]
Updating Subjects definitions for attributes based on semantic handling. Removes Subjects for things we cannot currently check, adds Subjects for things we can, and rectifies most discrepancies. Since Subjects are not currently handled in tablegen, there are no functional changes with this patch.
Adjust r194296 to not apply the alias replacement for externally
available always-inline functions. This breaks libc++'s locale
implementation. Code generation for this case should be fixed, but this
is a stop gap fix for clang 3.4.
Justin Bogner [Fri, 22 Nov 2013 10:20:43 +0000 (10:20 +0000)]
Revert r193994 and part of r193995
Not long ago I made the CodeGen of for loops simplify the condition at
-O0 in the same way we do for if and conditionals. Unfortunately this
ties how loops and simple conditions work together too tightly, which
makes features such as instrumentation based PGO awkward.
Ultimately, we should find a more general way to simplify the logic in
a given condition, but for now we'll just avoid using EmitBranchOnBool
for loops, like we already do for while and do loops.
Richard Smith [Fri, 22 Nov 2013 09:01:48 +0000 (09:01 +0000)]
Add class-specific operator new to Decl hierarchy. This guarantees that Decls
can't accidentally be allocated the wrong way (missing prefix data for decls
from AST files, for instance) and simplifies the CreateDeserialized functions a
little. An extra DeclContext* parameter to the not-from-AST-file operator new
allows us to ensure that we don't accidentally call the wrong one when
deserializing (when we don't have a DeclContext), allows some extra checks, and
prepares for some planned modules-related changes to Decl allocation.
Alp Toker [Fri, 22 Nov 2013 08:27:46 +0000 (08:27 +0000)]
Tidy up the no-external-assembler diag
Diags aren't usually in the first person, and 'windows' isn't the correct
product spelling to use in prose. Sidestep issues completely by making this
error message platform-neutral.
Alp Toker [Fri, 22 Nov 2013 08:00:20 +0000 (08:00 +0000)]
Add txt file extension to VS solution's README
This matches other README.txt files in LLVM and makes things more obvious on
Windows where it's likely to be read. CRLFs are retained for the same reason.
ObjectiveC. Implement attribute 'objc_bridge_mutable'
whose semantic is currently identical to objc_bridge,
but their differences may manifest down the road with
further enhancements. // rdar://15498044
Joey Gouly [Thu, 21 Nov 2013 17:09:05 +0000 (17:09 +0000)]
Fix a crash in EmitStoreThroughExtVectorComponentLValue for vectors of odd sizes.
In OpenCL a vector of 3 elements, acts like a vector of four elements.
So for a vector of size 3 the '.hi' and '.odd' accessors, would access
the elements {2, 3} and {1, 3} respectively.
However, in EmitStoreThroughExtVectorComponentLValue we are still operating on
a vector of size 3, so we should only access {2} and {1}. We do this by checking
the last element to be accessed, and ignore it if it is out-of-bounds.
EmitLoadOfExtVectorElementLValue doesn't have a similar problem, because it does
a direct shufflevector with undef, so an out-of-bounds access just gives an undef
value.
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.