summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* move GetBuiltinType from Builtin::Context to ASTContext.Chris Lattner2009-06-141-4/+4
| | | | llvm-svn: 73316
* PR4350: Make sure we don't create invalid printf attributes. This isn't Eli Friedman2009-06-101-3/+5
| | | | | | | | visible anywhere normally because the printf format checks for this case, and we don't print out attribute values anywhere. Original patch by Roberto Bagnara. llvm-svn: 73157
* Use of DeclContext for objc's ivars. No functionalityFariborz Jahanian2009-06-051-9/+26
| | | | | | change. More to follow. llvm-svn: 72951
* Address review comments for #pragma weak.Eli Friedman2009-06-051-0/+1
| | | | llvm-svn: 72926
* Start of a Sema implementation for #pragma weak. This isn't really theEli Friedman2009-06-051-0/+30
| | | | | | right approach, but I'm still not sure what the best way to go about this is. llvm-svn: 72912
* Fix up this compatibility hack to be more compatible with gcc.Eli Friedman2009-06-041-3/+4
| | | | llvm-svn: 72901
* PR4287: allow a variadic prototype to make a subsequent K&R style Eli Friedman2009-06-011-11/+14
| | | | | | | | definition variadic. I'm not completely sure it's legal, but the standard can be interpreted as making it legal, and gcc seems to think it's legal, so I didn't add an extension warning. llvm-svn: 72689
* Disallow exception specs on typedefs.Sebastian Redl2009-05-311-1/+2
| | | | llvm-svn: 72664
* AddInitializerToDecl needs to take a full expression.Anders Carlsson2009-05-301-2/+2
| | | | llvm-svn: 72640
* Remove VarDecl from CheckInitializerTypes now that CXXConstructExpr doesn't ↵Anders Carlsson2009-05-301-1/+1
| | | | | | need to take a VarDecl anymore. (It still does, but it won't for long) llvm-svn: 72630
* Add a member lookup criteria constructor for searching for overridden ↵Anders Carlsson2009-05-301-13/+1
| | | | | | virtual member functions. Use this instead of regular name lookup when checking for overriding functions so we will see declarations that would otherwise be hidden. Fixes 6902298. llvm-svn: 72601
* Refactor and clean up the AST printer, so that it uses a DeclVisitor,Douglas Gregor2009-05-301-2/+4
| | | | | | | | | walks through DeclContexts properly, and prints more of the information available in the AST. The functionality is still available via -ast-print, -ast-dump, etc., and also via the new member functions Decl::dump() and Decl::print(). llvm-svn: 72597
* Reject incomplete types in exception specs.Sebastian Redl2009-05-291-1/+1
| | | | llvm-svn: 72580
* Now that we have declared/defined tag types within DeclGroups,Douglas Gregor2009-05-291-1/+1
| | | | | | | | | | | | | instantiation of tags local to member functions of class templates (and, eventually, function templates) works when the tag is defined as part of the decl-specifier-seq, e.g., struct S { T x, y; } s1; Also, make sure that we don't try to default-initialize a dependent type. llvm-svn: 72568
* If a declarator group declares a type, make sure to add that declaration Eli Friedman2009-05-291-2/+6
| | | | | | to the DeclGroup. llvm-svn: 72559
* When we parse a tag specifier, keep track of whether that tagDouglas Gregor2009-05-281-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | specifier resulted in the creation of a new TagDecl node, which happens either when the tag specifier was a definition or when the tag specifier was the first declaration of that tag type. This information has several uses, the first of which is implemented in this commit: 1) In C++, one is not allowed to define tag types within a type specifier (e.g., static_cast<struct S { int x; } *>(0) is ill-formed) or within the result or parameter types of a function. We now diagnose this. 2) We can extend DeclGroups to contain information about any tags that are declared/defined within the declaration specifiers of a variable, e.g., struct Point { int x, y, z; } p; This will help improve AST printing and template instantiation, among other things. 3) For C99, we can keep track of whether a tag type is defined within the type of a parameter, to properly cope with cases like, e.g., int bar(struct T2 { int x; } y) { struct T2 z; } We can also do similar things wherever there is a type specifier, e.g., to keep track of where the definition of S occurs in this legal C99 code: (struct S { int x, y; } *)0 llvm-svn: 72555
* Reintroduce the home for exception specs, and make Sema fill it. However, ↵Sebastian Redl2009-05-271-0/+1
| | | | | | keep the spec out of the canonical type this time. Net effect is currently nothing, because the spec isn't checked anywhere. llvm-svn: 72498
* Add some more tests for instantiation of declaration references. Also,Douglas Gregor2009-05-271-1/+3
| | | | | | improve some error recovery with explicit template instantiation. llvm-svn: 72484
* Create CXXConstructExprs when constructing via copy initialization.Anders Carlsson2009-05-271-1/+1
| | | | llvm-svn: 72474
* When evaluating a VarDecl as a constant or determining whether it isDouglas Gregor2009-05-261-2/+2
| | | | | | | | an integral constant expression, maintain a cache of the value and the is-an-ICE flag within the VarDecl itself. This eliminates exponential-time behavior of the Fibonacci template metaprogram. llvm-svn: 72428
OpenPOWER on IntegriCloud