summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add support for retrieving the Doxygen comment associated with a givenDouglas Gregor2009-07-021-1/+203
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* De-ASTContext-ify DeclContext.Argyrios Kyrtzidis2009-06-301-19/+18
| | | | | | | 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 attribute-related methods of Decl.Argyrios Kyrtzidis2009-06-301-10/+10
| | | | | | | | | 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
* Key decisions about 'bool' vs '_Bool' to be based on a new flag in langoptions.Chris Lattner2009-06-301-2/+1
| | | | | | | | | | | | This is simple enough, but then I thought it would be nice to make PrintingPolicy get a LangOptions so that various things can key off "bool" and "C++" independently. This spiraled out of control. There are many fixme's, but I think things are slightly better than they were before. One thing that can be improved: CFG should probably have an ASTContext pointer in it, which would simplify its clients. llvm-svn: 74493
* Keep track of function template specializations, to eliminateDouglas Gregor2009-06-291-0/+6
| | | | | | | redundant, implicit instantiations of function templates and provide a place where we can hang function template specializations. llvm-svn: 74454
* Remove ASTContext::getObjCQualifiedIdType().Steve Naroff2009-06-291-7/+0
| | | | | | Convert clients to use ASTContext::getObjCObjectPointerType(). llvm-svn: 74424
* Implement enough of the 'auto' keyword so we can claim to support N2546.Anders Carlsson2009-06-261-0/+4
| | | | llvm-svn: 74307
* Decltype needs to have a dependent type if the expr passed to it is type ↵Anders Carlsson2009-06-251-0/+3
| | | | | | dependent. Fixes PR4444. llvm-svn: 74175
* C++ decltype support (N2343)Anders Carlsson2009-06-241-3/+31
| | | | llvm-svn: 74118
* Add a DecltypeType type.Anders Carlsson2009-06-241-0/+17
| | | | llvm-svn: 74099
* Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.Douglas Gregor2009-06-181-10/+10
| | | | llvm-svn: 73702
* First step toward fixing <rdar://problem/6613046> refactor clang objc type ↵Steve Naroff2009-06-171-21/+31
| | | | | | | | | | | | representation. Add a type (ObjCObjectPointerType) and remove a type (ObjCQualifiedIdType). This large/tedious patch is just a first step. Next step is to remove ObjCQualifiedInterfaceType. After that, I will remove the magic TypedefType for 'id' (installed by Sema). This work will enable various simplifications throughout clang (when dealing with ObjC types). No functionality change. llvm-svn: 73649
* Support dependent extended vector types and template instantiationDouglas Gregor2009-06-171-0/+12
| | | | | | thereof. Patch by Anders Johnsen! llvm-svn: 73641
* Keep track of whether a type parameter type is a parameter pack.Anders Carlsson2009-06-161-7/+10
| | | | llvm-svn: 73452
* Sink the BuiltinInfo object from ASTContext into theChris Lattner2009-06-141-12/+5
| | | | | | | | preprocessor and initialize it early in clang-cc. This ensures that __has_builtin works in all modes, not just when ASTContext is around. llvm-svn: 73319
* move GetBuiltinType from Builtin::Context to ASTContext.Chris Lattner2009-06-141-0/+200
| | | | llvm-svn: 73316
* Delete method which is now trivial.Eli Friedman2009-06-081-18/+0
| | | | llvm-svn: 73043
* Don't allow defining a block with a non-prototype type. Remove a Eli Friedman2009-06-081-6/+0
| | | | | | | | | | hack which introduces some strange inconsistencies in compatibility for block pointers. Note that unlike an earlier revision proposed on cfe-commits, this patch still allows declaring block pointers without a prototype. llvm-svn: 73041
* Move CharIsSigned from TargetInfo to LangOptions.Eli Friedman2009-06-051-1/+1
| | | | llvm-svn: 72928
* Cleanup/Refactoring of ivar collection. No change in functionality.Fariborz Jahanian2009-06-041-18/+54
| | | | llvm-svn: 72827
* Place the GC attribute on the same relative pointerFariborz Jahanian2009-06-031-0/+7
| | | | | | | position to make it consistant and to match gcc's behavior, by placing it at the inner-most pointer. llvm-svn: 72784
* Diagnose misuse of __strong attribute in a redeclaration.Fariborz Jahanian2009-06-021-9/+16
| | | | llvm-svn: 72737
* Issue diagnostics on __weak attribute mismatch.Fariborz Jahanian2009-06-021-9/+28
| | | | | | Fixes an error recovery issue which caused a crash. llvm-svn: 72733
* Fix a silly typo in my previous objc_gc merging patch.Eli Friedman2009-06-021-1/+1
| | | | llvm-svn: 72723
* Cleaned-up version of gc attribute type merging. I still don't like it Eli Friedman2009-06-021-17/+26
| | | | | | | very much, but I have a feeling we're never going to have an implementation that makes sense because of compatibility issues. llvm-svn: 72715
* This patch attempts to fix the merging of __strong/__weak attributesFariborz Jahanian2009-06-021-2/+22
| | | | | | | | | | in merge_types. It is incomplete. We probably want to issue a warning if user attempts to change the attribute from __weak to __strong or vice-vera. It also assumes that a __weak/__strong attribute can not be specified with other (currently one) type attriute. llvm-svn: 72711
* Disable type merging with gc attributes. This has a number of nasty Eli Friedman2009-06-011-2/+2
| | | | | | | | | | | | | | | | | | | properties at the moment: 1. It allows stuff like "__strong id x; __weak id x;". 2. For constructs like "__strong id x; id x;", subsequent references to x lose the objc_gc attribute. 3. This incorrectly allows merges involving the address_space attribute. 4. Constructs like "id x; /* some code using x */ __weak id x;" don't apply the objc_gc attribute consistently to all uses of x. The first three can probably be fixed relatively easily; the fourth would be extremely difficult to fix. llvm-svn: 72683
* Create a new PrintingPolicy class, which we pass down through the ASTDouglas Gregor2009-05-291-0/+1
| | | | | | | | | printing logic to help customize the output. For now, we use this rather than a special flag to suppress the "struct" when printing "struct X" and to print the Boolean type as "bool" in C++ but "_Bool" in C. llvm-svn: 72590
* Add an assertion so that we don't accidentally build constant arrays of Eli Friedman2009-05-291-0/+3
| | | | | | VLAs. llvm-svn: 72587
* Reintroduce the home for exception specs, and make Sema fill it. However, ↵Sebastian Redl2009-05-271-11/+23
| | | | | | 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 a big test case for I-C-Es in C++, and a fix to make it work. The fix ↵Sebastian Redl2009-05-271-1/+2
| | | | | | might not be the right way to do it. llvm-svn: 72490
* Convert ObjC qualified type clients over to using iterators.Steve Naroff2009-05-271-6/+6
| | | | | | | | This allows me to remove some API that I don't want to carry over to ObjCObjectPointerType. No functionality change. llvm-svn: 72475
* Simplify printing of the statistics for types.Douglas Gregor2009-05-261-95/+18
| | | | llvm-svn: 72415
* Extend getPreferredTypeAlign to handle _Complex double and long long Eli Friedman2009-05-251-5/+8
| | | | | | correctly. llvm-svn: 72401
* Use v.data() instead of &v[0] when SmallVector v might be empty.Jay Foad2009-05-211-1/+1
| | | | llvm-svn: 72210
* Use the Itanium ABI for member pointers. Add a missing 'break' statement and ↵Anders Carlsson2009-05-171-9/+9
| | | | | | a test case llvm-svn: 71972
* Fix rdar://6880874 - [sema] crash on array types with different index sizesChris Lattner2009-05-131-1/+6
| | | | llvm-svn: 71634
* Patch to implement ivar synthesis of properties declared in protocolsFariborz Jahanian2009-05-121-10/+40
| | | | | | only and used in class imllementations (objc2 Nonfragile ABI specific). llvm-svn: 71571
* The canonical declaration of a NULL declaration is NULLDouglas Gregor2009-05-101-0/+3
| | | | llvm-svn: 71409
* Implement the semantics of the injected-class-name within a classDouglas Gregor2009-05-101-1/+29
| | | | | | | | | | | | | | | | | | template. The injected-class-name is either a type or a template, depending on whether a '<' follows it. As a type, the injected-class-name's template argument list contains its template parameters in declaration order. As part of this, add logic for canonicalizing declarations, and be sure to canonicalize declarations used in template names and template arguments. A TagType is dependent if the declaration it references is dependent. I'm not happy about the rather complicated protocol needed to use ASTContext::getTemplateSpecializationType. llvm-svn: 71408
* Implement C++0x nullptr.Sebastian Redl2009-05-101-0/+6
| | | | llvm-svn: 71405
* Remove -fobjc-tight-layout, seems to work!Daniel Dunbar2009-05-071-6/+3
| | | | llvm-svn: 71184
* Start canonicalizing template names. This is not yet complete, but itDouglas Gregor2009-05-071-0/+11
| | | | | | improves type identity with dependent types. llvm-svn: 71152
* Back out r70506 (exception spec in AST) again. We won't have exception specs ↵Sebastian Redl2009-05-061-24/+10
| | | | | | until we've had a lot more discussion. llvm-svn: 71125
* Fix the field count in interface record layout (it was incorrectlyDaniel Dunbar2009-05-041-6/+0
| | | | | | | | | | | | compensating for super classes). This was making the reported class sizes for empty classes very, very wrong. - Also, we now report the size info for an empty class like gcc (as the offset of the start, not as 0, 0). - Add a few more test cases we were mishandling before (padding bit field at end of struct, for example). llvm-svn: 70938
* Add -fobjc-tight-layout.Daniel Dunbar2009-05-041-0/+9
| | | | | | | | | | | | | | | | | | | - This implements gcc style Objective-C interface layout (I think). Currently it is always off, there is no functionality change unless this is passed. For the curious, the deal is that gcc lays out the fields of a subclass as if they were part of the superclass. That is, the subclass fields immediately follow the super class fields instead of being padded to the alignment of the superclass structure. - Currently gcc uses the tight layout in 32-bit and 64-bit modes, and llvm-gcc uses it in 32-bit only, for reasons which aren't clear yet. We probably want to switch to matching gcc, once this makes it through testing... my hope is that we can also fix llvm-gcc in order to maintain compatibility between the compilers. llvm-svn: 70827
* Don't allow clients to traverse into superclass synthesized propertiesDaniel Dunbar2009-05-041-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | via CollectObjCIvars. - In places where we need them, we should have the implementation and access the properties through it. This is a fairly substantial functionality change: 1. @encode no longer encodes synthesized ivars, ever. 2. The ivar layout bitmap no longer encodes information for synthesized ivars in superclasses. Well, actually I had already broken that, but it is intentional now. We are now differing substantially from llvm-gcc and gcc here. However, in my opinion this fundamentally *must* work if non-fragile classes are to work. Without this change, the result of @encode and the ivar layout depend on the order that the implementation is seen in a file (if it is in the same file with its superclass). Since both scenarios should work the same, our behavior is now consistent with gcc behavior as if an implementation is never seen following an implementation of its superclass. Note that #2 is only a functionality change when (A) an implementation appears in the same translation unit with the implementation of its superclass, and (B) the superclass has synthesized ivars. My belief is that this situation does not occur in practice. I am not yet sure of the role/semantics of @encode when synthesized ivars are present... it's use is fairly unsound in a non-fragile world. llvm-svn: 70822
* Remove ASTContext::addRecordToClass.Daniel Dunbar2009-05-031-55/+4
| | | | llvm-svn: 70780
* Use ASTRecordLayout for computing ivar offsets instead of shadowDaniel Dunbar2009-05-031-0/+5
| | | | | | | | | | | struct. - We still need to do more lookup than necessary because ivars don't live in a reasonable DeclContext. - The only remaining client of the interface shadow struct is the ivar layout bitmap. llvm-svn: 70756
* Fix a possible memory error, the record layout entry could beDaniel Dunbar2009-05-031-9/+8
| | | | | | | invalidated by layout out the super class, we cannot cache the map entry. llvm-svn: 70693
OpenPOWER on IntegriCloud