summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/Sema.h
Commit message (Collapse)AuthorAgeFilesLines
* Patch to improve ir-gen for constructors with default argumentFariborz Jahanian2009-08-051-0/+8
| | | | | | expressions and a test case. llvm-svn: 78213
* Compare matching selectors in current andFariborz Jahanian2009-08-041-0/+4
| | | | | | | super class(s) and warn on any parameter type mismatch if potentially unsafe. llvm-svn: 78029
* Per advice that Doug Gregor gave me several months ago, clean up theTed Kremenek2009-08-031-1/+2
| | | | | | | | | | | | | implementation of '#pragma unused' by not constructing intermediate DeclRefExprs, but instead do the name lookup directly. The implementation is greatly simplified. Along the way, degrade '#pragma unused(undeclaredvariable)' to a warning instead of being a hard error. This implements: <rdar://problem/6761874> [sema] allow #pragma unused to reference undefined variable (with warning) llvm-svn: 78019
* Minor renaming/refactoring. No change in functionality.Fariborz Jahanian2009-08-031-3/+3
| | | | llvm-svn: 77985
* PR3679 - enable #pragma weak aliasing.Ryan Flynn2009-07-311-1/+12
| | | | llvm-svn: 77660
* Rename Action::TagKind to Action::TagUseKind, which removes both a misnomerJohn McCall2009-07-311-3/+3
| | | | | | and a name collision. llvm-svn: 77658
* Add CK_DerivedToBase and use it PerformObjectMemberConversion.Anders Carlsson2009-07-311-1/+3
| | | | llvm-svn: 77652
* Factor code out into a DiagnoseUnusedExprResult function.Anders Carlsson2009-07-301-0/+4
| | | | llvm-svn: 77628
* PR3679 - handle #pragma weakRyan Flynn2009-07-301-0/+25
| | | | llvm-svn: 77573
* Refactor base/member initializers, and construct them correctly in cases Eli Friedman2009-07-291-0/+9
| | | | | | with dependent types. Fixes PR4621 and PR4627. llvm-svn: 77498
* Check accessibility when converting object to the baseFariborz Jahanian2009-07-291-1/+1
| | | | | | class. llvm-svn: 77497
* Patch to provide cast of objects in member accessFariborz Jahanian2009-07-291-0/+2
| | | | | | | excpression, if needed, and remove some ir-gen code now unnencessary. llvm-svn: 77490
* Make functional-style casts emit correct messages, and fix a crash-on-invalid.Sebastian Redl2009-07-291-3/+5
| | | | llvm-svn: 77451
* Add noreturn support for blocks.Mike Stump2009-07-281-1/+2
| | | | llvm-svn: 77377
* Implement C++ semantics for C-style and functional-style casts. This ↵Sebastian Redl2009-07-251-4/+9
| | | | | | | | regresses Clang extension conversions, like vectors, but allows conversions via constructors and conversion operators. Add custom conversions to static_cast. llvm-svn: 77076
* Template instantiation for static data members that are defined out-of-line.Douglas Gregor2009-07-241-1/+4
| | | | | | | | Note that this also fixes a bug that affects non-template code, where we were not treating out-of-line static data members are "file-scope" variables, and therefore not checking their initializers. llvm-svn: 77002
* Test commit: make a little stub routine for semantic checking of main().John McCall2009-07-241-0/+1
| | | | llvm-svn: 76934
* Diagnose when base classes and members to be intializedFariborz Jahanian2009-07-231-0/+5
| | | | | | with constructors don't have a matching constructor. llvm-svn: 76913
* Clean up the ActOnTag action, so that there is only a single entryDouglas Gregor2009-07-231-7/+6
| | | | | | | | | point that covers templates and non-templates. This should eliminate the flood of warnings I introduced yesterday. Removed the ActOnClassTemplate action, which is no longer used. llvm-svn: 76881
* Remove a bunch of FIXME's related to ObjC type checking.Steve Naroff2009-07-231-4/+0
| | | | | | | | - Move Sema::ObjCQualifiedIdTypesAreCompatible(), Sema::QualifiedIdConformsQualifiedId(), and a couple helper functions to ASTContext. - Change ASTContext::canAssignObjCInterfaces() to use ASTContext:: ObjCQualifiedIdTypesAreCompatible(). - Tweak several test cases to accommodate the new/improved type checking. llvm-svn: 76830
* Add warning for falling off the end of a function that should return aMike Stump2009-07-221-1/+5
| | | | | | | | | | | | | | | | | | | | | 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-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* "This patch implements the restrictions on union members detailed inDouglas Gregor2009-07-221-0/+8
| | | | | | [class.union]p1", from John McCall! llvm-svn: 76766
* Implement parsing and semantic analysis for out-of-line definitions of staticDouglas Gregor2009-07-221-0/+1
| | | | | | | 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-2/+8
| | | | | | | | | | | | | 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-1/+1
| | | | | | destruction of base/members for each destructor AST. llvm-svn: 76663
* Remove the ObjCCategoryImpls vector from Sema class.Argyrios Kyrtzidis2009-07-211-4/+0
| | | | | | Use ObjCInterfaceDecl::getCategoryClassMethod() and ObjCInterfaceDecl::getCategoryInstanceMethod() for the same functionality. llvm-svn: 76510
* Remove Sema::LookupObjCImplementation and replace it with just calling ↵Argyrios Kyrtzidis2009-07-211-1/+0
| | | | | | ObjCInterfaceDecl::getImplementation(). llvm-svn: 76509
* 5 cleanups to ObjCObjectPointerType work:Steve Naroff2009-07-201-2/+0
| | | | | | | | | | - Remove Sema::CheckPointeeTypesForAssignment(), a temporary API I added to ease migration to ObjCObjectPointerType. Convert Sema::CheckAssignmentConstraints() to no longer depend on the temporary API. - Sema::ConvertDeclSpecToType(): Replace a couple FIXME's with an important comment/example. - Sema::GetTypeForDeclarator(): Get the protocol's from the interface, NOT the declspec (to support the following C typedef idiom: "typedef C<P> T; T *obj"). - Sema::ObjCQualifiedIdTypesAreCompatible(): Removed some dead code. - ASTContext::getObjCEncodingForTypeImpl(): Some minor cleanups. llvm-svn: 76443
* Enhance testing of overriding exception specs for inaccessible base exceptions.Sebastian Redl2009-07-181-5/+9
| | | | llvm-svn: 76317
* Added ASTs to destructor decl AST for default destruction of object'sFariborz Jahanian2009-07-151-1/+1
| | | | | | base/members. llvm-svn: 75849
* Patch to build AST for ctor's initializer list according toFariborz Jahanian2009-07-141-0/+1
| | | | | | semantics of order of construction [class.init]. llvm-svn: 75649
* Add a "TypeSpecStartLoc" to FieldDecl. Patch contributed by Enea Zaffanella.Steve Naroff2009-07-141-0/+1
| | | | | 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
* Pass the right brace SourceLocation from the Parser to the TagDecls.Argyrios Kyrtzidis2009-07-141-1/+2
| | | | llvm-svn: 75591
* Implement more of C++0x 'auto'. A variable with an auto type specifier must ↵Anders Carlsson2009-07-111-1/+1
| | | | | | have an initializer. Also, move some tests around to match the C++0x draft better. llvm-svn: 75322
* Remove some unused code from an experiment that I didn't like.Anders Carlsson2009-07-101-11/+0
| | | | llvm-svn: 75315
* This patch includes a conceptually simple, but very intrusive/pervasive change. Steve Naroff2009-07-101-0/+2
| | | | | | | | | | | | 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
* Implement template argument deduction when taking the address of aDouglas Gregor2009-07-081-1/+25
| | | | | | | | function template. Most of the change here is in factoring out the common bits used for template argument deduction from a function call and when taking the address of a function template. llvm-svn: 75044
* Improve template argument deduction from a call. In particular,Douglas Gregor2009-07-071-1/+1
| | | | | | | | implement C++ [temp.deduct.call]p3b3, which allows a template-id parameter to match a derived class of the argument, while deducing template arguments. llvm-svn: 74965
* Implement checking of exception spec compatibility for overriding virtual ↵Sebastian Redl2009-07-071-4/+11
| | | | | | functions. llvm-svn: 74943
* Keep track of the Expr used to describe the size of an array type,Douglas Gregor2009-07-061-1/+1
| | | | | | from Enea Zaffanella! llvm-svn: 74831
* Catch function redeclarations with incompatible exception specifications.Sebastian Redl2009-07-041-0/+4
| | | | llvm-svn: 74787
* Add support for retrieving the Doxygen comment associated with a givenDouglas Gregor2009-07-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | declaration in the AST. The new ASTContext::getCommentForDecl function searches for a comment that is attached to the given declaration, and returns that comment, which may be composed of several comment blocks. Comments are always available in an AST. However, to avoid harming performance, we don't actually parse the comments. Rather, we keep the source ranges of all of the comments within a large, sorted vector, then lazily extract comments via a binary search in that vector only when needed (which never occurs in a "normal" compile). Comments are written to a precompiled header/AST file as a blob of source ranges. That blob is only lazily loaded when one requests a comment for a declaration (this never occurs in a "normal" compile). The indexer testbed now supports comment extraction. When the -point-at location points to a declaration with a Doxygen-style comment, the indexer testbed prints the associated comment block(s). See test/Index/comments.c for an example. Some notes: - We don't actually attempt to parse the comment blocks themselves, beyond identifying them as Doxygen comment blocks to associate them with a declaration. - We won't find comment blocks that aren't adjacent to the declaration, because we start our search based on the location of the declaration. - We don't go through the necessary hops to find, for example, whether some redeclaration of a declaration has comments when our current declaration does not. Similarly, we don't attempt to associate a \param Foo marker in a function body comment with the parameter named Foo (although that is certainly possible). - Verification of my "no performance impact" claims is still "to be done". llvm-svn: 74704
* Keep track of more information within the template instantiation stack, e.g.,Douglas Gregor2009-07-011-9/+22
| | | | | | | | | | | | | | by distinguishing between substitution that occurs for template argument deduction vs. explicitly-specifiad template arguments. This is used both to improve diagnostics and to make sure we only provide SFINAE in those cases where SFINAE should apply. In addition, deal with the sticky issue where SFINAE only considers substitution of template arguments into the *type* of a function template; we need to issue hard errors beyond this point, as test/SemaTemplate/operator-template.cpp illustrates. llvm-svn: 74651
* Patch to implement template types in ctor-initializer list.Fariborz Jahanian2009-07-011-0/+1
| | | | | | Also has fix for bugzilla-4469. llvm-svn: 74631
* Cope with explicitly-specified function template arguments when thereDouglas Gregor2009-07-011-0/+1
| | | | | | | are fewer template arguments than there are template parameters for that function. llvm-svn: 74578
* When explicit template arguments are provided for a function call,Douglas Gregor2009-06-301-1/+13
| | | | | | | | | substitute those template arguments into the function parameter types prior to template argument deduction. There's still a bit of work to do to make this work properly when only some of the template arguments are specified. llvm-svn: 74576
* Patch to support optional nested-name-specifier in in ctor-initializerFariborz Jahanian2009-06-301-0/+1
| | | | | | list. llvm-svn: 74571
* Preliminary parsing and ASTs for template-ids that refer to functionDouglas Gregor2009-06-301-0/+14
| | | | | | | templates, such as make<int&>. These template-ids are only barely functional for function calls; much more to come. llvm-svn: 74563
* When recursively instantiating function templates, keep track of theDouglas Gregor2009-06-301-3/+4
| | | | | | | | | | | | instantiation stack so that we provide a full instantiation backtrace. Previously, we performed all of the instantiations implied by the recursion, but each looked like a "top-level" instantiation. The included test case tests the previous fix for the instantiation of DeclRefExprs. Note that the "instantiated from" diagnostics still don't tell us which template arguments we're instantiating with. llvm-svn: 74540
OpenPOWER on IntegriCloud