summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix case, apparently some people still build on case sensitiveMike Stump2009-07-231-1/+1
| | | | | | filesystems. llvm-svn: 76824
* Add warning for falling off the end of a function that should return aMike Stump2009-07-221-0/+117
| | | | | | | | | | | | | | | | | | | | | value. This is on by default, and controlled by -Wreturn-type (-Wmost -Wall). I believe there should be very few false positives, though the most interesting case would be: int() { bar(); } when bar does: bar() { while (1) ; } Here, we assume functions return, unless they are marked with the noreturn attribute. I can envision a fixit note for functions that never return normally that don't have a noreturn attribute to add a noreturn attribute. If anyone spots other false positives, let me know! llvm-svn: 76821
* Implement support for out-of-line definitions of the class members of classDouglas Gregor2009-07-221-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | templates, e.g., template<typename T> struct Outer { struct Inner; }; template<typename T> struct Outer<T>::Inner { // ... }; Implementing this feature required some extensions to ActOnTag, which now takes a set of template parameter lists, and is the precursor to removing the ActOnClassTemplate function from the parser Action interface. The reason for this approach is simple: the parser cannot tell the difference between a class template definition and the definition of a member of a class template; both have template parameter lists, and semantic analysis determines what that template parameter list means. There is still some cleanup to do with ActOnTag and ActOnClassTemplate. This commit provides the basic functionality we need, however. llvm-svn: 76820
* Calls to Sema::MatchTemplateParametersToScopeSpecifier should not depend on ↵Douglas Gregor2009-07-221-2/+5
| | | | | | the order of evaluation of their arguments to be correct. llvm-svn: 76804
* "This patch implements the restrictions on union members detailed inDouglas Gregor2009-07-221-0/+181
| | | | | | [class.union]p1", from John McCall! llvm-svn: 76766
* Implement parsing and semantic analysis for out-of-line definitions of staticDouglas Gregor2009-07-221-4/+35
| | | | | | | data members of class templates. We don't instantiate the definitions yet, however. llvm-svn: 76756
* Basic parsing and semantic analysis for out-of-line definitions of theDouglas Gregor2009-07-211-11/+12
| | | | | | | | | | | | | member functions of class templates, e.g., template<typename T> struct X { void f(T); }; template<typename T> X<T>::f(T) { /* ... */ } llvm-svn: 76692
* Patch to accomodate Doug's comment on defaultFariborz Jahanian2009-07-211-4/+7
| | | | | | destruction of base/members for each destructor AST. llvm-svn: 76663
* Diagnose when a destructor uses a unrelated class type as its name.Fariborz Jahanian2009-07-211-0/+10
| | | | llvm-svn: 76577
* Add the location of the tag keyword into TagDecl. From EneaDouglas Gregor2009-07-211-4/+6
| | | | | | Zaffanella, with tweaks from Abramo Bagnara. llvm-svn: 76576
* When a field is variable-sized or is an array with a negative size,Douglas Gregor2009-07-201-1/+0
| | | | | | don't replace the type of the field with 'int', from Enea Zaffanella! llvm-svn: 76454
* Improve GCC compatibility by allowing static tentative definitions ofDouglas Gregor2009-07-201-16/+19
| | | | | | incomplete type (with a warning), from Enea Zaffanella! llvm-svn: 76451
* enhance the goto checker to reject jumps across __block variable definitions.Chris Lattner2009-07-191-1/+2
| | | | llvm-svn: 76376
* Set ObjCMethodDecl's EndLoc to the '}' when it's a definition.Argyrios Kyrtzidis2009-07-181-0/+1
| | | | llvm-svn: 76269
* Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methodsTed Kremenek2009-07-171-3/+3
| | | | | | | | | until Doug Gregor's Type smart pointer code lands (or more discussion occurs). These methods just call the new Type::getAs<XXX> methods, so we still have reduced implementation redundancy. Having explicit getAsXXXType() methods makes it easier to set breakpoints in the debugger. llvm-svn: 76193
* Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), ↵Ted Kremenek2009-07-171-3/+3
| | | | | | Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents. llvm-svn: 76139
* Remove ASTContext::isObjCObjectPointerType().Steve Naroff2009-07-161-1/+1
| | | | | | Convert all clients to use the new predicate on Type. llvm-svn: 76076
* Add a "TypeSpecStartLoc" to FieldDecl. Patch contributed by Enea Zaffanella.Steve Naroff2009-07-141-6/+10
| | | | | Note: One day, it might be useful to consider adding this info to DeclGroup (as the comments in FunctionDecl/VarDecl suggest). For now, I think this works fine. I considered moving this to ValueDecl (a common ancestor of FunctionDecl/VarDecl/FieldDecl), however this would add overhead to EnumConstantDecl (which would burn memory and isn't necessary). llvm-svn: 75635
* Fixes for a couple of things:Argyrios Kyrtzidis2009-07-141-3/+10
| | | | | | | | | - Declaration context of ParmVarDecls (that we got from the Declarator) was not their containing function. - C++ out-of-line method definitions didn't get an access specifier. Both were exposed by a crash when emitting a C++ method to a PCH file (assert at Decl::CheckAccessDeclContext()). llvm-svn: 75597
* Pass the right brace SourceLocation from the Parser to the TagDecls.Argyrios Kyrtzidis2009-07-141-1/+3
| | | | llvm-svn: 75591
* Fix 5 issues from Chris's feedback on ↵Steve Naroff2009-07-131-1/+0
| | | | | | | | http://llvm.org/viewvc/llvm-project?view=rev&revision=75314. Still more to come...just wanted to get the no-brainers out of the way. llvm-svn: 75477
* Implement more of C++0x 'auto'. A variable with an auto type specifier must ↵Anders Carlsson2009-07-111-1/+10
| | | | | | have an initializer. Also, move some tests around to match the C++0x draft better. llvm-svn: 75322
* This patch includes a conceptually simple, but very intrusive/pervasive change. Steve Naroff2009-07-101-6/+6
| | | | | | | | | | | | The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches. This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic. By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time. Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks. llvm-svn: 75314
* Implemented memmove_collectable API for Next runtimeFariborz Jahanian2009-07-081-0/+8
| | | | | | | when struct variables with GC'able members are copied into. Will provide a test case later. llvm-svn: 74984
* Implement checking of exception spec compatibility for overriding virtual ↵Sebastian Redl2009-07-071-1/+2
| | | | | | functions. llvm-svn: 74943
* Tighten up the conditions under which we build an implicit functionDouglas Gregor2009-07-071-3/+6
| | | | | | declaration for a builtin. llvm-svn: 74917
* Make ASTContext explicitly keep track of the declaration for the CDouglas Gregor2009-07-071-0/+15
| | | | | | | | | | | | | | | | | FILE type, rather than using name lookup to find FILE within the translation unit. Within precompiled headers, FILE is treated as yet another "special type" (like __builtin_va_list). This change should provide a performance improvement (not verified), since the lookup into the translation unit declaration forces the (otherwise unneeded) construction of a large hash table. More importantly, with precompiled headers, the construction of that table requires deserializing most of the top-level declarations from the precompiled header, which are then unused. Fixes PR 4509. llvm-svn: 74911
* Keep track of the Expr used to describe the size of an array type,Douglas Gregor2009-07-061-3/+12
| | | | | | from Enea Zaffanella! llvm-svn: 74831
* De-ASTContext-ify DeclContext.Argyrios Kyrtzidis2009-06-301-12/+12
| | | | | | | Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating". Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit. llvm-svn: 74506
* Remove the ASTContext parameter from the getBody() methods of Decl and ↵Argyrios Kyrtzidis2009-06-301-1/+1
| | | | | | | | subclasses. Timings showed no significant difference before and after the commit. llvm-svn: 74504
* Remove the ASTContext parameter from the attribute-related methods of Decl.Argyrios Kyrtzidis2009-06-301-35/+30
| | | | | | | | | The implementations of these methods can Use Decl::getASTContext() to get the ASTContext. This commit touches a lot of files since call sites for these methods are everywhere. I used pre-tokenized "carbon.h" and "cocoa.h" headers to do some timings, and there was no real time difference between before the commit and after it. llvm-svn: 74501
* Renamed MarcDestructorReferenced -> MarkDestructorReferencedFariborz Jahanian2009-06-271-1/+1
| | | | llvm-svn: 74386
* Patch to mark destructors when they are used.Fariborz Jahanian2009-06-261-1/+5
| | | | llvm-svn: 74359
* Improved semantic analysis and AST respresentation for functionDouglas Gregor2009-06-251-11/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | templates. For example, this now type-checks (but does not instantiate the body of deref<int>): template<typename T> T& deref(T* t) { return *t; } void test(int *ip) { int &ir = deref(ip); } Specific changes/additions: * Template argument deduction from a call to a function template. * Instantiation of a function template specializations (just the declarations) from the template arguments deduced from a call. * FunctionTemplateDecls are stored directly in declaration contexts and found via name lookup (all forms), rather than finding the FunctionDecl and then realizing it is a template. This is responsible for most of the churn, since some of the core declaration matching and lookup code assumes that all functions are FunctionDecls. llvm-svn: 74213
* Set the end range location of a FunctionDecl to the right paren.Argyrios Kyrtzidis2009-06-251-0/+3
| | | | llvm-svn: 74195
* Make sure that the template parameter lists get from the parser down to ↵Douglas Gregor2009-06-241-0/+2
| | | | | | ActOnFunctionDeclarator for function template definitions llvm-svn: 74040
* Support for [class.local]p4.Anders Carlsson2009-06-241-0/+9
| | | | llvm-svn: 74030
* When declaring a function template, create a FunctionTemplateDecl nodeDouglas Gregor2009-06-241-0/+20
| | | | | | and associate it with the FunctionDecl. llvm-svn: 74028
* Start propagating template parameter lists to the right places toDouglas Gregor2009-06-231-2/+18
| | | | | | | handle function templates. There's no actual code for function templates yet, but at least we complain about typedef templates. llvm-svn: 74021
* Eliminate DeclPtrTy() arguments to ActOnDeclarator that are just a very, ↵Douglas Gregor2009-06-231-1/+1
| | | | | | very weird way to pass "false". No functionality change llvm-svn: 74007
* Remove ImplicitMustBeDefined, use universal 'Used' flagFariborz Jahanian2009-06-221-4/+1
| | | | | | instead. Do the implicit default ctor checking in MarkDeclarationReferenced. llvm-svn: 73888
* Parsing and AST support for using declarations, from John Thompson!Douglas Gregor2009-06-201-2/+3
| | | | llvm-svn: 73812
* Keep track of when declarations are "used" according to C andDouglas Gregor2009-06-191-0/+13
| | | | | | | | | | | | C++. This logic is required to trigger implicit instantiation of function templates and member functions of class templates, which will be implemented separately. This commit includes support for -Wunused-parameter, printing warnings for named parameters that are not used within a function/Objective-C method/block. Fixes <rdar://problem/6505209>. llvm-svn: 73797
* Patch for implementation of C++'s object model. This isFariborz Jahanian2009-06-191-2/+6
| | | | | | work in progress. llvm-svn: 73782
* Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.Douglas Gregor2009-06-181-29/+36
| | | | llvm-svn: 73702
* Diagnose class members that shadow a template parameter. FixesDouglas Gregor2009-06-171-0/+8
| | | | | | | | | | <rdar://problem/6952203>. To do this, we actually remove a not-quite-correct optimization in the C++ name lookup routines. We'll revisit this optimization for the general case once more C++ is working. llvm-svn: 73659
* Fix some erroneous comments due to trigger-happy copy&paste.Argyrios Kyrtzidis2009-06-171-5/+2
| | | | | | No functionality change. llvm-svn: 73657
* Factor out some common code into ↵Argyrios Kyrtzidis2009-06-171-0/+24
| | | | | | Sema::EnterDeclaratorContext/ExitDeclaratorContext. llvm-svn: 73655
* Move CXXMethodDecl::OutOfLineDefinition into Decl::OutOfLine.Argyrios Kyrtzidis2009-06-171-1/+1
| | | | llvm-svn: 73651
* Support dependent extended vector types and template instantiationDouglas Gregor2009-06-171-8/+9
| | | | | | thereof. Patch by Anders Johnsen! llvm-svn: 73641
OpenPOWER on IntegriCloud