Simon Atanasyan [Tue, 26 Nov 2013 11:57:14 +0000 (11:57 +0000)]
[Mips] Do not detect a used MIPS toolchain. Build a path suffix for FSF
toolchain first and check the path existence. If the path does not
exist build and check a path suffix for Code Sourcery toolchain.
Summary:
getStringSplit used to crash, when trying to split a long string
literal containing both printable and unprintable multi-byte UTF-8 characters.
Alp Toker [Tue, 26 Nov 2013 01:30:10 +0000 (01:30 +0000)]
Unbreak -fms-extensions with GNU libc headers
GNU libc uses '__uptr' as a member name in C mode, conflicting with the
eponymous MSVC pointer modifier keyword.
Detect and mark the token as an identifier when these specific conditions are
met. __uptr will continue to work as a keyword for the remainder of the
translation unit.
David Majnemer [Mon, 25 Nov 2013 17:50:19 +0000 (17:50 +0000)]
[-cxx-abi microsoft] Create backrefs for <unnamed-type-`id'>
It wasn't possible for an anonymous type to show up inside of function arguments.
However, decltype (which MSVC added support for in 2010) makes this
possible. Further, backrefs to these anonymous types can now be formed.
This fixes PR18022.
N.B. We do not, and very likely _will not_, support MSVC's bug where
subsequent typedefs of anonymous types leak into the linkage name; this
is a gross violation of the ABI. A warning should be introduced to
inform our users of this particular shortcoming.
Daniel Jasper [Mon, 25 Nov 2013 11:08:59 +0000 (11:08 +0000)]
clang-format: Refactor calculation of lines intersecting with -lines.
No functional changes intended. However, it seems to have found a buggy
behavior in one of the tests. I think this structure is generally
desirable and it will make a planned bugfix significantly easier.
Alp Toker [Mon, 25 Nov 2013 00:40:53 +0000 (00:40 +0000)]
Add heading and remove leftover personal email addresses
clang's attribute support is mature by now so replace Sean's warning and email
address with a standard LLVM copyright heading.
Also remove a personal email address and credit docstring from CGObjCGNU that
shouldn't have been there.
This is in line with the LLVM developer policy introduced in r45410.
Contributors can add themselves to CREDITS.txt while active module owners are
listed in CODE_OWNERS.TXT.
Rafael Espindola [Sun, 24 Nov 2013 23:40:06 +0000 (23:40 +0000)]
remove gcc::Precompile
Clang still has support for running gcc for performing various stages
of a build. Right now it looks like this is used for
* Supporting Fortran in the clang driver
* Running an assembler or linker in systems we don't yet know how to
run them directly.
It looks like the gcc::Precompile is a vestige from the days when we
supported using clang for C and running gcc for c++. This patch removes it
(yes, we have no tests for it).
Aaron Ballman [Sun, 24 Nov 2013 21:35:16 +0000 (21:35 +0000)]
__declspec(uuid) is only supported for C++ code according to MSDN (as well as behaviorally in MSVC). This adds a generic diagnostic that we use for uuid, and can use for some other attributes as well, and adds a testcase.
Aaron Ballman [Sun, 24 Nov 2013 20:58:02 +0000 (20:58 +0000)]
__declspec(uuid) is only allowed on a class according to MSDN; this makes the semantic checking consistent with what the attribute specifies in Attr.td. Also adds a test case.
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.