Commit Graph

708 Commits

Author SHA1 Message Date
David Blaikie 82e95a3c79 Update for LLVM API change to make Small(Ptr)Set::insert return pair<iterator, bool> as per the C++ standard's associative container concept.
llvm-svn: 222335
2014-11-19 07:49:47 +00:00
Fariborz Jahanian c62d16f304 Objective-C. Fixes a regression caused by implementation
of new warning for deprecated method call for receiver
of type 'id'. This addresses rdar://18960378 where
unintended warnings being issued.

llvm-svn: 221933
2014-11-13 22:27:05 +00:00
Kaelyn Takata 89c881b548 Pass around CorrectionCandidateCallbacks as unique_ptrs so
TypoCorrectionConsumer can keep the callback around as long as needed.

llvm-svn: 220693
2014-10-27 18:07:29 +00:00
Fariborz Jahanian 78e9debf68 Objective-C. Warn if user has made explicit call
to +initilize as this results in an extra call
to this method. rdar://16628028

llvm-svn: 216271
2014-08-22 16:57:26 +00:00
Fariborz Jahanian 30ae8d4413 Objective-C. This patch is to resolve the method used in method
expression to the best method found in global method pools. 
This is wip.  // rdar://16808765

llvm-svn: 215577
2014-08-13 21:07:35 +00:00
Aaron Ballman 41b10ac3b7 Replacing some more complex logic with a helper function call to ObjCMethod::getReturnTypeSourceRange. No functional changes intended.
llvm-svn: 214511
2014-08-01 13:20:09 +00:00
David Majnemer 34b5749989 MS ABI: Consider alignment attributes on typedefs for layout
The MS ABI has a notion of 'required alignment' for fields; this
alignment supercedes pragma pack directives.

MSVC takes into account alignment attributes on typedefs when
determining whether or not a field has a certain required alignment.

Do the same in clang by tracking whether or not we saw such an attribute
when calculating the type's bitwidth and alignment.

This fixes PR20418.

Reviewers: rnk

Differential Revision: http://reviews.llvm.org/D4714

llvm-svn: 214274
2014-07-30 01:30:47 +00:00
Alp Toker d4a3f0e894 Hide the concept of diagnostic levels from lex, parse and sema
The compilation pipeline doesn't actually need to know about the high-level
concept of diagnostic mappings, and hiding the final computed level presents
several simplifications and other potential benefits.

The only exceptions are opportunistic checks to see whether expensive code
paths can be avoided for diagnostics that are guaranteed to be ignored at a
certain SourceLocation.

This commit formalizes that invariant by introducing and using
DiagnosticsEngine::isIgnored() in place of individual level checks throughout
lex, parse and sema.

llvm-svn: 211005
2014-06-15 23:30:39 +00:00
Craig Topper c3ec149bb2 [C++11] Use 'nullptr'. Sema edition.
llvm-svn: 209613
2014-05-26 06:22:03 +00:00
Alp Toker b6cc592ea3 Fix a bunch of mislayered clang/Lex includes from Sema
llvm-svn: 207896
2014-05-03 03:45:55 +00:00
John Thompson 2255f2ce90 Initial implementation of -modules-earch-all option, for searching for symbols in non-imported modules.
llvm-svn: 206977
2014-04-23 12:57:01 +00:00
Fariborz Jahanian ec762bda73 Objective-C. Fixes a bogus warning on unimplemented
selectors because we were not going through entire
elements in list of all implemented selectors. 
// rdar://16428638

llvm-svn: 204852
2014-03-26 20:59:26 +00:00
Fariborz Jahanian ed39e7cfeb Objective-C. Better fix for my previous patch
"No need to issue deprecated warning if deprecated method 
in class extension is being implemented in primary class implementation
(no overriding is involved).
// rdar://16249335". No functionality change.

llvm-svn: 204159
2014-03-18 16:25:22 +00:00
Fariborz Jahanian 19a08bbb9a Objective-C. No need to issue deprecated warning if deprecated method
in class extension is being implemented in primary class implementation
(no overriding is involved).
// rdar://16249335

llvm-svn: 204093
2014-03-18 00:10:37 +00:00
Fariborz Jahanian 83d674e007 Objective-C. Do not warn when an instance method and
class method with the same selctor but different argument 
types having one of them in class extension.
// rdar://16312105

llvm-svn: 204065
2014-03-17 17:46:10 +00:00
Aaron Ballman 1683f7baf6 [C++11] Replacing ObjCObjectType iterators qual_begin() and qual_end() with iterator_range quals(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 204047
2014-03-17 15:55:30 +00:00
Fariborz Jahanian e3b5c99fde Objective-C. Redo turning off designated initialization warnings on
'init' methods which are unavailable. Subclasses of NSObject
have to implement such methods as a common pattern to prevent
user's own implementation. // rdar://16305460

llvm-svn: 203984
2014-03-14 23:30:18 +00:00
Fariborz Jahanian 312104a716 Objective-C. Turn off designated initialization warnings on
'init' methods which are unavailable. Subclasses of NSObject
have to implement such methods as a common pattern to prevent
user's own implementation. // rdar://16305460

llvm-svn: 203966
2014-03-14 20:35:00 +00:00
Aaron Ballman 19a417699f [C++11] Replacing ObjCCategoryDecl iterators protocol_begin() and protocol_end() with iterator_range protocols(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203922
2014-03-14 12:55:57 +00:00
Aaron Ballman 0f6e64d505 [C++11] Replacing ObjCProtocolDecl iterators protocol_begin() and protocol_end() with iterator_range protocols(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203863
2014-03-13 22:58:06 +00:00
Aaron Ballman f53d8dd37d [C++11] Replacing ObjCInterfaceDecl iterators visible_extensions_begin() and visible_extensions_end() with iterator_range visible_extensions(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203855
2014-03-13 21:47:07 +00:00
Aaron Ballman 15063e19c6 [C++11] Replacing ObjCInterfaceDecl iterators known_categories_begin() and known_categories_end() with iterator_range known_categories(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203854
2014-03-13 21:35:02 +00:00
Aaron Ballman 3fe486a332 [C++11] Replacing ObjCInterfaceDecl iterators visible_categories_begin() and visible_categories_end() with iterator_range visible_categories(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203851
2014-03-13 21:23:55 +00:00
Aaron Ballman 59abbd4d9b [C++11] Replacing ObjCInterfaceDecl iterators ivar_begin() and ivar_end() with iterator_range ivars(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203849
2014-03-13 21:09:43 +00:00
Aaron Ballman a9f49e394c [C++11] Replacing ObjCInterfaceDecl iterators all_referenced_protocol_begin() and all_referenced_protocol_end() with iterator_range all_referenced_protocols(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203848
2014-03-13 20:55:22 +00:00
Aaron Ballman e8a7dc9889 [C++11] Replacing ObjCContainerDecl iterators classmeth_begin() and classmeth_end() with iterator_range class_methods(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203840
2014-03-13 20:11:06 +00:00
Aaron Ballman f26acce6f7 [C++11] Replacing ObjCContainerDecl iterators instmeth_begin() and instmeth_end() with iterator_range instance_methods(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203839
2014-03-13 19:50:17 +00:00
Aaron Ballman d174edffa0 Renaming the recently-created (r203830) props() range API to properties() for clarity.
llvm-svn: 203835
2014-03-13 19:11:50 +00:00
Aaron Ballman aff18c0446 [C++11] Replacing ObjCContainerDecl iterators meth_begin() and meth_end() with iterator_range methods(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203832
2014-03-13 19:03:34 +00:00
Aaron Ballman dc4bea4676 [C++11] Replacing ObjCContainerDecl iterators prop_begin() and prop_end() with iterator_range props(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203830
2014-03-13 18:47:37 +00:00
Craig Topper e14c0f8e73 [C++11] Add 'override' keyword to virtual methods that override their base class.
llvm-svn: 203640
2014-03-12 04:55:44 +00:00
Fariborz Jahanian bf678e82e1 Objective-C. Diagose use of undefined protocols
when a class adopts a protocol that inherits from 
undefined protocols. // rdar://16111182

llvm-svn: 203586
2014-03-11 17:10:51 +00:00
Ahmed Charles af94d56b56 [C++11] Remove the remaining uses of OwningPtr.
Replace OwningArrayPtr with std::unique_ptr<T[]>.

llvm-svn: 203388
2014-03-09 11:34:25 +00:00
Aaron Ballman 43b68bebe7 [C++11] Replacing ObjCMethodDecl iterators param_begin() and param_end() with iterator_range params(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203255
2014-03-07 17:50:17 +00:00
Ted Kremenek 760a2acbb5 Fix recursion bug in logic to validate 'objc_protocol_requires_explicit_implementation' conformance.
llvm-svn: 203024
2014-03-05 23:18:22 +00:00
Ted Kremenek 4b3c66e6e8 Adjust logic for 'objc_protocol_requires_explicit_implementation' for inherited protocols and protocols already conformed in the class hierarchy.
Per more discussion, 'objc_protocol_requires_explicit_implementation' is
refinement that it mainly adds that requirement that a protocol must be
explicitly satisfied at the moment the first class in the class hierarchy
conforms to it.  Any subclasses that also conform to that protocol,
either directly or via conforming to a protocol that inherits that protocol,
do not need to re-implement that protocol.

Doing this requires first doing a pass on the super class hierarchy,
gathering the set of protocols conformed to by the super classes,
and then culling those out when determining conformance.  This
two-pass algorithm could be generalized for all protocol checking,
and could possibly be a performance win in some cases.  For now
we restrict this change to protocols with this attribute to isolate
the change in logic (especially as the design continues to evolve).

This change needs to be adjusted for properties as well; this
only impacts methods right now.

llvm-svn: 202948
2014-03-05 08:13:08 +00:00
Ted Kremenek 348e88c36a [ObjC] Change default property synthesis logic to not completely skip DiagnoseUnimplementedProperties.
We're going to extend DiagnoseUnimplementedProperties shortly to look for more cases
that aren't handled by default property synthesis.

llvm-svn: 201878
2014-02-21 19:41:34 +00:00
Fariborz Jahanian f40ef45c9d Objective-C. Fixes a bug where "new" family attribute
was not being overridden in the category method implementation
resulting in bogus warning. // rdar://15919775

llvm-svn: 200342
2014-01-28 22:46:29 +00:00
Fariborz Jahanian 122d94fd61 ObjectiveC. Fixes a bug in recognition of an ivar
backing a property resulting in bogus warning.
// rdar://15890251

llvm-svn: 200254
2014-01-27 22:27:43 +00:00
Alp Toker 314cc81b8c Rename getResultType() on function and method declarations to getReturnType()
A return type is the declared or deduced part of the function type specified in
the declaration.

A result type is the (potentially adjusted) type of the value of an expression
that calls the function.

Rule of thumb:

  * Declarations have return types and parameters.
  * Expressions have result types and arguments.

llvm-svn: 200082
2014-01-25 16:55:45 +00:00
Fariborz Jahanian dad9630398 ObjectiveC. When issuing property implementation is
not using backing ivar warning, ignore when
property is not being synthesized (user declared its
implementation @dynamic). // rdar://1583425

llvm-svn: 199820
2014-01-22 19:02:20 +00:00
Aaron Ballman 36a5350e51 Distinguish between attributes explicitly written at the request of the user, and attributes implicitly generated to assist in bookkeeping by the compiler. This is done so by table generating a CreateImplicit method for each attribute.
Additionally, remove the optional nature of the spelling list index when creating attributes. This is supported by table generating a Spelling enumeration when the spellings for an attribute are distinct enough to warrant it.

llvm-svn: 199378
2014-01-16 13:03:14 +00:00
Fariborz Jahanian 26cb6d90b8 ObjectiveC. Remove warning on mismatched methods
which may belong to unrelated classes. It was
primarily intended for miuse of @selector expression.
But warning is too noisy and will be issued when
an actual @selector is used. // rdar://15740134

llvm-svn: 198952
2014-01-10 19:27:21 +00:00
Argyrios Kyrtzidis 98045c1a23 Fix 80 col violation.
llvm-svn: 198444
2014-01-03 19:53:09 +00:00
Argyrios Kyrtzidis d8a35325a2 Pass the decl directly to the diagnostic, no need to call getDeclName().
llvm-svn: 198442
2014-01-03 19:39:23 +00:00
Argyrios Kyrtzidis 2080d90f37 [objc] Refactor and improve functionality for the -Wunused-property-ivar warning.
- Remove the additions to ObjCMethodDecl & ObjCIVarDecl that were getting de/serialized and consolidate
  all functionality for the checking for this warning in Sema::DiagnoseUnusedBackingIvarInAccessor
- Don't check immediately after the method body is finished, check when the @implementation is finished.
  This is so we can see if the ivar was referenced by any other method, even if the method was defined after the accessor.
- Don't silence the warning if any method is called from the accessor silence it if the accessor delegates to another method via self.

rdar://15727325

llvm-svn: 198432
2014-01-03 18:32:18 +00:00
Fariborz Jahanian 5b3105d2cb ObjectiveC. Remove false positive warning for missing property
backing ivar by not issuing this warning if ivar is referenced
somewhere and accessor makes method calls. // rdar://15727325

llvm-svn: 198367
2014-01-02 22:42:09 +00:00
Fariborz Jahanian 1cc7ae1d08 ObjectiveC. Class methods must be ignored when looking for
property accessor's missing backing ivar. This eliminates
the bogus warning being issued. // rdar://15728901

llvm-svn: 198322
2014-01-02 17:24:32 +00:00
Fariborz Jahanian 1b30b593ba ObjectiveC. typo fix in my last patch,
per Jordan's review. 

llvm-svn: 197540
2013-12-18 00:52:54 +00:00
Fariborz Jahanian 7e350d23b2 Objctive-C. warn if dealloc is being overridden in
a category implementation. // rdar://15397430

llvm-svn: 197534
2013-12-17 22:44:28 +00:00