summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclBase.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Major anonymous union/struct redesign.Francois Pichet2010-11-211-2/+3
| | | | | | | | | | | A new AST node is introduced: def IndirectField : DDecl<Value>; IndirectFields are injected into the anonymous's parent scope and chain back to the original field. Name lookup for anonymous entities now result in an IndirectFieldDecl instead of a FieldDecl. There is no functionality change, the code generated should be the same. llvm-svn: 119919
* Use the ASTMutationListener to track when a named decl gets added to a ↵Argyrios Kyrtzidis2010-10-281-0/+7
| | | | | | | | DeclContext, meaning we need to rewrite its name lookup table in a chained PCH. llvm-svn: 117536
* A couple of tweaks to the visibility rules: John McCall2010-10-261-0/+11
| | | | | | | | | | | - tags with C linkage should ignore visibility=hidden - functions and variables with explicit visibility attributes should ignore the linkage of their types Either of these should be sufficient to fix PR8457. Also, FileCheck-ize a test case. llvm-svn: 117351
* Put the mechanism in place to track modifications in an AST entity that were ↵Argyrios Kyrtzidis2010-10-241-0/+4
| | | | | | | | | | | | committed after its initial creation/deserialization and store the changes in a chained PCH. The idea is that the AST entities call methods on the ASTMutationListener to give notifications of changes; the PCHWriter implements the ASTMutationListener interface and stores the incremental changes of the updated entity. WIP llvm-svn: 117235
* Allow deserialization of just the fields of a record, when we want to ↵Argyrios Kyrtzidis2010-10-141-16/+30
| | | | | | | | | | | | | iterate over them, instead of deserializing the complete declaration context of the record. Iterating over the fields of a record is very common (e.g to determine the layout), unfortunately we needlessly deserialize every declaration that the declaration context of the record contains; this can be bad for large C++ classes that contain a lot of methods. Fix this by allow deserialization of just the fields when we want to iterate over them. Progress for rdar://7260160. llvm-svn: 116507
* Implement C++0x scoped enumerations, from Daniel Wallin! (and tweaked aDouglas Gregor2010-10-081-1/+1
| | | | | | bit by me). llvm-svn: 116122
* Centralize the handling ofDouglas Gregor2010-09-271-8/+5
| | | | | | | CXXRecordDecl::DefinitionData::DeclaredCopyAssignment, for copy-assignment operators. Another step toward <rdar://problem/8459981>. llvm-svn: 114899
* Clean up the handling of the DeclaredDefaultConstructor andDouglas Gregor2010-09-271-0/+8
| | | | | | | | | | | | | DeclaredCopyConstructor bits in CXXRecordDecl's DefinitionData structure. Rather than having Sema call addedConstructor or set the bits directly at semi-random places, move all of the logic for managing these bits into CXXRecordDecl itself and tie the addedConstructor call into DeclContext::addDecl(). This makes it easier for AST-building clients to get the right bits set in DefinitionData, and is one small part of <rdar://problem/8459981>. llvm-svn: 114889
* Decl::CheckAccessDeclContext() keeps asserting. Access is not set in some cases.Argyrios Kyrtzidis2010-09-081-4/+9
| | | | llvm-svn: 113419
* Re-enable CheckAccessDeclContext and make sure it doesn't trigger assertions.Argyrios Kyrtzidis2010-09-081-4/+6
| | | | llvm-svn: 113413
* Make inline namespace not be transparent after all. The concept simply ↵Sebastian Redl2010-08-311-10/+13
| | | | | | doesn't fit. Instead, special-case the few places where transparent contexts have the desired behavior for inline namespaces. Fixes a redeclaration issue in inline namespaces. llvm-svn: 112637
* Enable inline namespaces in the AST.Sebastian Redl2010-08-311-1/+1
| | | | llvm-svn: 112564
* Rename DeclContext::getLookupContext to getRedeclContext and change its ↵Sebastian Redl2010-08-311-6/+24
| | | | | | semantics slightly. No functionality change in the absence of inline namespaces. Also, change a few places where inline namespaces actually make a difference to be prepared for them. llvm-svn: 112563
* Decl::getEnclosingNamespaceContext has no reason to explicitly skip ↵Sebastian Redl2010-08-311-1/+1
| | | | | | transparent contexts, and would be wrong to do so with inline namespaces. llvm-svn: 112562
* Fix an issue with writing to PCH another included PCH, introduced by the ↵Argyrios Kyrtzidis2010-08-201-0/+28
| | | | | | | | | | | "using an AST on-disk hash table for name lookup" commit. When including a PCH and later re-emitting to another PCH, the name lookup tables of DeclContexts may be incomplete, since we now lazily deserialize the visible decls of a particular name. Fix the issue by iterating over the un-deserialized visible decls and completing the lookup tables of DeclContexts before writing them out. llvm-svn: 111698
* Use the AST on-disk hash table for name lookup inside a DeclContext.Argyrios Kyrtzidis2010-08-201-91/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *Huge* improvement over the amount of deserializing that we do for C++ lookup. e.g, if he have the Carbon header precompiled and include it on a file containing this: int x; these are the before/after stats: BEFORE: *** AST File Statistics: 578 stat cache hits 4 stat cache misses 548/30654 source location entries read (1.787695%) 15907/16501 types read (96.400223%) 53525/59955 declarations read (89.275291%) 33993/43525 identifiers read (78.099945%) 41516/51891 statements read (80.006165%) 77/5317 macros read (1.448185%) 0/6335 lexical declcontexts read (0.000000%) 1/5424 visible declcontexts read (0.018437%) AFTER using the on-disk table: *** AST File Statistics: 578 stat cache hits 4 stat cache misses 548/30654 source location entries read (1.787695%) 10/16501 types read (0.060602%) 9/59955 declarations read (0.015011%) 161/43525 identifiers read (0.369902%) 20/51891 statements read (0.038542%) 6/5317 macros read (0.112846%) 0/6335 lexical declcontexts read (0.000000%) 2/5424 visible declcontexts read (0.036873%) There's only one issue affecting mostly the precompiled preambles which I will address soon. llvm-svn: 111636
* Generate Attr subclasses with TableGen.Alexis Hunt2010-08-181-16/+6
| | | | | | | | | | | | | | | | | | | | | | | | Now all classes derived from Attr are generated from TableGen. Additionally, Attr* is no longer its own linked list; SmallVectors or Attr* are used. The accompanying LLVM commit contains the updates to TableGen necessary for this. Some other notes about newly-generated attribute classes: - The constructor arguments are a SourceLocation and a Context&, followed by the attributes arguments in the order that they were defined in Attr.td - Every argument in Attr.td has an appropriate accessor named getFoo, and there are sometimes a few extra ones (such as to get the length of a variadic argument). Additionally, specific_attr_iterator has been introduced, which will iterate over an AttrVec, but only over attributes of a certain type. It can be accessed through either Decl::specific_attr_begin/end or the global functions of the same name. llvm-svn: 111455
* When we are deserializing the lexical decls of a DeclContext from PCH, ↵Argyrios Kyrtzidis2010-07-301-0/+3
| | | | | | | | | | | notify the PCHReader to hold off passing Decls to the consumer until the DeclContext is fully prepared. Before, due to recursive loading, we could be in a situation where we would try to deserialize the decls of a DeclContext which was already doing that, and bad things would happen. In the specific case I encountered, the lexical decls would form a cycle and we would enter infinite loop territory. llvm-svn: 109857
* - Fix recording of offsets of types in dependent PCHs.Sebastian Redl2010-07-271-0/+8
| | | | | | | - Stop reading in (and thus deserializing) every declaration in the TU when creating a dependent PCH. - Switch the storage of a decl context's lexical declarations to a blob containing the IDs instead of a record. This is the only sane way of supporting update records later on. llvm-svn: 109474
* Remove destructors from declaration nodesDouglas Gregor2010-07-251-6/+1
| | | | llvm-svn: 109380
* Remove the vast majority of the Destroy methods from the AST library,Douglas Gregor2010-07-251-43/+1
| | | | | | since we aren't going to be calling them ever. llvm-svn: 109377
* Instantiate attributes when first building an instantiatedFariborz Jahanian2010-07-131-12/+0
| | | | | | VarDecl. llvm-svn: 108218
* Copy over attributes to instantiated variable.Fariborz Jahanian2010-07-121-0/+11
| | | | llvm-svn: 108195
* Remove Decl::getCompoundBody().Argyrios Kyrtzidis2010-07-071-4/+0
| | | | | | | | This has 2 (slight) advantages: -Make explicit at getBody()'s callsite that we expect/handle only CompoundStmt and not CXXTryStmt. -Better tracking of Decl::getBody()'s callsites. llvm-svn: 107771
* Simplify code. CompoundStmt's RBraceLoc can be found using its SourceRange too.Argyrios Kyrtzidis2010-07-071-8/+4
| | | | llvm-svn: 107770
* Introduce Decl::hasBody() and FunctionDecl::hasBody() and use them instead ↵Argyrios Kyrtzidis2010-07-071-0/+9
| | | | | | | | of getBody() when we are just checking the existence of a body, to avoid de-serialization of the body from PCH. Makes de-serialization of the function body even more "lazier". llvm-svn: 107768
* When adding a visible decl, deserialize the visible decls and add it.Argyrios Kyrtzidis2010-07-041-9/+10
| | | | | | | | | | Before this commit, visible decls added before deserialization were ignored. This was not an issue since name lookup (that usually comes before the addition) forces deserialization but it is an issue for lazily declared class implicit members. We can use a PCH'ed <string> now. llvm-svn: 107596
* Lazily declare default constructors. We now delay the construction ofDouglas Gregor2010-07-031-0/+6
| | | | | | | | | | | | | | | | | | declarations for implicit default constructors, copy constructors, copy assignment operators, and destructors. On a "simple" translation unit that includes a bunch of C++ standard library headers, we generate relatively few of these implicit declarations now: 4/159 implicit default constructors created 18/236 implicit copy constructors created 70/241 implicit copy assignment operators created 0/173 implicit destructors created And, on this translation unit, this optimization doesn't really provide any benefit. I'll do some more performance measurements soon, but this completes the implementation work for <rdar://problem/8151045>. llvm-svn: 107551
* Disable Decl::CheckAccessDeclContext() temporarily.Argyrios Kyrtzidis2010-07-021-4/+6
| | | | llvm-svn: 107478
* Given Decl::isUsed() a flag indicating when to consider the "used"Douglas Gregor2010-06-171-3/+3
| | | | | | | | | attribute as part of the calculation. Sema::MarkDeclReferenced(), and a few other places, want only to consider the "used" bit to determine, e.g, whether to perform template instantiation. Fixes a linkage issue with Boost.Serialization. llvm-svn: 106252
* Fix PCH issue. Attributes of a declaration were truncated to just one when ↵Argyrios Kyrtzidis2010-06-111-0/+11
| | | | | | the decl was read from a PCH file. llvm-svn: 105852
* Added AccessSpecDecl node.Abramo Bagnara2010-06-051-0/+1
| | | | llvm-svn: 105525
* Alter the ExternalASTSource interface to permit by-name lookups. PCH ↵John McCall2010-06-011-22/+85
| | | | | | | | | | | | | | continues to bring in the entire lookup table at once. Also, give ExternalSemaSource's vtable a home. This is important because otherwise any reference to it will cause RTTI to be emitted, and since clang is compiled with -fno-rtti, that RTTI will contain unresolved references (to ExternalASTSource's RTTI). So this change makes it possible to subclass ExternalSemaSource from projects compiled with RTTI, as long as the subclass's home is compiled with -fno-rtti. llvm-svn: 105268
* 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
OpenPOWER on IntegriCloud