summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PCHReader.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Track source information for template arguments and template specializationJohn McCall2009-10-291-1/+27
| | | | | | | 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
* Add comment.Ted Kremenek2009-10-231-0/+3
| | | | llvm-svn: 84930
* Fix integer overflow in PCHReader when reading the length of anTed Kremenek2009-10-231-1/+1
| | | | | | | | | | | | | | | | | identifier. This caused a crash when reading PCH files that contained long identifier names. The issue is that 'StrLenPtr' was previously a 'const char *', meaning the byte loaded from it would be interpretted as a signed integer. If the topmost bit was set, conversion to 'unsigned' would extend that bit, causing an overflow. The solution is to make 'StrLenPtr' an 'unsigned char *', always treating the value as an unsigned integer. This fixes: <rdar://problem/7328900> llvm-svn: 84925
* FunctionTypeLocs don't necessarily provide ParmVarDecls, so don't crash ifJohn McCall2009-10-231-1/+1
| | | | | | one was PCH'ed without any. llvm-svn: 84920
* 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/+3
| | | | | | 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/+2
| | | | | | | 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-1/+1
| | | | llvm-svn: 84436
* When performing template-substitution into a type, don't just replace theJohn McCall2009-10-181-0/+13
| | | | | | | | | | | | | | | | | | 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-36/+111
| | | | | | | | | | | | | 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
* Merge the "types" and "declarations" blocks in the precompiled headerDouglas Gregor2009-10-171-15/+9
| | | | | | | | | | | | | | | 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
* Factor out routines to encode/decode DeclaratorInfos and move them into theJohn McCall2009-10-161-0/+80
| | | | | | core PCH reader/writer implementation files. llvm-svn: 84278
* Add support for a chain of stat caches in the FileManager, rather thanDouglas Gregor2009-10-161-12/+14
| | | | | | | | | only supporting a single stat cache. The immediate benefit of this change is that we can now generate a PCH/AST file when including another PCH file; in the future, the chain of stat caches will likely be useful with multiple levels of PCH files. llvm-svn: 84263
* Remove the ConstantArrayType subtypes. This information is preserved in theJohn McCall2009-10-161-24/+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-3/+19
| | | | | | | 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-17/+10
| | | | | | | | 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
* Allow PCH files to be read from stdin.Daniel Dunbar2009-09-221-1/+6
| | | | llvm-svn: 82525
* Change all the Type::getAsFoo() methods to specializations of Type::getAs().John McCall2009-09-211-3/+3
| | | | | | | | | | | Several of the existing methods were identical to their respective specializations, and so have been removed entirely. Several more 'leaf' optimizations were introduced. The getAsFoo() methods which imposed extra conditions, like getAsObjCInterfacePointerType(), have been left in place. llvm-svn: 82501
* Add missing PCH support for -fstack-protector.Daniel Dunbar2009-09-211-1/+6
| | | | llvm-svn: 82435
* PCH: When deserializing an explicit "external definition", don't pass it to ↵Daniel Dunbar2009-09-171-3/+3
| | | | | | | | HandleTopLevelDecl -- this is already being done inside the reader. This is something of a hack, since whether the reader actually did this depends on the "isConsumerInterestedIn" predicate. I think we need to rework how this works, but I need to discuss with Doug. llvm-svn: 82111
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-151/+151
| | | | llvm-svn: 81346
* Fix PR4922, where Sema would complete tentative definitions in nondeterminsticChris Lattner2009-09-081-0/+1
| | | | | | | | | | 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/+7
| | | | | | | | | | | | | | | 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
* Add basic support for -pthread.Daniel Dunbar2009-09-031-0/+1
| | | | | | - Patch by David Chisnall, with PCH and Darwin support mixed in. llvm-svn: 80883
* Switch TargetInfo to store an llvm::Triple.Daniel Dunbar2009-08-241-2/+2
| | | | | | - Primarily to discourage clients form making decisions based on the string. llvm-svn: 79901
* 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/+6
| | | | | | | types that are preloaded by the PCH file. Fixes PCH breakage introduced in r79248. llvm-svn: 79583
* Introduce the canonical type smart pointers, and use them in a few places toDouglas Gregor2009-08-051-3/+3
| | | | | | tighten up the static type system. llvm-svn: 78164
* Change uses of:Ted Kremenek2009-07-291-3/+3
| | | | | | | | | | | | | | | | | | | | 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
* Make longjmp a real builtin.Mike Stump2009-07-281-0/+22
| | | | llvm-svn: 77291
* Remove the ObjCCategoryImpls vector from Sema class.Argyrios Kyrtzidis2009-07-211-15/+0
| | | | | | Use ObjCInterfaceDecl::getCategoryClassMethod() and ObjCInterfaceDecl::getCategoryInstanceMethod() for the same functionality. llvm-svn: 76510
* Remove ObjCQualifiedInterfaceType:-)Steve Naroff2009-07-181-8/+3
| | | | llvm-svn: 76321
* Fix a comment.Zhongxing Xu2009-07-181-1/+1
| | | | llvm-svn: 76303
* 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
* 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-3/+3
| | | | | | | | | | | | 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/+11
| | | | | | | | | | | | | | | | | 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-11/+48
| | | | | | | | | | | | 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
* Fix PR 4489, a crash in PCH loading that occurs when loading the nameDouglas Gregor2009-07-061-20/+78
| | | | | | | | | | of a top-level declaration loads another top-level declaration of the same name whose type depends on the first declaration having been completed. This commit breaks the circular dependency by delaying loads of top-level declarations triggered by loading a name until we are no longer recursively loading types or declarations. llvm-svn: 74847
* Keep track of the Expr used to describe the size of an array type,Douglas Gregor2009-07-061-2/+30
| | | | | | from Enea Zaffanella! llvm-svn: 74831
* Add support for retrieving the Doxygen comment associated with a givenDouglas Gregor2009-07-021-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Write/Read new Language OptionsNate Begeman2009-06-251-0/+2
| | | | llvm-svn: 74221
* PCH support for OpenCL language optionsNate Begeman2009-06-251-0/+2
| | | | llvm-svn: 74220
* Add a DecltypeType type.Anders Carlsson2009-06-241-1/+4
| | | | llvm-svn: 74099
* Fix bug in the new PCHReader constructor. PP and Context should be ↵Argyrios Kyrtzidis2009-06-191-1/+1
| | | | | | initialized to 0. llvm-svn: 73762
OpenPOWER on IntegriCloud