summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Automatic Reference Counting.John McCall2011-06-151-18/+222
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Don't add redundant FormatAttr, ConstAttr, or NoThrowAttr attributes,Douglas Gregor2011-06-151-2/+5
| | | | | | | either imlicitly (for builtins) or explicitly (due to multiple specification of the same attributes). Fixes <rdar://problem/9612060>. llvm-svn: 133045
* fix rdar://9204520 - Accept int(0.85 * 10) as an initializer in a class memberChris Lattner2011-06-141-9/+17
| | | | | | as an extension. llvm-svn: 132980
* Make __gnu_inline__ functions in gnu99 mode work the same way as inline ↵Eli Friedman2011-06-131-1/+2
| | | | | | | | functions in gnu89 mode in terms of redefinitions. rdar://9559708 . llvm-svn: 132953
* Don't assert on initialized typedef declarations in classes:Richard Smith2011-06-121-6/+2
| | | | | | | | | | | | struct { typedef int A = 0; }; According to the C++11 standard, this is not ill-formed, but does not have any ascribed meaning. We can't reasonably accept it, so treat it as ill-formed. Also switch C++ from an incorrect 'fields can only be initialized in constructors' diagnostic for this case to C's 'illegal initializer (only variables can be initialized)' llvm-svn: 132890
* Implement support for C++11 in-class initialization of non-static data members.Richard Smith2011-06-111-20/+22
| | | | llvm-svn: 132878
* Implement Objective-C Related Result Type semantics.Douglas Gregor2011-06-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related result types apply Cocoa conventions to the type of message sends and property accesses to Objective-C methods that are known to always return objects whose type is the same as the type of the receiving class (or a subclass thereof), such as +alloc and -init. This tightens up static type safety for Objective-C, so that we now diagnose mistakes like this: t.m:4:10: warning: incompatible pointer types initializing 'NSSet *' with an expression of type 'NSArray *' [-Wincompatible-pointer-types] NSSet *array = [[NSArray alloc] init]; ^ ~~~~~~~~~~~~~~~~~~~~~~ /System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:72:1: note: instance method 'init' is assumed to return an instance of its receiver type ('NSArray *') - (id)init; ^ It also means that we get decent type inference when writing code in Objective-C++0x: auto array = [[NSMutableArray alloc] initWithObjects:@"one", @"two",nil]; // ^ now infers NSMutableArray* rather than id llvm-svn: 132868
* Made changes to how 'struct'/'class' mismatches are handled in ↵Richard Trieu2011-06-101-8/+62
| | | | | | | | | | | | | | | | | -Wmismatched-tags. - Removed fix-it hints from template instaniations since changes to the templates are rarely helpful. - Changed the caret in template instaniations from the class/struct name to the class/struct keyword, matching the other warnings. - Do not offer fix-it hints when multiple declarations disagree. Warnings are still given. - Once a definition is found, offer a fix-it hint to all previous declarations with wrong tag. - Declarations that disagree with a previous definition will get a fix-it hint to change the declaration. llvm-svn: 132831
* More coherent diagnostic when a stack variable isFariborz Jahanian2011-06-071-2/+6
| | | | | | declared __weak objc-gc mode. // rdar://9666091. llvm-svn: 132731
* Diagnose the condition in C++ [temp.expl.spec]p16 that prohibitsDouglas Gregor2011-06-061-3/+5
| | | | | | | specializing a member of an unspecialized template, and recover from such errors without crashing. Fixes PR10024 / <rdar://problem/9509761>. llvm-svn: 132677
* Revert r132544. Accidental commit. I got confused with the Tortoise SVN menu.Francois Pichet2011-06-031-1/+1
| | | | llvm-svn: 132546
* (no commit message)Francois Pichet2011-06-031-1/+1
| | | | llvm-svn: 132544
* Correctly revert r131347: function explicit specialization at class scope.Francois Pichet2011-06-031-1/+1
| | | | | | I'll try to implement this functionality again soon. llvm-svn: 132536
* Implement -fgnu89-inline. Fixes PR10041.Rafael Espindola2011-06-021-1/+1
| | | | llvm-svn: 132460
* Microsoft friend acting as a forward declaration; try#2. Now only 2 lines.Francois Pichet2011-06-011-3/+7
| | | | llvm-svn: 132387
* Revert 132332 (Microsoft friend as a forward declaration), John McCall ↵Francois Pichet2011-05-311-39/+0
| | | | | | pointed out a better/simpler way to do it. llvm-svn: 132369
* Recreate the DeclContext before adding the implicit friend forward ↵Francois Pichet2011-05-311-0/+2
| | | | | | declaration. This should fix the asserting buildbot. llvm-svn: 132333
* For compatibility with MSVC, a friend declaration also act as a forward ↵Francois Pichet2011-05-311-0/+37
| | | | | | | | | | | | | | declaration if the tag name is not already declared. The tag name is declared in the next outermost non record scope. Example: class A { friend class B; B* b; }; B* global_b; llvm-svn: 132332
* Clean up my changes to jump-diagnostic handling for local variables ofDouglas Gregor2011-05-271-1/+1
| | | | | | | | class type (or array thereof), eliminating some redundant checks (thanks Eli!) and adding some tests where the behavior differs in C++98/03 vs. C++0x. llvm-svn: 132218
* Implement a new warning for when adding a default argument to a methodAlexis Hunt2011-05-261-4/+4
| | | | | | | | | makes it into a special member function. This is very bad and can lead to all sorts of nastiness including implicit member functions violating the One Definition Rule. This should probably be made ill-formed in a later version of the standard, but for now we'll just warn. llvm-svn: 132104
* Update our diagnostics to properly account for move operations.Alexis Hunt2011-05-251-5/+6
| | | | llvm-svn: 132096
* Implement a little bit of cleanup and a lot more of the base workAlexis Hunt2011-05-251-1/+17
| | | | | | | | behind implicit moves. We now correctly identify move constructors and assignment operators and update bits on the record correctly. Generation of implicit moves (declarations or definitions) is not yet supported. llvm-svn: 132080
* Implement a new type node, UnaryTransformType, designed to represent aAlexis Hunt2011-05-241-1/+1
| | | | | | | | type that turns one type into another. This is used as the basis to implement __underlying_type properly - with TypeSourceInfo and proper behavior in the face of templates. llvm-svn: 132017
* Implement the initial part of C++0x [expr.const]p2, which specifiesDouglas Gregor2011-05-241-3/+5
| | | | | | | | | | | | that the unevaluated subexpressions of &&, ||, and ? : are not considered when determining whether the expression is a constant expression. Also, turn the "used in its own initializer" warning into a runtime-behavior warning, so that it doesn't fire when a variable is used as part of an unevaluated subexpression of its own initializer. Fixes PR9999. llvm-svn: 131968
* Diagnose the presence of storage-class-specifiers on explicitDouglas Gregor2011-05-211-0/+10
| | | | | | instantiations and specializations. Fixes <rdar://problem/9126453> and PR8700. llvm-svn: 131802
* Teach Sema::ActOnUninitializedDecl() not to try to interpret when oneDouglas Gregor2011-05-211-45/+43
| | | | | | | | should use a constructor to default-initialize a variable. InitializationSequence knows the rules for default initialization, better. Fixes <rdar://problem/8501008>. llvm-svn: 131796
* Introduce Type::isSignedIntegerOrEnumerationType() andDouglas Gregor2011-05-201-6/+6
| | | | | | | | | | | | | Type::isUnsignedIntegerOrEnumerationType(), which are like Type::isSignedIntegerType() and Type::isUnsignedIntegerType() but also consider the underlying type of a C++0x scoped enumeration type. Audited all callers to the existing functions, switching those that need to also handle scoped enumeration types (e.g., those that deal with constant values) over to the new functions. Fixes PR9923 / <rdar://problem/9447851>. llvm-svn: 131735
* Fix PR9941 for out-of-line template destructors too.Sebastian Redl2011-05-201-4/+4
| | | | llvm-svn: 131722
* Fix PR9941 again, this time for templates.Sebastian Redl2011-05-191-2/+4
| | | | llvm-svn: 131640
* Implement __underlying_type for libc++.Alexis Hunt2011-05-191-1/+2
| | | | llvm-svn: 131633
* Reapply r121528, fixing PR9941 by delaying the exception specification check ↵Sebastian Redl2011-05-191-2/+31
| | | | | | for destructors until the class is complete and destructors have been adjusted. llvm-svn: 131632
* Revert r121528 as it breaks a simple testcase, which leads to, amongAlexis Hunt2011-05-181-18/+2
| | | | | | other things, libcxx not building. llvm-svn: 131573
* Implement implicit exception specifications of destructors.Sebastian Redl2011-05-181-2/+18
| | | | llvm-svn: 131528
* Implement the new C++0x rules for non-trivial things in unions so thatAlexis Hunt2011-05-161-3/+7
| | | | | | my defaulted constructor tests stop yelling at me about them. llvm-svn: 131432
* Revert 131347. It asserts if the specialization in within a class template:Francois Pichet2011-05-141-7/+3
| | | | | | | | | | | | template<class U> struct X1 { template<class T> void f(T*); template<> void f(int*) { } }; Won't be so simple. I need to think more about it. llvm-svn: 131362
* In Microsoft mode, allow template function explicit specialization at class ↵Francois Pichet2011-05-141-2/+6
| | | | | | | | | | | | | | scope. Necessary to parse MFC and MSVC standard lib code. Example: struct X { template<class T> void f(T) { } template<> void f(int) { } } llvm-svn: 131347
* Properly parse the 'default' and 'delete' keywords.Alexis Hunt2011-05-121-27/+10
| | | | | | | | | | | | | | | | | They are actually grammatically considered definitions and parsed accordingly. This fixes the outstanding bugs regarding defaulting functions after their declarations. We now really nicely diagnose the following construct (try it!) int foo() = delete, bar; Still todo: Defaulted functions other than default constructors Test cases (including for the above construct) llvm-svn: 131228
* Implement deletion of explicitly defaulted default constructors.Alexis Hunt2011-05-121-31/+7
| | | | | | | We still don't parse out-of-line defaults correctly, which is needed to get the full effect out of this patch. llvm-svn: 131223
* Fix typo in comment.Nick Lewycky2011-05-121-1/+1
| | | | llvm-svn: 131212
* Commit some missing changes to the previous patch.Alexis Hunt2011-05-111-3/+15
| | | | | | This means we get C++0x jump-across-intializer semantics correct. llvm-svn: 131204
* Implement implicit deletion of default constructors.Alexis Hunt2011-05-111-1/+4
| | | | | | | | Yes, I'm aware that the diagnostics are awful. Tests to follow. llvm-svn: 131203
* In Microsoft mode, allow pure specifier (=0) on inline functions declared at ↵Francois Pichet2011-05-111-0/+5
| | | | | | | | | | | | | class scope. This removes 2 errors when parsing MFC code with clang Example: class A { virtual void f() = 0 { } } llvm-svn: 131175
* Re-do R131114 without breaking code.Alexis Hunt2011-05-101-7/+10
| | | | | | | | | I've edited one diagnostic which would print "copy constructor" for copy constructors and "constructor" for any other constructor. If anyone is extremely enamored with this, it can be reinstated with a simple boolean flag rather than calling getSpecialMember, which is inappropriate. llvm-svn: 131143
* Reimplement Sema::MatchTemplateParametersToScopeSpecifier() based onDouglas Gregor2011-05-101-3/+4
| | | | | | | | | | | | | | | | | | the semantic context referenced by the nested-name-specifier rather than the syntactic form of the nested-name-specifier. The previous incarnation was based on my complete misunderstanding of C++ [temp.expl.spec]. The latest C++0x working draft clarifies the requirements here, and this rewrite is intended to follow that. Along the way, improve source location information in the diagnostics. For example, if we report that a specific type needs or doesn't need a 'template<>' header, we dig out that type in the nested-name-specifier and highlight its range. Fixes: PR5907, PR9421, PR8277, PR8708, PR9482, PR9668, PR9877, and <rdar://problem/9135379>. llvm-svn: 131138
* Revert 131114. This fixes PR9884.Rafael Espindola2011-05-101-10/+7
| | | | llvm-svn: 131126
* Further implement defaulting constructors.Alexis Hunt2011-05-101-29/+36
| | | | | | | | | | | | | Focus is on default constructors for the time being. Currently the exception specification and prototype are processed correctly. Codegen might work but in all likelihood doesn't. Note that due to an error, out-of-line defaulting of member functions is currently impossible. It will continue to that until I muster up the courage to admit that I secretly pray to epimetheus and that I need to rework the way default gets from Parse -> Sema. llvm-svn: 131115
* The last of the trivial constructor changes, make CXXSpecialMemberAlexis Hunt2011-05-101-7/+10
| | | | | | reflect our new, more accurate AST. llvm-svn: 131114
* Ignore const/volatile/restrict qualifiers on anonymous structs andDouglas Gregor2011-05-091-0/+18
| | | | | | unions. Fixes PR8326. llvm-svn: 131109
* Extend the tag-ambiguity hack I committed in r130810 for tagDouglas Gregor2011-05-091-4/+2
| | | | | | definitions to also include tag declarations. Fixes PR8151. llvm-svn: 131102
* Rename "hasTrivialConstructor" to "hasTrivialDefaultConstructor" andAlexis Hunt2011-05-091-2/+2
| | | | | | | modify the semantics slightly to accomodate default constructors (I hope). llvm-svn: 131087
OpenPOWER on IntegriCloud