summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PCHReader.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Make changes to PCHReader to allow reading a PCH file without having a ↵Argyrios Kyrtzidis2009-06-191-341/+458
| | | | | | | | | | pre-initialized Preprocessor. -Introduce 'PCHReaderListener' which is an abstract interface for getting various information from the PCHReader. -If PCHReader is constructed without a Preprocessor, it can still load the file and invoke the callbacks of PCHReaderListener. -If PCHReader is constructed with an initialized Preprocessor, PCHValidator is used as a PCHReaderListener to validate the contents of the PCH file against the given Preprocessor. llvm-svn: 73741
* First step toward fixing <rdar://problem/6613046> refactor clang objc type ↵Steve Naroff2009-06-171-2/+4
| | | | | | | | | | | | 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
* If PCH refers to a file that doesn't exist anymore, emit a nice errorChris Lattner2009-06-151-3/+10
| | | | | | | | like: fatal error: could not find file '1.h' referenced by PCH file instead of aborting with an assertion failure, PR4219 llvm-svn: 73371
* Move CharIsSigned from TargetInfo to LangOptions.Eli Friedman2009-06-051-0/+1
| | | | llvm-svn: 72928
* Reintroduce the home for exception specs, and make Sema fill it. However, ↵Sebastian Redl2009-05-271-1/+9
| | | | | | 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
* Fix lots of PCH crashes caused by the new assertions inDouglas Gregor2009-05-221-4/+4
| | | | | | | llvm::SmallVector, using data() instead of &[0]. The PCH testsuite now runs cleanly (again). llvm-svn: 72292
* Use v.data() instead of &v[0] when SmallVector v might be empty.Jay Foad2009-05-211-2/+2
| | | | llvm-svn: 72210
* Disable access control by default. It can be enabled with the ↵Anders Carlsson2009-05-131-0/+1
| | | | | | -faccess-control option. When we have better support for it, we can enable it by default again. llvm-svn: 71706
* Make precompiled headers work with -E. When we're only preprocessingDouglas Gregor2009-05-121-0/+85
| | | | | | | (with -E), we turn the PCH include into an implicit include of the file from which the PCH file was generated. llvm-svn: 71534
* Implement C++0x nullptr.Sebastian Redl2009-05-101-0/+1
| | | | llvm-svn: 71405
* Back out r70506 (exception spec in AST) again. We won't have exception specs ↵Sebastian Redl2009-05-061-9/+1
| | | | | | until we've had a lot more discussion. llvm-svn: 71125
* Make a home for exception specs in the AST. Now Sema can hook them up.Sebastian Redl2009-04-301-1/+9
| | | | llvm-svn: 70506
* initial support for __[u]int128_t, which should be basicallyChris Lattner2009-04-301-0/+2
| | | | | | | | compatible with VC++ and GCC. The codegen/mangling angle hasn't been fully ironed out yet. Note that we accept int128_t even in 32-bit mode, unlike gcc. llvm-svn: 70464
* Make all PCH-incompatibility warnings into errors, and abortDouglas Gregor2009-04-281-10/+1
| | | | | | | compilation if the user requested a PCH file but no such PCH file exists. llvm-svn: 70332
* Make the PCH reader use the diagnostics system for its complaints.Douglas Gregor2009-04-281-44/+44
| | | | llvm-svn: 70330
* Optimize IdentifierInfo storage within the precompiled header. We'veDouglas Gregor2009-04-281-9/+4
| | | | | | now gotten back about 180k of the 500k we lost. llvm-svn: 70326
* Implement a minor space optimization for the PCH identifier table,Douglas Gregor2009-04-281-2/+18
| | | | | | | | which eliminates the storage for IdentifierInfo in the "uninteresting identifier" cases. Sadly, this only brought back 7k of the 500k we lost :( llvm-svn: 70325
* Replace a lame fprintf with a slightly-less lame diagnosticDouglas Gregor2009-04-281-4/+4
| | | | llvm-svn: 70322
* Implement checking for macro definitions that occur on the commandDouglas Gregor2009-04-281-7/+22
| | | | | | | | line when using a PCH that were not provided when building the PCH file. If those names were used as identifiers somewhere in the PCH file, reject the PCH file. llvm-svn: 70321
* Revert r70075 and r70078, which reorganized the PCH on-disk hash tableDouglas Gregor2009-04-281-41/+8
| | | | | | | | | | for identifiers to separate "interesting" from "uninteresting" identifiers. However, to cope with compiler invocations where the predefines buffers mismatch, we need to be able to search the complete identifier table. Cocoa.h.pch is now about 500k larger that it used to be :( llvm-svn: 70320
* Allow some differences between the predefines buffer used to build aDouglas Gregor2009-04-281-42/+182
| | | | | | | | | | | | | PCH file and the predefines buffer used when including the PCH file. We (explicitly) detect conflicting macro definitions (rejecting the PCH file) and about missing macro definitions (they'll be automatically pulled from the PCH file anyway). We're missing some checking to make sure that new macro definitions won't have any impact on the PCH file itself (e.g., #define'ing an identifier that the PCH file used). llvm-svn: 70316
* Remove unused LangOptions NoExtensions and Boolean.Eli Friedman2009-04-281-2/+0
| | | | llvm-svn: 70282
* Add a header containing the Clang version; make the driver use thisDouglas Gregor2009-04-271-1/+7
| | | | | | | | | Clang version value rather than hard-coding "1.0". Add PCH and Clang version information into the PCH file. Reject PCH files with the wrong version information. llvm-svn: 70264
* fix test/PCH/method_pool.mChris Lattner2009-04-271-1/+1
| | | | llvm-svn: 70263
* -E, -Eonly and -parse-noop now work with PCH!Chris Lattner2009-04-271-0/+2
| | | | llvm-svn: 70259
* Teach PCH that ASTContext is optional. Move -parse-noop and -Eonly (so far)Chris Lattner2009-04-271-74/+77
| | | | | | | processing to after PCH is loaded. -Eonly and -parse-noop are close to working with PCH now but are not quite there yet. llvm-svn: 70257
* Be more careful in our teardown of the PCHReader after deciding toDouglas Gregor2009-04-271-0/+8
| | | | | | ignore a PCH file. llvm-svn: 70251
* Add Sema::ExtVectorDecls and Sema::ObjCCategoryImpls to the PCH file. Since ↵Douglas Gregor2009-04-271-0/+29
| | | | | | these vectors are very, very rarely used and, when used in headers, and even when used are relatively small, we load them eagerly. llvm-svn: 70240
* shrink SOURCE_LOCATION_OFFSETS to use 4-byte entries instead of 8-byteChris Lattner2009-04-271-1/+1
| | | | | | entries, shaving 100K off the PCH file for cocoa. llvm-svn: 70228
* Implement caching of stat() calls for precompiled headers, which isDouglas Gregor2009-04-271-1/+125
| | | | | | | | essentially the same thing we do with pretokenized headers. stat() caching improves performance of the Cocoa-prefixed "Hello, World" by 45%. llvm-svn: 70223
* encode the type and decl offsets with 32-bits for entry insteadChris Lattner2009-04-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of 64 bits. This cuts 400KB off the PCH file for cocoa (7.1 -> 6.7MB): Before: Record Histogram: Count # Bits % Abv Record Kind 1 14296 SOURCE_LOCATION_PRELOADS 1 1699598 100.00 SOURCE_LOCATION_OFFSETS 1 1870766 100.00 METHOD_POOL 1 212988 100.00 SELECTOR_OFFSETS 1 88 STATISTICS 1 106 SPECIAL_TYPES 1 18033788 100.00 IDENTIFIER_TABLE 1 1806428 100.00 IDENTIFIER_OFFSET 1 170 100.00 TARGET_TRIPLE 1 268 LANGUAGE_OPTIONS 1 5168252 100.00 DECL_OFFSET 1 952700 100.00 TYPE_OFFSET After: Record Histogram: Count # Bits % Abv Record Kind 1 14296 SOURCE_LOCATION_PRELOADS 1 1699598 100.00 SOURCE_LOCATION_OFFSETS 1 1870766 100.00 METHOD_POOL 1 212988 100.00 SELECTOR_OFFSETS 1 88 STATISTICS 1 106 SPECIAL_TYPES 1 18033788 100.00 IDENTIFIER_TABLE 1 1806428 100.00 IDENTIFIER_OFFSET 1 170 100.00 TARGET_TRIPLE 1 268 LANGUAGE_OPTIONS 1 2584156 100.00 DECL_OFFSET 1 476380 100.00 TYPE_OFFSET llvm-svn: 70216
* fix a couple more places that should be using the DeclCursor instead Chris Lattner2009-04-271-11/+10
| | | | | | of the normal stream cursor. llvm-svn: 70198
OpenPOWER on IntegriCloud