summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* When we encounter a dependent type that was parsed before we know thatDouglas Gregor2009-08-061-0/+24
| | | | | | | | | | | | | | | | | | | | | | we were going to enter into the scope of a class template or class template partial specialization, rebuild that type so that it can refer to members of the current instantiation, as in code like template<typename T> struct X { typedef T* pointer; pointer data(); }; template<typename T> typename X<T>::pointer X<T>::data() { ... } Without rebuilding the return type of this out-of-line definition, the canonical return type of the out-of-line definition (a TypenameType) will not match the canonical return type of the declaration (the canonical type of T*). llvm-svn: 78316
* First pass at friend semantics.John McCall2009-08-061-4/+26
| | | | llvm-svn: 78274
* Introduce the canonical type smart pointers, and use them in a few places toDouglas Gregor2009-08-051-8/+8
| | | | | | tighten up the static type system. llvm-svn: 78164
* Remove an unused header.Mike Stump2009-08-051-1/+0
| | | | llvm-svn: 78140
* Canonicalize else.Mike Stump2009-08-041-12/+8
| | | | llvm-svn: 78102
* Refactor methods on DeclSpec to take a diagnostic& parameter, and reflect thisJohn McCall2009-08-031-4/+8
| | | | | | | | elsewhere. Very slightly decouples DeclSpec users from knowing the exact diagnostics to report, and makes it easier to provide different diagnostics in some places. llvm-svn: 77990
* Minor renaming/refactoring. No change in functionality.Fariborz Jahanian2009-08-031-3/+1
| | | | llvm-svn: 77985
* PR3679 - enable #pragma weak aliasing.Ryan Flynn2009-07-311-1/+1
| | | | llvm-svn: 77660
* Rename Action::TagKind to Action::TagUseKind, which removes both a misnomerJohn McCall2009-07-311-13/+13
| | | | | | and a name collision. llvm-svn: 77658
* Add a CastKind enum to CastExpr. Right now it's not used for much but it ↵Anders Carlsson2009-07-311-1/+3
| | | | | | will be :) llvm-svn: 77650
* PR3679 - handle #pragma weakRyan Flynn2009-07-301-11/+12
| | | | llvm-svn: 77573
* Change uses of:Ted Kremenek2009-07-291-8/+8
| | | | | | | | | | | | | | | | | | | | Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsRecordType() -> Type::getAs<RecordType>() Type::getAsPointerType() -> Type::getAs<PointerType>() Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>() Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>() Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>() Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>() Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsTagType() -> Type::getAs<TagType>() And remove Type::getAsReferenceType(), etc. This change is similar to one I made a couple weeks ago, but that was partly reverted pending some additional design discussion. With Doug's pending smart pointer changes for Types, it seemed natural to take this approach. llvm-svn: 77510
* Some minor cleanups, thanks Chris.Mike Stump2009-07-281-8/+2
| | | | llvm-svn: 77402
* Add support for -Wmissing-noreturn.Mike Stump2009-07-281-2/+13
| | | | llvm-svn: 77391
* Add noreturn support for blocks.Mike Stump2009-07-281-2/+47
| | | | llvm-svn: 77377
* Make longjmp a real builtin.Mike Stump2009-07-281-8/+23
| | | | llvm-svn: 77291
* Allow functions to be marked "implicit return zero" and so mark main().John McCall2009-07-281-1/+4
| | | | | | Codegen by initializing the return value with its LLVM type's null value. llvm-svn: 77288
* Make sure to move the comment with the code.Mike Stump2009-07-281-0/+3
| | | | llvm-svn: 77279
* Add knowledge about _longjmp being noreturn.Mike Stump2009-07-271-2/+2
| | | | llvm-svn: 77254
* Add builtin knowledge about longjmp being noreturn. Add printing forMike Stump2009-07-271-1/+3
| | | | | | the noreturn attribute. llvm-svn: 77253
* Add noreturn for exit.Mike Stump2009-07-271-0/+3
| | | | llvm-svn: 77237
* PR3575 - warn on declared variable or function attributes after a ↵Ryan Flynn2009-07-251-0/+19
| | | | | | definition, which are currently ignored. llvm-svn: 77095
* Add noreturn as a type attribute, handle printing for them and handleMike Stump2009-07-251-1/+4
| | | | | | calls to noreturn function pointers when CFG building. llvm-svn: 77089
* Semantic checking for main().John McCall2009-07-251-1/+79
| | | | | | | Fix some invalid main() methods in the test suite that were nicely exposed by the new checks. llvm-svn: 77047
* Test commit: make a little stub routine for semantic checking of main().John McCall2009-07-241-0/+6
| | | | llvm-svn: 76934
* Implement new warning for functions declared 'noreturn' when they fall off ↵Mike Stump2009-07-241-15/+39
| | | | | | the end. llvm-svn: 76932
* This patch fixes the implementations of the __has_trivial_destructorDouglas Gregor2009-07-231-7/+2
| | | | | | | | and __has_trivial_constructor builtin pseudo-functions and additionally implements __has_trivial_copy and __has_trivial_assign, from John McCall! llvm-svn: 76916
* Some cleanups suggested by Daniel.Mike Stump2009-07-231-36/+47
| | | | llvm-svn: 76906
* Clean up the ActOnTag action, so that there is only a single entryDouglas Gregor2009-07-231-1/+1
| | | | | | | | | 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
* Use llvm::BitVector instead of managing memory by hand.Daniel Dunbar2009-07-231-3/+4
| | | | | | | - As it happens, this also fixes a use-of-uninitialized memory that was causing non-deterministic test failures. llvm-svn: 76857
* 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
OpenPOWER on IntegriCloud