Commit Graph

7255 Commits

Author SHA1 Message Date
Douglas Gregor 6e8da6a291 Don't analyze comparisons in type- or value-dependent
subexpressions. Fixes PR10291.

llvm-svn: 141552
2011-10-10 17:38:18 +00:00
Douglas Gregor 556e5860f9 Per C++ [class.bit]p2, unnamed bit-fields are not members. Fixes PR10289.
llvm-svn: 141549
2011-10-10 17:22:13 +00:00
Richard Smith f368fb40df constexpr: Disable checking of constructor member initializer lists for
constexpr constructor templates. Such checking is optional, and currently hard
to get right since clang doesn't generate implicit member initializers until
instantiation (even for non-dependent members).

This is needed for clang to accept libstdc++ from g++4.6 in c++0x mode.

llvm-svn: 141547
2011-10-10 16:38:04 +00:00
Douglas Gregor bcc9539323 Don't complain about qualified property or ivar access when the
qualifier itself is invalid. Crasher noticed by Fariborz.

llvm-svn: 141544
2011-10-10 16:09:49 +00:00
Douglas Gregor b06fa540e8 When adding a direct initializer to a declaration, allow the
initializer to update the type of the declaration. For example, this
allows us to determine the size of an incomplete array from its
initializer. Fixes PR10288.

llvm-svn: 141543
2011-10-10 16:05:18 +00:00
Douglas Gregor 728d00b8e7 Parse the initializer for a class member after handling its
declarator, so that the declarator is in scope for the
initializer. Fixes PR9989.

llvm-svn: 141539
2011-10-10 14:49:18 +00:00
Douglas Gregor 877d4ebba4 Always add the built-in overload candidates for operators &&, ||, and
!. Fixes PR9865.

llvm-svn: 141537
2011-10-10 14:05:31 +00:00
Alexis Hunt d6da876bac Begin work consolidating ShouldDelete* functions.
Begin with just default constructors. One note is that as a side effect
of this, a conformance test was removed on the basis that this is almost
certainly a defect as with most of union initialization. As it is, clang
does not implement union initialization close to the standard as it's
quite broken as written. I hope to write a paper addressing the issues
eventually.

llvm-svn: 141528
2011-10-10 06:18:57 +00:00
Douglas Gregor 16e65616d6 Implement the restrictions in C++ [class.friend]p6, which disallow
defining a friend function with a qualified name or in a local
class. Fixes PR9853. 

llvm-svn: 141524
2011-10-10 01:11:59 +00:00
Douglas Gregor 12340e5b18 Diagnose attempts to qualify the name of an instance variable or
property in an Objective-C++ member access expression. Fixes PR9759.

llvm-svn: 141522
2011-10-09 23:22:49 +00:00
Douglas Gregor f7b98957ac Push "out-of-line" declarations into scope when their lexical/semantic
redeclaration contexts are the same, as occurs within linkage
specifications. Fixes PR9162.

llvm-svn: 141521
2011-10-09 22:57:49 +00:00
Douglas Gregor 56636589ff The effective context of a friend function is its lexical
context. Fixes PR9103.

llvm-svn: 141520
2011-10-09 22:38:36 +00:00
Douglas Gregor f892c7fe60 For the various CF and NS attributes, don't complain if the parameter
or return types are dependent. Fixes PR9049.

llvm-svn: 141518
2011-10-09 22:26:49 +00:00
Douglas Gregor 0c83c8128b Per the note in C++0x [temp.deduct.call]p4, don't attempt template
argument deduction against a function parameter that has no deducible
template parameters in it. Fixes PR8598.

llvm-svn: 141517
2011-10-09 22:06:46 +00:00
Douglas Gregor e9d075e434 A friend template specialization is also dependent if any of its
template arguments are dependent. Fixes PR10913.

llvm-svn: 141515
2011-10-09 20:59:17 +00:00
Douglas Gregor 668d362503 Only allow taking the address of an expression of type 'overloaded
function type' when that expression is actually an overloaded function
reference (and not the address of an overloaded function
reference). Fixes PR11066. 

llvm-svn: 141514
2011-10-09 19:10:41 +00:00
Douglas Gregor bb64afcc39 Diagnose attempts to declare a non-static data member with a
non-identifier name. Fixes PR10839.

llvm-svn: 141513
2011-10-09 18:55:59 +00:00
Douglas Gregor c4475e8cd6 When building source location information for an _Atomic type, be sure
to fill in the source locations for the underlying value type. Fixes
an intermittent crasher (due to uninitialized data) in the PCH test
for _Atomic types.

llvm-svn: 141512
2011-10-09 18:45:17 +00:00
Douglas Gregor 4d328b6e16 After instantiating a 'noexcept' expression, be sure to convert it to
a boolean value and check that it is a constant expression. Fixes
PR11084.

llvm-svn: 141511
2011-10-09 18:31:23 +00:00
Benjamin Kramer ec44099cf8 Initialize the HadMultipleCandidates flag.
Found by valgrind.

llvm-svn: 141510
2011-10-09 17:58:25 +00:00
Fariborz Jahanian 9059124b41 objc: Do not warn about mismatch on Super's readonly property attribute,
related to a readwrite property, and
Sub's readwrite property. // rdar://9396329

llvm-svn: 141497
2011-10-08 17:45:33 +00:00
Benjamin Kramer ec173a5c92 Silence a warning about casting away constness.
llvm-svn: 141496
2011-10-08 16:15:07 +00:00
NAKAMURA Takumi 82a351197f Whitespace
llvm-svn: 141486
2011-10-08 11:31:46 +00:00
Fariborz Jahanian 13d3f86577 objc++: some minor cleanup and a test case
for atomic setters which requires assignment operator.

llvm-svn: 141415
2011-10-07 21:08:14 +00:00
Chandler Carruth 08d0491006 Hack in a workaround for PR11082 until we have a proper fix. This
un-breaks every glib-dependent compile with Clang.

I'm not sure this is even the best workaround, so suggestions welcome.

llvm-svn: 141381
2011-10-07 18:40:27 +00:00
John McCall f937c023bf Rename TagDecl::isDefinition -> isCompleteDefinition
for better self-documenting code, since the semantics
are subtly different from getDefinition().

llvm-svn: 141355
2011-10-07 06:10:15 +00:00
Fariborz Jahanian 9cd57a7061 objc: Improve on diagnostic when atomic proeprty is synthesized
on one accessor and user-provide with another.

llvm-svn: 141343
2011-10-06 23:47:58 +00:00
John McCall 9776e438cf Move type-checking for C-style casts in C into the now-misnamed
SemaCXXCast.cpp.  Should have no functionality change.

llvm-svn: 141336
2011-10-06 23:25:11 +00:00
Argyrios Kyrtzidis c281c96675 Implicitly assume that a ObjC category to an unavailable interface is also unavailable;
only give an 'unavailable' error on the @implementation of the category. rdar://10234078

llvm-svn: 141335
2011-10-06 23:23:27 +00:00
Argyrios Kyrtzidis 9321ad3f97 When using an unavailable/deprecated interface Foo inside Foo's interface/implementation
don't emit unavailable errors.

llvm-svn: 141334
2011-10-06 23:23:20 +00:00
Eli Friedman 0dfb889575 Support for C1x _Atomic specifier (see testcase). This is primarily being committed at the moment to help support C++0x <atomic>, but it should be a solid base for implementing the full specification of C1x _Atomic.
Thanks to Jeffrey Yasskin for the thorough review!

llvm-svn: 141330
2011-10-06 23:00:33 +00:00
Fariborz Jahanian 565ed7a4c1 objc++: For atomic properties of c++ class objec typet, appropriate
operator= is called. Issue a warning for non-trivial case until
runtime support is provided. // rdar://6137845

llvm-svn: 141302
2011-10-06 18:38:18 +00:00
Richard Smith 43a87fe86a PR11067: A definition of a constexpr static variable doesn't need an initializer if the in-class declaration had one. Such a declaration must be initialized by a constant expression.
llvm-svn: 141279
2011-10-06 09:21:12 +00:00
Erik Verbruggen 2e657ffd8e Added CXAvailability_NotAccessible to indicate that a declaration is available, but not accessible from the current code completion context.
llvm-svn: 141278
2011-10-06 07:27:49 +00:00
Peter Collingbourne 485b80fecc OpenCL: add a non-standard extension, cl_clang_storage_class_specifiers,
which enables support for C99 storage-class specifiers.

This extension is intended to be used by implementations to implement
OpenCL C built-in functions.

llvm-svn: 141271
2011-10-06 03:01:00 +00:00
Argyrios Kyrtzidis 78181b4b45 Fix the rewriter, rdar://10234024.
llvm-svn: 141201
2011-10-05 19:37:56 +00:00
Abramo Bagnara 635ed24e1d Added a flag to identify resolved overloaded function references.
llvm-svn: 141171
2011-10-05 07:56:41 +00:00
John McCall b50451a188 Refactor the analysis of C++ cast expressions so that even
C-style and functional casts are built in SemaCXXCast.cpp.
Introduce a helper class to encapsulate most of the random
state being passed around, at least one level down.

llvm-svn: 141170
2011-10-05 07:41:44 +00:00
Fariborz Jahanian 48c69106e4 c: assignment/init of a function pointer whose function(s)
return to one which does not return (has noreturn attribute) 
should warn as it is an unsafe assignment. // rdar://10095762
c++ already handles this. This is the c version.

llvm-svn: 141141
2011-10-05 00:05:34 +00:00
Douglas Gregor b0e6c8a350 Don't allow an rvalue reference to bind to the result of a calling a
conversion function whose result type is an lvalue reference. The
initialization code already handled this properly, but overload
resolution was allowing the binding. Fixes PR11003 /
<rdar://problem/10233078>.

llvm-svn: 141137
2011-10-04 23:59:32 +00:00
Eli Friedman 606c103644 Remove a nonsensical bit of code from InitListChecker::getStructuredSubobjectInit which was increasing the reserved size for an init list past its maximum possible size. Fixes PR11056, a case where we were reserving a bunch of memory for arrays that was never actually used.
(No testcase because I don't think we have any way to actually write a testcase for this; the chosen value of NumElements has no effects on anything other than performance and memory usage.)

llvm-svn: 141106
2011-10-04 20:31:48 +00:00
Fariborz Jahanian f2a7b0eade objc: Turn diagnostic on property type mismatch in
continuation class into warning. // rdar://10231514

llvm-svn: 141100
2011-10-04 18:44:26 +00:00
Argyrios Kyrtzidis 52f53fb303 Improve location fidelity of objc decls.
-Add the location of the class name to all objc container decls, not just ObjCInterfaceDecl.
-Make objc decls consistent with the rest of the NamedDecls and have getLocation() point to the
 class name, not the location of '@'.

llvm-svn: 141061
2011-10-04 04:48:02 +00:00
Fariborz Jahanian ed1933b02b objc arc: Suppress certain arc diagnostics on unavailable
functions. // rdar://10186536

llvm-svn: 141037
2011-10-03 22:11:57 +00:00
Abramo Bagnara fd3a455ac7 Fixed source range for template implicit instantiations.
llvm-svn: 141018
2011-10-03 20:34:03 +00:00
Fariborz Jahanian 082a6a14a5 objc++: Accessing explicit property of reference type need
not bind to a temporary. Fixes //rdar://10188258

llvm-svn: 141009
2011-10-03 17:58:21 +00:00
Rafael Espindola 70107f989c Propagate __attribute__((returns_twice)) from C to IL.
llvm-svn: 141002
2011-10-03 14:59:42 +00:00
Argyrios Kyrtzidis b8c3aaf479 Allow getting all source locations of selector identifiers in a ObjCMethodDecl.
Instead of always storing all source locations for the selector identifiers
we check whether all the identifiers are in a "standard" position; "standard" position is

  -Immediately before the arguments: -(id)first:(int)x second:(int)y;
  -With a space between the arguments: -(id)first: (int)x second: (int)y;
  -For nullary selectors, immediately before ';': -(void)release;

In such cases we infer the locations instead of storing them.

llvm-svn: 140989
2011-10-03 06:37:04 +00:00
Argyrios Kyrtzidis a6011e25a1 Allow getting all source locations of selector identifiers in a ObjCMessageExpr.
Instead of always storing all source locations for the selector identifiers
we check whether all the identifiers are in a "standard" position; "standard" position is

  -Immediately before the arguments: [foo first:1 second:2]
  -With a space between the arguments: [foo first: 1 second: 2]
  -For nullary selectors, immediately before ']': [foo release]

In such cases we infer the locations instead of storing them.

llvm-svn: 140987
2011-10-03 06:36:51 +00:00
Argyrios Kyrtzidis 59ad1e3f57 ArrayRef'ize ObjCMessageExpr
llvm-svn: 140986
2011-10-03 06:36:45 +00:00