summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Converts the lockable attributes to use the simple attribute handler because ↵Aaron Ballman2013-11-271-33/+2
| | | | | | the semantic checking was already automated. llvm-svn: 195866
* Automated checking for C++ when determining what argument to send to the ↵Aaron Ballman2013-11-271-16/+0
| | | | | | diagnostic for attribute subjects. In turn, this allows the Subjects to be enabled for some more attributes and improves diagnostics. Updated a test case based on the improved diagnostic. llvm-svn: 195864
* Adding the Subjects entry back for the noreturn attributes. This caused some ↵Aaron Ballman2013-11-271-19/+1
| | | | | | test cases to be updated because the original diagnostic was about applying to methods as well as functions, but the semantic checking disallowed methods. llvm-svn: 195862
* Enabling the subject list for the warn_unused attribute, and adding a test ↵Aaron Ballman2013-11-271-9/+1
| | | | | | case. Previously, would issue a "warning ignored" diagnostic instead of the more specific "only applies to." llvm-svn: 195851
* Adding in the subject for the init_priority attribute.Aaron Ballman2013-11-271-2/+2
| | | | llvm-svn: 195850
* Refactored semantic handlers that would unilaterally apply the attribute to ↵Aaron Ballman2013-11-271-161/+36
| | | | | | a Decl so they all go through a common interface. No functional change intended. llvm-svn: 195848
* Trivial fix: remove unused variableAlexander Kornienko2013-11-271-1/+0
| | | | llvm-svn: 195846
* Laying the basic groundwork for table generating the diagnostics for ↵Aaron Ballman2013-11-272-371/+39
| | | | | | | | | | | | attribute subjects. This makes some modifications to the way subjects are listed in Attr.td, and updates the attr emitter to handle the new constructs. I have disabled some attribute subject lines on purpose in Attr.td; this part is a WIP with the goal being to restore those subjects incrementally. By commenting them out, it leaves the original behavior the same as before for those attributes and so those are not functionality changes. llvm-svn: 195841
* [Sema] Don't look for the instantiation of a local extern decl in a differentArgyrios Kyrtzidis2013-11-271-1/+3
| | | | | | | | dependent context that the one we are instantiating, otherwise there will be an assertion. rdar://15464547 llvm-svn: 195828
* Sema: Instantiate local class and their members appropriatelyDavid Majnemer2013-11-273-14/+47
| | | | | | | | | | | We would fail to instantiate them when the surrounding function was instantiated. Instantiate the class and add it's members to the list of pending instantiations, they should be resolved when we are finished with the function's body. This fixes PR9685. llvm-svn: 195827
* Remove a whole lot of unused variablesAlp Toker2013-11-277-17/+3
| | | | | | | There are about 30 removed in this patch, generated by a new FixIt I haven't got round to submitting yet. llvm-svn: 195814
* Unify lookup from within not-yet-defined defaulted special members: use commonRichard Smith2013-11-271-47/+64
| | | | | | | code for handling triviality, deletedness and constexpr. Fix a few bugs in these, particularly related to mutable members, and remove some dead code. llvm-svn: 195809
* Implement -Wold-style-castAlp Toker2013-11-271-0/+4
| | | | | | Based on a patch by Ondřej Hošek! llvm-svn: 195808
* Remove 'DistinctSpellings' support from Attr.td and change its only user toRichard Smith2013-11-271-26/+21
| | | | | | | | look at the attribute spelling instead. The 'ownership_*' attributes should probably be split into separate *Attr classes, but that's more than I wanted to do here. llvm-svn: 195805
* Replacing a custom diagnostic with a more standard one. No functional change ↵Aaron Ballman2013-11-261-3/+4
| | | | | | intended. llvm-svn: 195770
* PR18044: Reject declarations of enumtype::X early to avoid an assertion inRichard Smith2013-11-251-1/+1
| | | | | | downstream code. llvm-svn: 195687
* Making type_tag_for_datatype consistent with its declared subject from ↵Aaron Ballman2013-11-251-0/+6
| | | | | | | | Attr.td. Also updated the related testcase. Reviewed by Dmitri Gribenko. llvm-svn: 195675
* Take cv-qualifiers on fields of class type into account when determiningRichard Smith2013-11-251-0/+4
| | | | | | whether a defaulted special member function should be deleted. llvm-svn: 195620
* SemaDeclAttr.cpp: Try to fix a warning [-Wunnamed-type-template-args]NAKAMURA Takumi2013-11-251-1/+1
| | | | llvm-svn: 195589
* Switching the common attribute over to using the generic diagnostic, and ↵Aaron Ballman2013-11-241-1/+2
| | | | | | removing the now-unused diagnostic. Updates a test case. llvm-svn: 195581
* __declspec(uuid) is only supported for C++ code according to MSDN (as well ↵Aaron Ballman2013-11-241-0/+14
| | | | | | 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. llvm-svn: 195580
* __declspec(uuid) is only allowed on a class according to MSDN; this makes ↵Aaron Ballman2013-11-241-0/+6
| | | | | | the semantic checking consistent with what the attribute specifies in Attr.td. Also adds a test case. llvm-svn: 195579
* Making some attribute diagnostics more consistent. Removes a newly-unused ↵Aaron Ballman2013-11-241-1/+7
| | | | | | | | diagnostic. Reviewed by Fariborz Jahanian llvm-svn: 195578
* Remove optional parameter bit from attribute ObjCSuppressProtocol.Ted Kremenek2013-11-231-2/+1
| | | | | | This refines some diagnostics and reduces some boilerplate checking logic. llvm-svn: 195560
* Add back experimental attribute objc_suppress_protocol_methods (slightly ↵Ted Kremenek2013-11-232-3/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 195533
* Change ObjCIntefaceDecl::lookupMethod() to have optional 'followsSuper' ↵Ted Kremenek2013-11-231-6/+17
| | | | | | | | | | | | | | 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. llvm-svn: 195532
* ObjectiveC. Remove warning diagnostic which checksFariborz Jahanian2013-11-231-67/+0
| | | | | | | | | | | | | | 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 llvm-svn: 195524
* Whitespace. No functional change intended.Aaron Ballman2013-11-221-4/+4
| | | | llvm-svn: 195503
* Add class-specific operator new to Decl hierarchy. This guarantees that DeclsRichard Smith2013-11-222-9/+5
| | | | | | | | | | | | | 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. No functionality change intended. llvm-svn: 195426
* ObjectiveC migrator. Improve on definition, useFariborz Jahanian2013-11-221-6/+2
| | | | | | | | and testing of objc_bridgmutable attribute per Aaron Ballman's comments. // rdar://15498044 llvm-svn: 195396
* PR18013: Don't assert diagnosing a bad std::initializer_list construction.Richard Smith2013-11-211-7/+25
| | | | llvm-svn: 195384
* ObjectiveC. Implement attribute 'objc_bridge_mutable'Fariborz Jahanian2013-11-212-11/+47
| | | | | | | | whose semantic is currently identical to objc_bridge, but their differences may manifest down the road with further enhancements. // rdar://15498044 llvm-svn: 195376
* Revert "Add new attribute 'objc_suppress_protocol' to suppress protocol ↵Ted Kremenek2013-11-212-37/+5
| | | | | | | | | | | 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. llvm-svn: 195328
* Add new attribute 'objc_suppress_protocol' to suppress protocol conformance ↵Ted Kremenek2013-11-212-5/+37
| | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 195323
* Refactor some of handleObjCBridgeAttr to make it more concise and the ↵Ted Kremenek2013-11-211-8/+7
| | | | | | diagnostic reusable. llvm-svn: 195322
* Provide better diagnostic wording for initializers on staticHans Wennborg2013-11-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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; ^ Differential Revision: http://llvm-reviews.chandlerc.com/D2235 llvm-svn: 195306
* PR10837: Warn if a null pointer constant is formed by a zero integer constantRichard Smith2013-11-211-6/+8
| | | | | | | expression that is not a zero literal, in C. This is a different, and more targeted, approach than that in r194540. llvm-svn: 195303
* Refactored integer argument checking code into a helper method. Removes a ↵Aaron Ballman2013-11-211-111/+61
| | | | | | considerable amount of duplicated code. llvm-svn: 195302
* ObjectiveC. Allow toll free bridge cast warnings outsideFariborz Jahanian2013-11-212-9/+17
| | | | | | | ARC and in objectiveC/ObjectiveC++ MRR mode as well. // rdar://15454846 llvm-svn: 195288
* Implemented DefaultIntArgument in the table generator and start using it in ↵Aaron Ballman2013-11-211-4/+4
| | | | | | semantic analysis. Removes some magic numbers. llvm-svn: 195287
* ObjectiveC ARC. warn in presense of __bridge casting to Fariborz Jahanian2013-11-201-0/+9
| | | | | | or from a toll free bridge cast. // rdar://15454846 llvm-svn: 195278
* There is no such thing as __declspec(ms_struct), this is a GNU attribute. ↵Aaron Ballman2013-11-201-1/+2
| | | | | | 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. llvm-svn: 195277
* Removed a duplicate diagnostic related to attribute subjects for thread ↵Aaron Ballman2013-11-201-28/+22
| | | | | | 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. llvm-svn: 195275
* Refine 'deprecated' checking for Objective-C classes/methods.Ted Kremenek2013-11-202-1/+19
| | | | | | | | | - If a deprecated class refers to another deprecated class, do not warn. - @implementations of a deprecated class can refer to other deprecated things. Fixes <rdar://problem/15407366> and <rdar://problem/15466783>. llvm-svn: 195259
* When wrapping lazily generated builtins in an extern "C" context,Enea Zaffanella2013-11-201-0/+1
| | | | | | flag the LinkageSpecDecl as being implicitly generated too. llvm-svn: 195255
* Removing a custom error diagnostic and replacing it with a stock one. Added ↵Aaron Ballman2013-11-201-2/+4
| | | | | | a test case to ensure the diagnostic was firing properly. llvm-svn: 195188
* ObjectiveC ARC. validate toll free bridge castingFariborz Jahanian2013-11-201-5/+23
| | | | | | | to or from 'id' and qualified-id types. // rdar://15454846 llvm-svn: 195178
* PR9547: If we're parsing a simple-declaration that contains a tag definition,Richard Smith2013-11-192-4/+9
| | | | | | | | 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. llvm-svn: 195163
* Switching some string literals to be generated by the AttributeList object ↵Aaron Ballman2013-11-191-5/+5
| | | | | | itself. llvm-svn: 195160
* Further fixes when thiscall is the default for methods.Rafael Espindola2013-11-193-162/+153
| | | | | | | | | | | | | | | | | | The previous patches tried to deduce the correct function type. I now realize this is not possible in general. Consider class foo { template <typename T> static void bar(T v); }; extern template void foo::bar(const void *); We will only know that bar is static after a lookup, so we have to handle this in the template instantiation code. This patch reverts my previous two changes (but not the tests) and instead handles the issue in DeduceTemplateArguments. llvm-svn: 195154
OpenPOWER on IntegriCloud