Commit Graph

268 Commits

Author SHA1 Message Date
Fariborz Jahanian 78f565b0a0 objective-C++: issue diagnostic when ivar type is
an abstract c++ class. // rdar://12095239

llvm-svn: 162052
2012-08-16 22:38:41 +00:00
Fariborz Jahanian f64b4722eb objective-C++: dalyed parsing of ctors with member
initializer list defined inside an objc class
implementation. wip

llvm-svn: 161699
2012-08-10 21:15:06 +00:00
Fariborz Jahanian 053227f808 objective-C++: delay parsing of ctor with try block
with member initializer list defined inside
an objc implementation block. wip.

llvm-svn: 161692
2012-08-10 20:34:17 +00:00
Fariborz Jahanian 8cecfe9fc9 objective-C++: delayed parsing of member function with
function-try-block occuring in objc's implementation
block. wip.

llvm-svn: 161675
2012-08-10 18:10:56 +00:00
Fariborz Jahanian 712bb81a6d objective-C++: Delayed parsing of most common
member functions defined inside an objc class
implementation. wip.

llvm-svn: 161667
2012-08-10 15:54:40 +00:00
Douglas Gregor 847cea72e6 Objective-C pointer types don't have C-linkage, even though they are
non-POD. Fixes <rdar://problem/12031870>.

llvm-svn: 161395
2012-08-07 06:14:34 +00:00
Eli Friedman 22be06a250 Fix an assertion failure instantiating a constexpr function from within a -dealloc method. PR13401.
llvm-svn: 161135
2012-08-01 21:02:59 +00:00
Richard Smith 943c440455 Improvements to vexing-parse warnings. Make the no-parameters case more
accurate by asking the parser whether there was an ambiguity rather than trying
to reverse-engineer it from the DeclSpec. Make the with-parameters case have
better diagnostics by using semantic information to drive the warning,
improving the diagnostics and adding a fixit.

Patch by Nikola Smiljanic. Some minor changes by me to suppress diagnostics for
declarations of the form 'T (*x)(...)', which seem to have a very high false
positive rate, and to reduce indentation in 'warnAboutAmbiguousFunction'.

llvm-svn: 160998
2012-07-30 21:30:52 +00:00
Fariborz Jahanian 36986c6e0f objective-c arc: When function calls with known CFCreate naming convention
are cast to retainable types, only suggest CFBridgingRelease/
CFBridgingRetain and not the __bridge casts.
// rdar://11923822

llvm-svn: 160900
2012-07-27 22:37:07 +00:00
Fariborz Jahanian 84c97cafd0 revert r160839 for now.
llvm-svn: 160895
2012-07-27 21:34:23 +00:00
Fariborz Jahanian 226459efff objc-arc: When objects with known CF semantics are assigned to
retainable types in arc, only suggest CFBridgingRelease/
CFBridgingRetain and not the confusing __bridge casts.
// rdar://11923822

llvm-svn: 160839
2012-07-26 23:17:04 +00:00
Douglas Gregor 6fa6942dda When we have an Objective-C object with non-trivial lifetime in a
structor class under ARC, that struct/class does not have a trivial
move constructor or move assignment operator. Fixes the rest of
<rdar://problem/11738725>.

llvm-svn: 160615
2012-07-23 04:23:39 +00:00
Fariborz Jahanian deb144ab51 Fixes an ObjC++ parse crash caused by delayed parsing
of c-functions nested in namespace in method implementations
by turning off its delayed parsing until a proper solution is 
figured out. pr13418

llvm-svn: 160552
2012-07-20 17:19:54 +00:00
Jordan Rose 96c49686b9 Capitalize "Objective-C" and "C++" in user-facing contexts.
No functionality change.

llvm-svn: 160516
2012-07-19 18:10:18 +00:00
Douglas Gregor a906ad2f9e When performing the deduced/actual argument type check for C++
[temp.deduct.call]p4 under Objective-C++ ARC, make sure to adjust the
qualifiers to introduce the implicit strong lifetime when
needed. Fixes <rdar://problem/11825671>.

llvm-svn: 160412
2012-07-18 00:14:59 +00:00
Fariborz Jahanian 0021347926 objective-c++11: extend c++11 range-based loop to iterate
over objective-c container collection. // rdar://9293227

llvm-svn: 159847
2012-07-06 19:04:04 +00:00
Fariborz Jahanian 8de7955f35 objective-c++ parsing. Turn off delayed parsing
of out-of-line c++ method definition which happens
to be inside an objc class implementation
until I can figure out how to do it. This is to fix 
a broken project.

llvm-svn: 159772
2012-07-05 19:34:20 +00:00
Fariborz Jahanian 8be1ecd615 Obj-C++11 parser: handle a fall out of delayed
c-function parsing when a declaration with
C++0x braced-init-list is inside an @implementation.

llvm-svn: 159693
2012-07-03 23:22:13 +00:00
Douglas Gregor 6bd56ca836 Teach the __is_trivially_assignable and __is_trivially_constructible
type traits that assignment to/construction of a lifetime-qualified
object under ARC is *not* trivial. Fixes <rdar://problem/11738725>.

llvm-svn: 159401
2012-06-29 00:49:17 +00:00
Fariborz Jahanian 46e14f8108 objective-c: improve diagnostic when collection expression is
not a pointer to a fast-enumerable object. // rdar://11488666

llvm-svn: 158998
2012-06-22 15:37:00 +00:00
John McCall 5fb5df9c83 Restructure how the driver communicates information about the
target Objective-C runtime down to the frontend:  break this
down into a single target runtime kind and version, and compute
all the relevant information from that.  This makes it
relatively painless to add support for new runtimes to the
compiler.  Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z,
available at the driver level as a better and more general
alternative to -fgnu-runtime and -fnext-runtime.  This new
concept of an Objective-C runtime also encompasses what we
were previously separating out as the "Objective-C ABI", so
fragile vs. non-fragile runtimes are now really modelled as
different kinds of runtime, paving the way for better overall
differentiation.

As a sort of special case, continue to accept the -cc1 flag
-fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak.

I won't go so far as to say "no functionality change", even
ignoring the new driver flag, but subtle changes in driver
semantics are almost certainly not intended.

llvm-svn: 158793
2012-06-20 06:18:46 +00:00
Jordan Rose 7c0abc34f9 Test that -Wauto-var-id fires in value-dependent contexts.
There was already a test that it did not fire in type-dependent contexts.
This was already behaving correctly.

llvm-svn: 158530
2012-06-15 18:19:43 +00:00
Jordan Rose d8d5669435 Warn in ObjC++ when an 'auto' variable deduces type 'id'.
This could happen for cases like this:

- (NSArray *)getAllNames:(NSArray *)images {
  NSMutableArray *results = [NSMutableArray array];
  for (auto img in images) {
    [results addObject:img.name];
  }
  return results;
}

Here the property access will fail because 'img' has type 'id', rather than,
say, NSImage.

This warning will not fire in templated code, since the 'id' could have
come from a template parameter.

llvm-svn: 158239
2012-06-08 22:46:07 +00:00
Argyrios Kyrtzidis 8e6951d81b Allow objc @() syntax for enum types.
Previously we would reject it as illegal using a value of
enum type and on ObjC++ it was illegal to use an enumerator
as well.

rdar://11454917

llvm-svn: 156843
2012-05-15 19:17:44 +00:00
Eli Friedman 169ec35bb3 Add a missing RequireCompleteType call when synthesizing properties. <rdar://problem/11333367>.
While I'm here, fix source locations for other diagnostics related to property synthesis.

llvm-svn: 155953
2012-05-01 22:26:06 +00:00
Douglas Gregor 205b068975 HandleDeclarator() returns NULL for semantic disasters. Deal with it
when we're in an Objective-C container context. Fixes
<rdar://problem/11286701>.

llvm-svn: 155836
2012-04-30 18:13:01 +00:00
Douglas Gregor 39f39ff4b7 Teach RequireCompleteType about multi-dimensional arrays. Fixes
<rdar://problem/11284902>.

llvm-svn: 155356
2012-04-23 16:42:52 +00:00
Fariborz Jahanian 29898f4565 objective-c modern translator: buildit objc bool
type for rewriter project will be BoolTy.
// rdar://11231426. 

llvm-svn: 154861
2012-04-16 21:03:30 +00:00
Douglas Gregor eba02fecdd super and class property reference expressions don't need to be
rebuilt. Fixes <rdar://problem/11052352>. 

llvm-svn: 154667
2012-04-13 15:53:08 +00:00
Fariborz Jahanian 30c3de97a9 objective-c numeric literal: type of boolean is
that of typedef BOOL if found.
// rdar://11231426

llvm-svn: 154595
2012-04-12 17:49:18 +00:00
Patrick Beard acfbe9e1f2 Added a new attribute, objc_root_class, which informs the compiler when a root class is intentionally declared.
The warning this inhibits, -Wobjc-root-class, is opt-in for now. However, all clang unit tests that would trigger
the warning have been updated to use -Wno-objc-root-class. <rdar://problem/7446698>

llvm-svn: 154187
2012-04-06 18:12:22 +00:00
John McCall 67cd5e094e Forbid the block and lambda copy-capture of __autoreleasing variables
in ARC, under the usual reasoning limiting the use of __autoreleasing.

llvm-svn: 153725
2012-03-30 05:23:48 +00:00
Fariborz Jahanian e798ba4b67 Fix typo in my last patch.
llvm-svn: 153602
2012-03-28 21:13:53 +00:00
Fariborz Jahanian ba0afde486 objective-c: Improve diagnostics and
provide 'fixit' hint when dictionary index 
is not of proper type. // rdar://11062080

llvm-svn: 153584
2012-03-28 17:56:49 +00:00
Fariborz Jahanian c8a322a407 lldb support: under debugger support flag, when sending message
to forward class, and assigning to an 'id' type var, message
sends default to 'id'. // rdar"//10988847

llvm-svn: 152420
2012-03-09 18:47:16 +00:00
John McCall ef42902816 Perform l2r conversions on delete operands before doing
type-analysis;  otherwise, we just completely do the
wrong thing for placeholders.

llvm-svn: 152375
2012-03-09 04:08:29 +00:00
Ted Kremenek e65b086e07 Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,
NSNumber, and boolean literals.  This includes both Sema and Codegen support.
Included is also support for new Objective-C container subscripting.

My apologies for the large patch.  It was very difficult to break apart.
The patch introduces changes to the driver as well to cause clang to link
in additional runtime support when needed to support the new language features.

Docs are forthcoming to document the implementation and behavior of these features.

llvm-svn: 152137
2012-03-06 20:05:56 +00:00
Fariborz Jahanian 86f8266b9f objective-c++: Type of an objc string literal is NSString, not 'id'.
// rdar://10907410

llvm-svn: 151296
2012-02-23 22:51:36 +00:00
Douglas Gregor 36107ade6f In Objective-C++, allow the keyword 'class' to be used as a property
name for dot syntax, e.g., NSObject.class or foo.class. For other
C++-keywords-as-method-names, use message send syntax. Fixes
<rdar://problem/10794452>.

llvm-svn: 150710
2012-02-16 18:19:22 +00:00
John McCall 5ece54ce3f Only complain about __strong __strong id, not __strong SomeStrongTypedef
or __strong __typeof__(some.strong.thing).

llvm-svn: 150029
2012-02-08 00:46:41 +00:00
Sean Callanan 8870a32408 Fixed some testsuite problems introduced by my
last commit.  Sorry for the outage.

llvm-svn: 149744
2012-02-04 02:28:18 +00:00
Chad Rosier d1956e46dd [frontend] Don't allow a mapping to a warning override an error/fatal mapping.
rdar://10736625

llvm-svn: 149662
2012-02-03 01:49:51 +00:00
Fariborz Jahanian 30febeb224 Look for declaration of CFBridgingRetain/CFBridgingRetain before
changing the diagnostic. Also use correct spelling for both.

llvm-svn: 149554
2012-02-01 22:56:20 +00:00
Fariborz Jahanian bcdc282d85 objc-arc: In various diagnostics mention
CFBridgingRetain/CFBridgingRelease calls instead
of __bridge_retained/__bridge_transfer casts as preferred
way of moving cf objects to arc land. // rdar://10207950

llvm-svn: 149449
2012-01-31 23:42:37 +00:00
Fariborz Jahanian e2a7776eff objc: Issue a generic diagnostic assigning to
an objc object in any abi mode.

llvm-svn: 148847
2012-01-24 19:40:13 +00:00
Fariborz Jahanian 3c4225a858 objc: issue error if assigning objects in fragile-abi too.
// rdar://10731065

llvm-svn: 148823
2012-01-24 18:05:45 +00:00
Sebastian Redl 09edce0400 Minor fixups for auto deduction of initializer lists.
Fix some review comments.
Add a test for deduction when std::initializer_list isn't available yet.
Fix redundant error messages. This fixes and outstanding FIXME too.

llvm-svn: 148735
2012-01-23 22:09:39 +00:00
Fariborz Jahanian 28324b0066 objc: deprecate direct usage of 'isa' of objc objects
in favor of usage of api's intended for.
// rdar://8290002

llvm-svn: 148404
2012-01-18 19:08:56 +00:00
Eli Friedman fbc0dff6f8 Fix a couple issues where we didn't correctly delay diagnostics in PotentiallyPotentiallyEvaluated contexts. In preparation for making sizeof() PotentiallyPotentiallyEvaluated.
llvm-svn: 148367
2012-01-18 01:05:54 +00:00
Douglas Gregor ccff301bfe Reinstate test case accidentally reverted by r148028
llvm-svn: 148118
2012-01-13 16:56:26 +00:00