summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PCHWriter.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Parse C++ member check attributes - base_check, hiding, and override.Alexis Hunt2009-11-251-0/+5
| | | | | | The attributes are currently ignored. llvm-svn: 89837
* This patch implements objective-c's 'SEL' type as a built-inFariborz Jahanian2009-11-211-0/+5
| | | | | | | | | | | | | | | | | | type and fixes a long-standing code gen. crash reported in at least two PRs and a radar. (radar 7405040 and pr5025). There are couple of remaining issues that I would like for Ted. and Doug to look at: Ted, please look at failure in Analysis/MissingDealloc.m. I have temporarily added an expected-warning to make the test pass. This tests has a declaration of 'SEL' type which may not co-exist with the new changes. Doug, please look at a FIXME in PCHWriter.cpp/PCHReader.cpp. I think the changes which I have ifdef'ed out are correct. They need be considered for in a few Indexer/PCH test cases. llvm-svn: 89561
* Added rudimentary C++0x attribute support.Alexis Hunt2009-11-211-0/+1
| | | | | | | | | | | | | | The following attributes are currently supported in C++0x attribute lists (and in GNU ones as well): - align() - semantics believed to be conformant to n3000, except for redeclarations and what entities it may apply to - final - semantics believed to be conformant to CWG issue 817's proposed wording, except for redeclarations - noreturn - semantics believed to be conformant to n3000, except for redeclarations - carries_dependency - currently ignored (this is an optimization hint) llvm-svn: 89543
* First part of changes to eliminate problems with cv-qualifiers andDouglas Gregor2009-11-161-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sugared types. The basic problem is that our qualifier accessors (getQualifiers, getCVRQualifiers, isConstQualified, etc.) only look at the current QualType and not at any qualifiers that come from sugared types, meaning that we won't see these qualifiers through, e.g., typedefs: typedef const int CInt; typedef CInt Self; Self.isConstQualified() currently returns false! Various bugs (e.g., PR5383) have cropped up all over the front end due to such problems. I'm addressing this problem by splitting each qualifier accessor into two versions: - the "local" version only returns qualifiers on this particular QualType instance - the "normal" version that will eventually combine qualifiers from this QualType instance with the qualifiers on the canonical type to produce the full set of qualifiers. This commit adds the local versions and switches a few callers from the "normal" version (e.g., isConstQualified) over to the "local" version (e.g., isLocalConstQualified) when that is the right thing to do, e.g., because we're printing or serializing the qualifiers. Also, switch a bunch of Context.getCanonicalType(T1).getUnqualifiedType() == Context.getCanonicalType(T2).getQualifiedType() expressions over to Context.hasSameUnqualifiedType(T1, T2) llvm-svn: 88969
* Introduce a new representation for template templateDouglas Gregor2009-11-111-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | parameters. Rather than storing them as either declarations (for the non-dependent case) or expressions (for the dependent case), we now (always) store them as TemplateNames. The primary change here is to add a new kind of TemplateArgument, which stores a TemplateName. However, making that change ripples to every switch on a TemplateArgument's kind, also affecting TemplateArgumentLocInfo/TemplateArgumentLoc, default template arguments for template template parameters, type-checking of template template arguments, etc. This change is light on testing. It should fix several pre-existing problems with template template parameters, such as: - the inability to use dependent template names as template template arguments - template template parameter default arguments cannot be instantiation However, there are enough pieces missing that more implementation is required before we can adequately test template template parameters. llvm-svn: 86777
* Add support for cdecl attribute. (As far as I know, it doesn't affect CodeGenEli Friedman2009-11-091-0/+3
| | | | | | | | unless we start implementing command-line switches which override the default calling convention, so the effect is mostly to silence unknown attribute warnings.) llvm-svn: 86571
* Adding -fshort-wchar option.John Thompson2009-11-051-0/+1
| | | | llvm-svn: 86167
* Track source information for template arguments and template specializationJohn McCall2009-10-291-1/+22
| | | | | | | types. Preserve it through template instantiation. Preserve it through PCH, although TSTs themselves aren't serializable, so that's pretty much meaningless. llvm-svn: 85500
* 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
* When building types from declarators, instead of building two types (one forJohn McCall2009-10-221-14/+9
| | | | | | | | | | | | | | | | | | | | | the DeclaratorInfo, one for semantic analysis), just build a single type whose canonical type will reflect the semantic analysis (assuming the type is well-formed, of course). To make that work, make a few changes to the type system: * allow the nominal pointee type of a reference type to be a (possibly sugared) reference type. Also, preserve the original spelling of the reference type. Both of these can be ignored on canonical reference types. * Remove ObjCProtocolListType and preserve the associated source information on the various ObjC TypeLocs. Preserve the spelling of protocol lists except in the canonical form. * Preserve some level of source type structure on parameter types, but canonicalize on the canonical function type. This is still a WIP. Drops code size, makes strides towards accurate source location representation, slight (~1.7%) progression on Cocoa.h because of complexity drop. llvm-svn: 84907
* Extend out the block descriptor structure for debug information withMike Stump2009-10-221-0/+1
| | | | | | the copy/dispose helpers as appropriate. llvm-svn: 84817
* Refine the type of the first parameter to block invoke functions.Mike Stump2009-10-201-0/+1
| | | | | | | WIP. I have yet to find the magic incantation to get the structure type to be defined. If someone has a pointer, love to hear it. llvm-svn: 84590
* Move clients to use IdentifierInfo::getNameStart() instead of getName()Daniel Dunbar2009-10-181-2/+2
| | | | llvm-svn: 84436
* When performing template-substitution into a type, don't just replace theJohn McCall2009-10-181-0/+12
| | | | | | | | | | | | | | | | | | TemplateTypeParmType with the substituted type directly; instead, replace it with a SubstTemplateTypeParmType which will note that the type was originally written as a template type parameter. This makes it reasonable to preserve source information even through template substitution. Also define the new SubstTemplateTypeParmType class, obviously. For consistency with current behavior, we stringize these types as if they were the underlying type. I'm not sure this is the right thing to do. At any rate, I paled at adding yet another clause to the don't-desugar 'if' statement, so I extracted a function to do it. The new function also does The Right Thing more often, I think: e.g. if we have a chain of typedefs leading to a vector type, we will now desugar all but the last one. llvm-svn: 84412
* Clone the full Type hierarchy into the TypeLoc hierarchy. NormalizeJohn McCall2009-10-181-38/+109
| | | | | | | | | | | | | TypeLoc class names to be $(Type classname)Loc. Rewrite the visitor. Provide skeleton implementations for all the new TypeLocs. Handle all cases in PCH. Handle a few more cases when inserting location information in SemaType. It should be extremely straightforward to add new location information to existing TypeLoc objects now. llvm-svn: 84386
* Switch to llvm::HashString.Daniel Dunbar2009-10-171-3/+4
| | | | llvm-svn: 84375
* Write the preprocessor block after we write out types + declarations,Douglas Gregor2009-10-171-1/+2
| | | | | | | | so that we catch any macros used within the declarations and types. Also, properly store a NULL selector. llvm-svn: 84334
* Merge the "types" and "declarations" blocks in the precompiled headerDouglas Gregor2009-10-171-35/+19
| | | | | | | | | | | | | | | format, so that we don't end up with multiple declaration and types blocks. Also, fix a few obscure bugs with PCH loading and generation: - If the DeclIDs DenseMap reallocates while we are writing a declaration (due to recursively writing other declarations), we could end up writing a bad ID to ExternalDefinitions. - When loading an ArrayLoc (part of DeclaratorInfo), we need to set the size expression to NULL if no size expression was provided. PCH -> AST rewriting is still partly broken, unfortunately. llvm-svn: 84293
* While writing source-location entries to a PCH file, go through anDouglas Gregor2009-10-161-7/+6
| | | | | | | interface that can load those source-location entries on demand (from another PCH file). llvm-svn: 84287
* Factor out routines to encode/decode DeclaratorInfos and move them into theJohn McCall2009-10-161-0/+79
| | | | | | core PCH reader/writer implementation files. llvm-svn: 84278
* Remove the ConstantArrayType subtypes. This information is preserved in theJohn McCall2009-10-161-17/+0
| | | | | | | | | | TypeLoc records for declarations; it should not be necessary to represent it directly in the type system. Please complain if you were using these classes and feel you can't replicate previous functionality using the TypeLoc API. llvm-svn: 84222
* Encode the Clang branch and Subversion revision into a PCH file, andDouglas Gregor2009-10-051-1/+13
| | | | | | | assume that PCH files from different Clang revisions are not compatible. Addresses <rdar://problem/7266572>. llvm-svn: 83323
* Introduce ObjCProtocolListType type subclass.Argyrios Kyrtzidis2009-09-291-0/+10
| | | | | | | | | This is used only for keeping detailed type source information for protocol references, it should not participate in the semantics of the type system. Its protocol list is not canonicalized. llvm-svn: 83093
* Refactor the representation of qualifiers to bring ExtQualType out of theJohn McCall2009-09-241-24/+44
| | | | | | | | Type hierarchy. Demote 'volatile' to extended-qualifier status. Audit our use of qualifiers and fix a few places that weren't dealing with qualifiers quite right; many more remain. llvm-svn: 82705
* Add missing PCH support for -fstack-protector.Daniel Dunbar2009-09-211-0/+1
| | | | llvm-svn: 82435
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-115/+115
| | | | llvm-svn: 81346
* Fix PR4922, where Sema would complete tentative definitions in nondeterminsticChris Lattner2009-09-081-7/+10
| | | | | | | | | | order because it was doing so while iterating over a densemap. There are still similar problems in other places, for example WeakUndeclaredIdentifiers is still written to the PCH file in a nondeterminstic order, and we emit warnings about #pragma weak in nondeterminstic order. llvm-svn: 81236
* Basic support for representing elaborated type specifiersJohn McCall2009-09-051-0/+6
| | | | | | | | | | | | | | | directly in the AST. The current thinking is to create these only in C++ mode for efficiency. But for now, they're not being created at all; patch to follow. This will let us do things like verify that tags match during template instantation, as well as signal that an elaborated type specifier was used for clients that actually care. Optimally, the TypeLoc hierarchy should be adjusted to carry tag location information as well. llvm-svn: 81057
* Save/load POSIXThreads flag for PCHDouglas Gregor2009-09-031-0/+1
| | | | llvm-svn: 80916
* Regularize the case and sort.Mike Stump2009-08-261-2/+2
| | | | llvm-svn: 80163
* Switch to StringRef based BitstreamWriter APIs, where appropriate.Daniel Dunbar2009-08-241-21/+13
| | | | | | - There is lots of non-endian safe code in here... :/ llvm-svn: 79905
* Switch TargetInfo to store an llvm::Triple.Daniel Dunbar2009-08-241-2/+3
| | | | | | - Primarily to discourage clients form making decisions based on the string. llvm-svn: 79901
* API changes to match llvm ToT.Chris Lattner2009-08-231-5/+5
| | | | llvm-svn: 79868
* Add a -fno-elide-constructors option to clang-cc.Anders Carlsson2009-08-221-0/+1
| | | | llvm-svn: 79782
* Make the new Objective-C "id" and "Class" redefinition types specialDouglas Gregor2009-08-211-0/+2
| | | | | | | types that are preloaded by the PCH file. Fixes PCH breakage introduced in r79248. llvm-svn: 79583
* map previously ignored __attribute((malloc)) to noalias attribute of llvm ↵Ryan Flynn2009-08-091-0/+1
| | | | | | function's return llvm-svn: 78541
* Introduce a new PragmaPack attribute, and use it for #pragma pack. The ↵Anders Carlsson2009-08-081-2/+5
| | | | | | | | PackedAttr now only represents __attribute__((packed)). This is necessary because #pragma pack and __attribute__((packed)) have different semantics. No functionality change yet, but this lays the groundwork for fixing a record layout bug. llvm-svn: 78483
* Make longjmp a real builtin.Mike Stump2009-07-281-0/+2
| | | | llvm-svn: 77291
* Remove the ObjCCategoryImpls vector from Sema class.Argyrios Kyrtzidis2009-07-211-11/+0
| | | | | | Use ObjCInterfaceDecl::getCategoryClassMethod() and ObjCInterfaceDecl::getCategoryInstanceMethod() for the same functionality. llvm-svn: 76510
* Remove ObjCQualifiedInterfaceType:-)Steve Naroff2009-07-181-21/+13
| | | | llvm-svn: 76321
* Implement the ObjC pseudo built-in types as clang "BuiltinType's". I say ↵Steve Naroff2009-07-151-0/+2
| | | | | | | | | | | | pseudo built-in types, since Sema still injects a typedef for recognition (i.e. they aren't truly built-ins from a parser perspective). This removes the static data/methods on ObjCObjectPointerType while preserving the nice API (no need to fiddle with ASTContext:-). This patch also adds Type::isObjCBuiltinType(). This should be the last fairly large patch related to recrafting the ObjC type system. The follow-on patches should be fairly small. llvm-svn: 75808
* Basic support for C++0x unicode types. Support for literals will follow in ↵Alisdair Meredith2009-07-141-0/+2
| | | | | | an incremental patch llvm-svn: 75622
* This patch includes a conceptually simple, but very intrusive/pervasive change. Steve Naroff2009-07-101-1/+1
| | | | | | | | | | | | 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
* Make ASTContext explicitly keep track of the declaration for the CDouglas Gregor2009-07-071-0/+1
| | | | | | | | | | | | | | | | | FILE type, rather than using name lookup to find FILE within the translation unit. Within precompiled headers, FILE is treated as yet another "special type" (like __builtin_va_list). This change should provide a performance improvement (not verified), since the lookup into the translation unit declaration forces the (otherwise unneeded) construction of a large hash table. More importantly, with precompiled headers, the construction of that table requires deserializing most of the top-level declarations from the precompiled header, which are then unused. Fixes PR 4509. llvm-svn: 74911
* Introduce the notion of "Relocatable" precompiled headers, which are builtDouglas Gregor2009-07-071-35/+94
| | | | | | | | | | | | with a particular system root directory and can be used with a different system root directory when the headers it depends on have been installed. Relocatable precompiled headers rewrite the file names of the headers used when generating the PCH file into the corresponding file names of the headers available when using the PCH file. Addresses <rdar://problem/7001604>. llvm-svn: 74885
* Keep track of the Expr used to describe the size of an array type,Douglas Gregor2009-07-061-0/+19
| | | | | | from Enea Zaffanella! llvm-svn: 74831
* Add support for retrieving the Doxygen comment associated with a givenDouglas Gregor2009-07-021-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-5/+4
| | | | | | | 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
* Implement enough of the 'auto' keyword so we can claim to support N2546.Anders Carlsson2009-06-261-0/+3
| | | | llvm-svn: 74307
* OpenCL 1.0 support: attributesNate Begeman2009-06-261-0/+6
| | | | llvm-svn: 74280
OpenPOWER on IntegriCloud