summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTReader.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use the ASTMutationListener to track added template specializations in a ↵Argyrios Kyrtzidis2010-10-281-7/+0
| | | | | | chained PCH. llvm-svn: 117533
* When de-serializing a type that is supposed to be canonical, callDouglas Gregor2010-10-261-0/+4
| | | | | | | | | | | | | getCanonicalType() to make sure that the type we got back is actually canonical. This is the case for most types, which always build a canonical type when given canonical components. However, some types that involve expressions in their canonicalization (e.g., array types with dependent sizes) don't always build canonical types from canonical components, because there is no such thing as a "canonical" expression. Therefore, we do this extra mapping to ensure that the canonical types we store are actually canonical. llvm-svn: 117344
* Put the mechanism in place to track modifications in an AST entity that were ↵Argyrios Kyrtzidis2010-10-241-2/+21
| | | | | | | | | | | | 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
* Simplify and "robust-ify" the way that CXXRecord references point to the ↵Argyrios Kyrtzidis2010-10-241-0/+3
| | | | | | | | definition data when loaded from PCH. Temporary disable 'test/PCH/chain-cxx.cpp' until a better way to fix it is in place. llvm-svn: 117234
* Substantially revise how clang computes the visibility of a declaration toJohn McCall2010-10-221-1/+1
| | | | | | | | more closely parallel the computation of linkage. This gets us to a state much closer to what gcc emits, modulo bugs, which will undoubtedly arise in abundance. llvm-svn: 117147
* Reorganize predefined macros for all Windows targets.Michael J. Spencer2010-10-211-0/+1
| | | | | | | | | | This adds an option to set the _MSC_VER macro without recompiling. This is very useful when testing compatibility with the Windows SDK and c++stdlib headers. -fmsc-version=<version> (defaults to VS2003 (1300)) llvm-svn: 116999
* Fix Whitespace.Michael J. Spencer2010-10-211-40/+40
| | | | llvm-svn: 116990
* Extend the preprocessing record and libclang with support forDouglas Gregor2010-10-201-16/+52
| | | | | | | | | inclusion directives, keeping track of every #include, #import, etc. in the translation unit. We keep track of the source location and kind of the inclusion, how the file name was spelled, and the underlying file to which the inclusion resolved. llvm-svn: 116952
* Read/write to/from PCH DeclarationNameLocs, DeclarationNameInfos and ↵Argyrios Kyrtzidis2010-10-151-0/+55
| | | | | | QualifierInfos (rdar://8513756). llvm-svn: 116598
* When performing typo correction, look through the set of knownDouglas Gregor2010-10-141-0/+62
| | | | | | | | | | | | | | | | | | | | identifiers to determine good typo-correction candidates. Once we've identified those candidates, we perform name lookup on each of them and the consider the results. This optimization makes typo correction > 2x faster on a benchmark example using a single typo (NSstring) in a tiny file that includes Cocoa.h from a precompiled header, since we are deserializing far less information now during typo correction. There is a semantic change here, which is interesting. The presence of a similarly-named entity that is not visible can now affect typo correction. This is both good (you won't get weird corrections if the thing you wanted isn't in scope) and bad (you won't get good corrections if there is a similarly-named-but-completely-unrelated thing). Time will tell whether it was a good choice or not. llvm-svn: 116528
* At Fariborz's request, a somewhat cleaner bit-combining hack.John McCall2010-10-141-3/+3
| | | | llvm-svn: 116524
* Allow deserialization of just the fields of a record, when we want to ↵Argyrios Kyrtzidis2010-10-141-7/+11
| | | | | | | | | | | | | 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 -fshort-enums (rdar://8490496).Argyrios Kyrtzidis2010-10-081-0/+1
| | | | llvm-svn: 116020
* Fix a marvelous chained AST writing bug, where we end up with theDouglas Gregor2010-10-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | following amusing sequence: - AST writing schedules writing a type X* that it had never seen before - AST writing starts writing another declaration, ends up deserializing X* from a prior AST file. Now we have two type IDs for the same type! - AST writer tries to write X*. It only has the lower-numbered ID from the the prior AST file, so references to the higher-numbered ID that was scheduled for writing go off into lalaland. To fix this, keep the higher-numbered ID so we end up writing the type twice. Since this issue occurs so rarely, and type records are generally rather small, I deemed this better than the alternative: to keep a separate mapping from the higher-numbered IDs to the lower-numbered IDs, which we would end up having to check whenever we want to deserialize any type. Fixes <rdar://problem/8511624>, I think. llvm-svn: 115647
* Give every file that ASTReader loads a type: module, PCH, precompiled ↵Sebastian Redl2010-10-051-8/+10
| | | | | | preamble or main file. Base Decls' PCHLevel on this to make it more sane. llvm-svn: 115626
* Thread PerFileData through the ASTReader again, this time with the LLVM changes.Sebastian Redl2010-10-051-195/+202
| | | | llvm-svn: 115625
* Implement chained PCH support for the macro definitions stored withinDouglas Gregor2010-10-021-11/+21
| | | | | | the "detailed" preprocessing record. llvm-svn: 115417
* Revert r115336 ("Thread PerFileData through everything."), becauseDouglas Gregor2010-10-011-202/+196
| | | | | | we're missing the corresponding changes in the LLVM repository. llvm-svn: 115340
* Thread PerFileData through everything. This allows us to remap stuff later.Sebastian Redl2010-10-011-196/+202
| | | | llvm-svn: 115336
* Record module loaders and module source order.Sebastian Redl2010-10-011-1/+7
| | | | llvm-svn: 115334
* Implement the C++0x "trailing return type" feature, e.g.,Douglas Gregor2010-10-011-0/+1
| | | | | | | | | | auto f(int) -> int from Daniel Wallin! (With a few minor bug fixes from me). llvm-svn: 115322
* If we get a TU_CONTEXT update from a chained PCH file before weDouglas Gregor2010-10-011-2/+14
| | | | | | | actually have an ASTContext, delay the processing of that update. Patch by Sebastian Redl! Fixes <rdar://problem/8499034>. llvm-svn: 115263
* Support implicit includes when generating a PCH and allow the user to pass a ↵Argyrios Kyrtzidis2010-09-301-1/+35
| | | | | | | | -include on the command line following the PCH include. Fixes rdar://7382084. llvm-svn: 115159
* Fix a bug in loading macro records. Fixes yet another crash in libclang.Sebastian Redl2010-09-281-4/+5
| | | | llvm-svn: 114940
* Fix a use of an invalidated reference due to a hash map reallocating.Sebastian Redl2010-09-281-3/+8
| | | | llvm-svn: 114937
* When chaining PCHs, only write PPRecords that don't come from PCH, and give ↵Sebastian Redl2010-09-271-1/+1
| | | | | | them the correct IDs. Fixes a crash in XCode. llvm-svn: 114913
* When setting the globally-visible declarations for a particularDouglas Gregor2010-09-241-5/+5
| | | | | | | | | | | | | identifier, we may have a Sema object but no translation unit scope (because parsing is finished). In this case, we still need to update the IdResolver, which might still be used when writing a PCH containing another PCH (without chaining). This bug manifested as a failure with precompiled preambles. Also, add a little environment-variable-sensitive logging for libclang. llvm-svn: 114774
* Change source manager serialization to be less tied to the PCH model.Sebastian Redl2010-09-221-13/+13
| | | | llvm-svn: 114575
* Only preload SLocEntries after the entire PCH chain was loaded.Sebastian Redl2010-09-221-15/+22
| | | | llvm-svn: 114518
* Reshuffle PerFileData's members to make more sense.Sebastian Redl2010-09-221-6/+7
| | | | llvm-svn: 114517
* Macro definitions in AST files have their own IDs.Sebastian Redl2010-09-151-1/+1
| | | | llvm-svn: 114014
* Replace loops with SmallVector::append.Benjamin Kramer2010-09-061-2/+1
| | | | llvm-svn: 113185
* Fix a C++ PCH problem which was exposed by r113019. ↵Argyrios Kyrtzidis2010-09-061-0/+2
| | | | | | CXXBaseOrMemberInitializer's IsWritten and source order is not set. llvm-svn: 113161
* Rename *PendingImplicitInstantiations to *PendingInstantiations. NoChandler Carruth2010-08-251-10/+9
| | | | | | functionality changed. llvm-svn: 112040
* Move more stuff out of Sema.h.John McCall2010-08-251-0/+1
| | | | llvm-svn: 112026
* AST reader support for having specializations of templates from earlier in ↵Sebastian Redl2010-08-241-0/+7
| | | | | | the chain. llvm-svn: 111985
* More header elimination. The goal of all this is to allow Parser toJohn McCall2010-08-241-0/+1
| | | | | | | #include Sema.h while keeping all the AST declarations opaque. That may not be reasonably attainable, though. llvm-svn: 111907
* Remove a header dependency from Sema.h at the cost of some type safety.John McCall2010-08-241-0/+1
| | | | | | If someone wants to fix this some other way.... llvm-svn: 111905
* Add testcase for C++ chained PCH and fix the bugs it uncovered in name lookup.Sebastian Redl2010-08-241-2/+4
| | | | llvm-svn: 111882
* Read the UPDATE_VISIBLE record, and add its visible decls to the lookup ↵Sebastian Redl2010-08-241-38/+74
| | | | | | tables. Also, free the lookup tables when destructing the ASTReader. llvm-svn: 111880
* Correctly initialize the visible decls pointer if there are no visible decls ↵Sebastian Redl2010-08-241-0/+2
| | | | | | for a record. llvm-svn: 111879
* Baby step towards supporting namespaces in chained PCH.Sebastian Redl2010-08-241-1/+1
| | | | llvm-svn: 111878
* DeclPtrTy -> Decl *John McCall2010-08-211-2/+2
| | | | llvm-svn: 111733
* Fix an issue with writing to PCH another included PCH, introduced by the ↵Argyrios Kyrtzidis2010-08-201-0/+67
| | | | | | | | | | | "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-35/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *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
* Introduce the mechanism for building an AST on-disk hash table for name ↵Argyrios Kyrtzidis2010-08-201-0/+164
| | | | | | lookup inside a DeclContext but don't use it yet. llvm-svn: 111635
* serialization::TypeID is used with or without qualifiers, both as index and ↵Argyrios Kyrtzidis2010-08-201-1/+1
| | | | | | | | as index + qualifiers. Disambiguate and provide some type safety by using a new class TypeIdx for the "TypeID as index" semantics. llvm-svn: 111630
* Share the common code of ComputeHash(Selector Sel) instead of keeping 2 ↵Argyrios Kyrtzidis2010-08-201-8/+2
| | | | | | | | copies in PCHReader and PCHWriter. No functionality change. llvm-svn: 111629
* Make sure to deallocate the identifier lookup tables and selector tablesDouglas Gregor2010-08-191-9/+15
| | | | | | when destroying an ASTReader. Plugs a leak that shows up in libclang. llvm-svn: 111488
* Rename pch namespace to serialization.Sebastian Redl2010-08-181-162/+163
| | | | llvm-svn: 111478
OpenPOWER on IntegriCloud