summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclBase.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Convert DeclNodes to use TableGen.Alexis Hunt2010-05-301-49/+61
| | | | | | | | The macros required for DeclNodes use have changed to match the use of StmtNodes. The FooFirst enumerator constants have been named firstFoo to match usage elsewhere. llvm-svn: 105165
* Fixes for compilation with Microsoft Visual Studio 2010, from Steven Watanabe!Douglas Gregor2010-05-111-2/+2
| | | | llvm-svn: 103458
* Recommit my change to how C++ does elaborated type lookups, now withJohn McCall2010-04-231-8/+16
| | | | | | two bugfixes which fix selfhost and (hopefully) the nightly tests. llvm-svn: 102198
* Revert "C++ doesn't really use "namespaces" for different kinds of names the ↵Daniel Dunbar2010-04-231-16/+8
| | | | | | same", which seems to break most C++ nightly test apps. llvm-svn: 102174
* C++ doesn't really use "namespaces" for different kinds of names the sameJohn McCall2010-04-231-8/+16
| | | | | | | | | | | | | way that C does. Among other differences, elaborated type specifiers are defined to skip "non-types", which, as you might imagine, does not include typedefs. Rework our use of IDNS masks to capture the semantics of different kinds of declarations better, and remove most current lookup filters. Removing the last remaining filter is more complicated and will happen in a separate patch. Fixes PR 6885 as well some spectrum of unfiled bugs. llvm-svn: 102164
* Make TemplateDecl and ObjCContainerDecl abstractDouglas Gregor2010-04-221-2/+0
| | | | llvm-svn: 102145
* Kill off IDNS_ObjCImplementation and IDNS_ObjCCategoryName; theyDouglas Gregor2010-04-221-8/+4
| | | | | | | aren't and never were used. There's a gap in the bit pattern for IDNS now, but I'm sure *someone* will fill it. llvm-svn: 102143
* Remove the AST statistics tracking I added yesterday; it didn't pan out.Douglas Gregor2010-03-311-7/+0
| | | | llvm-svn: 100027
* Introduce new AST statistics that keep track of the number of isa (orDouglas Gregor2010-03-301-0/+7
| | | | | | | | | | | | | | | | | | | | | dyn_cast) invocations for C++ and Objective-C types, declarations, expressions, and statements. The statistics will be printed when -print-stats is provided to Clang -cc1, with results such as: 277073 clang - Number of checks for C++ declaration nodes 13311 clang - Number of checks for C++ expression nodes 18 clang - Number of checks for C++ statement nodes 174182 clang - Number of checks for C++ type nodes 92300 clang - Number of checks for Objective-C declaration nodes 9800 clang - Number of checks for Objective-C expression nodes 7 clang - Number of checks for Objective-C statement nodes 65733 clang - Number of checks for Objective-C type nodes The statistics are only gathered when NDEBUG is not defined, since they introduce potentially-expensive operations into very low-level routines (isa). llvm-svn: 99912
* When copying a partial diagnostic into a DependentDiagnostic, allocateDouglas Gregor2010-03-291-13/+6
| | | | | | | | | storage for that partial diagnostic via the ASTContext's BumpPtrAllocator rather than using up slots in the ASTContext's cache. Now that we do this, we don't have to worry about destroying dependent diagnostics when destroying a DependentStoredDeclsMap. llvm-svn: 99854
* Optimize PartialDiagnostic's memory-allocation behavior by placing aDouglas Gregor2010-03-291-0/+2
| | | | | | | | | | | | | | cache of PartialDiagnostic::Storage objects into an allocator within the ASTContext. This eliminates a significant amount of malloc traffic, for a 10% performance improvement in -fsyntax-only wall-clock time with 403.gcc's combine.c. Also, eliminate the RequireNonAbstractType hack I put in earlier, which was but a symptom of this larger problem. Fixes <rdar://problem/7806091>. llvm-svn: 99849
* Implement a framework for the delay of arbitrary diagnostics withinJohn McCall2010-03-241-19/+82
| | | | | | | | | templates. So delay access-control diagnostics when (for example) the target of a friend declaration is a specific specialization of a template. I was surprised to find that this was required for an access-controlled selfhost. llvm-svn: 99383
* Split C++ friend declarations into their own header/implementation file.John McCall2010-03-111-0/+1
| | | | | | | | | I'm expecting this portion of the AST to grow and change, and I'd like to be able to do that with minimal recompilation. If this proves unnecessary when access control is fully-implemented, I'll fold the classes back into DeclCXX.h. llvm-svn: 98249
* Create a new InjectedClassNameType to represent bare-word references to the John McCall2010-03-101-5/+16
| | | | | | | | | | | | | injected class name of a class template or class template partial specialization. This is a non-canonical type; the canonical type is still a template specialization type. This becomes the TypeForDecl of the pattern declaration, which cleans up some amount of code (and complicates some other parts, but whatever). Fixes PR6326 and probably a few others, primarily by re-establishing a few invariants about TypeLoc sizes. llvm-svn: 98134
* When we invalidate a declaration, make it public, so that it doesn'tDouglas Gregor2010-03-051-0/+10
| | | | | | | trigger access control or one of the many assertions we have for valid access specifiers. llvm-svn: 97767
* Don't assert that we have a valid access specifier on an invalidDouglas Gregor2010-02-221-1/+2
| | | | | | declaration. This is the trivial part of PR6365. llvm-svn: 96792
* Fix unused function warning to handle used attributes and redeclarations. ↵Tanya Lattner2010-02-171-0/+18
| | | | | | Update test case. llvm-svn: 96444
* Have ~ASTContext() delete StoredDeclsMap (internal to DeclContext) byTed Kremenek2010-02-111-5/+30
| | | | | | | | | storing the set of StoredDeclsMaps in an internal vector of void*. This isn't an ideal solution, but for the time being this fixes a major memory leak with these DenseMaps not being freed. Fixes: <rdar://problem/7634755> llvm-svn: 95861
* Create function, block, and template parameters in the context of theJohn McCall2010-01-221-2/+0
| | | | | | | | | translation unit. This is temporary for function and block parameters; template parameters can just stay this way, since Templates aren't DeclContexts. This gives us the nice property that everything created in a record DC should have access in C++. llvm-svn: 94122
* First pass at collecting access-specifier information along inheritance paths.John McCall2010-01-201-2/+9
| | | | | | | | Triggers lots of assertions about missing access information; fix them. Will actually consume this information soon. llvm-svn: 94038
* When we are instantiating a member function of a local class, be sureDouglas Gregor2010-01-161-0/+11
| | | | | | | | | to merge the local instantiation scope with the outer local instantiation scope, so that we can instantiate declarations from the function owning the local class. Fixes an assert while instantiating Boost.MPL's BOOST_MPL_ASSERT_MSG. llvm-svn: 93651
* Patch to fix a crash trying to access a category name inFariborz Jahanian2009-12-111-2/+2
| | | | | | | objective-c++ mode and also removed dead-code in this area. (fixes radar 7456710). llvm-svn: 91081
* Implement redeclaration checking and hiding semantics for using ↵John McCall2009-12-101-0/+40
| | | | | | | | | | | declarations. There are a couple of O(n^2) operations in this, some analogous to the usual O(n^2) redeclaration problem and some not. In particular, retroactively removing shadow declarations when they're hidden by later decls is pretty unfortunate. I'm not yet convinced it's worse than the alternative, though. llvm-svn: 91045
* Fix for PR5710: make sure to put function template specializations into theEli Friedman2009-12-081-0/+3
| | | | | | | | | | DeclContext, so they don't completely disappear from the AST. I don't particularly like this fix, but I don't see any obviously better way to deal with it, and I think it's pretty clearly an improvement; comments welcome. llvm-svn: 90835
* r90313, in which OverloadedFunctionDecl is removed and never spoken of again.John McCall2009-12-021-1/+0
| | | | llvm-svn: 90313
* Allocate MultipleDC objects using the allocator associated withTed Kremenek2009-12-011-5/+5
| | | | | | | | | | ASTContext instead of malloc. Besides reducing malloc traffic, this also removes a source of memory leaks when using a BumpPtrAllocator for the allocator of ASTContext. There are still leaks when using MallocAllocator because Decl::Destroy() isn't fully finished. Fixes: <rdar://problem/7431556> llvm-svn: 90174
* Streamline Stmt::CollectingStats() and Decl::CollectingStats(). No ↵Kovarththanan Rajaratnam2009-11-291-2/+1
| | | | | | functionality change. llvm-svn: 90078
* Add 1+2 consts.Daniel Dunbar2009-11-211-1/+1
| | | | llvm-svn: 89546
* Incremental progress on using declarations. Split UnresolvedUsingDecl intoJohn McCall2009-11-181-2/+3
| | | | | | | | | | two classes, one for typenames and one for values; this seems to have some support from Doug if not necessarily from the extremely-vague-on-this-point standard. Track the location of the 'typename' keyword in a using-typename decl. Make a new lookup result for unresolved values and deal with it in most places. llvm-svn: 89184
* Add SourceLocations to ObjCClassDecl for the class identifiers referenced by ↵Ted Kremenek2009-11-181-1/+1
| | | | | | @class. llvm-svn: 89170
* Do not register ObjCInterfaceDecls implicitly created by @class in theTed Kremenek2009-11-171-0/+7
| | | | | | | | | | | | | | | | | | current DeclContext. These "imaginary" declarations pose issues for clients searching DeclContext for actual declarations. Instead, register them for name lookup, and add the ObjCInterfaceDecl later to the DeclContext when we hit an actual @interface declaration. This also fixes a bug where the invariant that the Decls in a DeclContext are sorted in order of their appearance is no longer violated. What could happen is that an @class causes an ObjCInterfaceDecl to get added first to the DeclContext, then the ObjCClassDecl itself is added, and then later the SourceLocation of the ObjCInterfaceDecl is updated with the correct location (which is later in the file). This breaks an assumed invariant in ResolveLocation.cpp (and possibly other clients). llvm-svn: 89160
* Instead of hanging a using declaration's target decls directly off the using John McCall2009-11-171-7/+17
| | | | | | | decl, create shadow declarations and put them in scope like normal. Work in progress. llvm-svn: 89048
* Remove OriginalTypeParmDecl; the original type is the one specifiedJohn McCall2009-10-231-1/+0
| | | | | | | | | | | | | in the DeclaratorInfo, if one is present. Preserve source information through template instantiation. This is made more complicated by the possibility that ParmVarDecls don't have DIs, which is possibly worth fixing in the future. Also preserve source information for function parameters in ObjC method declarations. llvm-svn: 84971
* Anonymous namespaces, sema + codegen. A lot of semantics are still broken,John McCall2009-10-011-0/+11
| | | | | | apparently because using directives aren't quite working correctly. llvm-svn: 83184
* Improved representation and support for friend class templates. Angst about ↵John McCall2009-09-161-0/+1
| | | | | | same. llvm-svn: 82088
* When performing unqualified name lookup into a DeclContext, also look intoDouglas Gregor2009-09-101-0/+16
| | | | | | | | all of the parent DeclContexts that aren't represented within the Scope chain. This fixes some name-lookup problems in out-of-line definitions of members of nested classes. llvm-svn: 81451
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-49/+49
| | | | llvm-svn: 81346
* Ensure that the tag decls of friend decls aren't added to the friending class'sJohn McCall2009-09-021-5/+0
| | | | | | | decl list, and remove some workarounds that were due to this. Thanks to Eli for pointing this out and providing the test case. llvm-svn: 80745
* Fix bug 4784 and allow friend declarations to properly extendJohn McCall2009-08-311-4/+4
| | | | | | existing declaration chains. llvm-svn: 80636
* Add a workaround for decls that come from friend decls pointing to ↵Anders Carlsson2009-08-291-2/+12
| | | | | | undeclared classes. llvm-svn: 80438
* For consistency, just make friend declarations AS_public.John McCall2009-08-291-10/+2
| | | | llvm-svn: 80420
* Don't assert that friend declarations must have access specifiers for now.Anders Carlsson2009-08-291-2/+10
| | | | llvm-svn: 80415
* Omnibus friend decl refactoring. Instead of cloning AST classes for friendJohn McCall2009-08-281-4/+1
| | | | | | | | | | | | | | declarations of same, introduce a single AST class and add appropriate bits (encoded in the namespace) for whether a decl is "real" or not. Much hackery about previously-declared / not-previously-declared, but it's essentially mandated by the standard that friends alter lookup, and this is at least fairly non-intrusive. Refactor the Sema methods specific to friends for cleaner flow and less nesting. Incidentally solve a few bugs, but I remain confident that we can put them back. llvm-svn: 80353
* Check in UnresolvedUsingDecl.Anders Carlsson2009-08-281-0/+1
| | | | llvm-svn: 80336
* When checking whether one declaration context encloses another, make sure to ↵Douglas Gregor2009-08-271-0/+10
| | | | | | look at the primary contexts. Thanks to Eli for the test case llvm-svn: 80212
* Add a FriendClassDecl type for holding declarations of friend types in John McCall2009-08-111-0/+1
| | | | | | the AST, and create such declarations. llvm-svn: 78719
* Argument-dependent lookup for friend declarations. Add a new decl type,John McCall2009-08-111-3/+13
| | | | | | | | | | | | FriendFunctionDecl, and create instances as appropriate. The design of FriendFunctionDecl is still somewhat up in the air; you can befriend arbitrary types of functions --- methods, constructors, etc. --- and it's not clear that this representation captures that very well. We'll have a better picture when we start consuming this data in access control. llvm-svn: 78653
* Change uses of:Ted Kremenek2009-07-291-1/+1
| | | | | | | | | | | | | | | | | | | | 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
* Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methodsTed Kremenek2009-07-171-1/+1
| | | | | | | | | 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-1/+1
| | | | | | Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents. llvm-svn: 76139
OpenPOWER on IntegriCloud