summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
Commit message (Collapse)AuthorAgeFilesLines
* In the latest episode of "Deserializing bugs caused by accessors" the series ↵Argyrios Kyrtzidis2011-01-031-9/+9
| | | | | | | | | | reached a thrilling climax when FunctionDecl::setPure crashed a poor user's code. Remove the use of this accessor when deserializing, along with several other in the neighborhood. Fixes rdar://8759653. llvm-svn: 122756
* Implement support for pack expansions whose pattern is a non-typeDouglas Gregor2011-01-032-2/+20
| | | | | | | | | | | | | | | | | template argument (described by an expression, of course). For example: template<int...> struct int_tuple { }; template<int ...Values> struct square { typedef int_tuple<(Values*Values)...> type; }; It also lays the foundation for pack expansions in an initializer-list. llvm-svn: 122751
* The -fshort-wchar option causes wchar_t to become unsigned, in addition to beingChris Lattner2010-12-251-1/+2
| | | | | | | 16-bits in size. Implement this by splitting WChar into two enums, like we have for char. This fixes a miscompmilation of XULRunner, PR8856. llvm-svn: 122558
* Add an AST representation for non-type template parameterDouglas Gregor2010-12-232-1/+3
| | | | | | | | | | | | | | packs, e.g., template<typename T, unsigned ...Dims> struct multi_array; along with semantic analysis support for finding unexpanded non-type template parameter packs in types, expressions, and so on. Template instantiation involving non-type template parameter packs probably doesn't work yet. That'll come soon. llvm-svn: 122527
* Add -fobjc-default-synthesized-properties flagTed Kremenek2010-12-232-0/+5
| | | | | | | | | | | | to allow us to explicitly control whether or not Objective-C properties are default synthesized. Currently this feature only works when using the -fobjc-non-fragile-abi2 flag (so there is no functionality change), but we can now turn off this feature without turning off all the features coupled with -fobjc-non-fragile-abi2. llvm-svn: 122519
* Replace all uses of PathV1::makeAbsolute with PathV2::fs::make_absolute.Michael J. Spencer2010-12-211-4/+5
| | | | llvm-svn: 122340
* Introduce a new type, PackExpansionType, to capture types that areDouglas Gregor2010-12-202-0/+23
| | | | | | | | | | | | | | | | | | | | pack expansions, e.g. given template<typename... Types> struct tuple; template<typename... Types> struct tuple_of_refs { typedef tuple<Types&...> types; }; the type of the "types" typedef is a PackExpansionType whose pattern is Types&. This commit introduces support for creating pack expansions for template type arguments, as above, but not for any other kind of pack expansion, nor for any form of instantiation. llvm-svn: 122223
* Replace all uses of PathV1::isAbsolute with PathV2::is_{absolute,relative}.Michael J. Spencer2010-12-171-1/+1
| | | | llvm-svn: 122087
* MemoryBuffer API update.Michael J. Spencer2010-12-161-1/+1
| | | | llvm-svn: 121956
* Fix diagnostic pragmas.Argyrios Kyrtzidis2010-12-152-2/+3
| | | | | | | | | | | | Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state. Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect a lot of places, like C++ inline methods, template instantiations, the lexer, etc. Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location. Fixes rdar://8365684. llvm-svn: 121873
* Restore r121752 without modification.John McCall2010-12-141-14/+15
| | | | llvm-svn: 121763
* Pull out r121752 in case it's causing the selfhost breakage.John McCall2010-12-141-15/+14
| | | | llvm-svn: 121759
* Factor out most of the extra state in a FunctionProtoType into a separateJohn McCall2010-12-141-14/+15
| | | | | | | class to be passed around. The line between argument and return types and everything else is kindof vague, but I think it's justifiable. llvm-svn: 121752
* Variadic templates: extend Type, NestedNameSpecifier, TemplateName,Douglas Gregor2010-12-132-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | and TemplateArgument with an operation that determines whether there are any unexpanded parameter packs within that construct. Use this information to diagnose the appearance of the names of parameter packs that have not been expanded (C++ [temp.variadic]p5). Since this property is checked often (every declaration, ever expression statement, etc.), we extend Type and Expr with a bit storing the result of this computation, rather than walking the AST each time to determine whether any unexpanded parameter packs occur. This commit is deficient in several ways, which will be remedied with future commits: - Expr has a bit to store the presence of an unexpanded parameter pack, but it is never set. - The error messages don't point out where the unexpanded parameter packs were named in the type/expression, but they should. - We don't check for unexpanded parameter packs in all of the places where we should. - Testing is sparse, pending the resolution of the above three issues. llvm-svn: 121724
* Keep the source location of the selector in ObjCMessageExpr.Argyrios Kyrtzidis2010-12-102-2/+4
| | | | llvm-svn: 121516
* Eliminate the branching in QualType::getTypePtr() by providing aDouglas Gregor2010-12-102-3/+9
| | | | | | | | | | | | | | | | | | | | common base for ExtQuals and Type that stores the underlying type pointer. This results in a 2% performance win for -emit-llvm on a typical C file, with 1% memory growth in the AST. Note that there is an API change in this optimization: QualType::getTypePtr() can no longer be invoked on a NULL QualType. If the QualType might be NULL, use QualType::getTypePtrOrNull(). I've audited all uses of getTypePtr() in the code base and changed the appropriate uses over to getTypePtrOrNull(). A future optimization opportunity would be to distinguish between cast/dyn_cast and cast_or_null/dyn_cast_or_null; for the former, we could use getTypePtr() rather than getTypePtrOrNull(), to take another branch out of the cast/dyn_cast implementation. llvm-svn: 121489
* Added ParenType type node.Abramo Bagnara2010-12-102-0/+22
| | | | llvm-svn: 121488
* It's kindof silly that ExtQuals has an ASTContext&, and we can use thatJohn McCall2010-12-101-1/+1
| | | | | | | | | | space better. Remove this reference. To make that work, change some APIs (most importantly, getDesugaredType()) to take an ASTContext& if they need to return a QualType. Simultaneously, diminish the need to return a QualType by introducing some useful APIs on SplitQualType, which is just a std::pair<const Type *, Qualifiers>. llvm-svn: 121478
* Use error_code instead of std::string* for MemoryBuffer.Michael J. Spencer2010-12-091-3/+7
| | | | llvm-svn: 121378
* When an "inline" declaration was followed by a definition not markedDouglas Gregor2010-12-092-1/+3
| | | | | | | | | | | | | "inline", we weren't giving the definition weak linkage because the "inline" bit wasn't propagated. This was a longstanding FIXME that, somehow, hadn't triggered a bug in the wild. Fix this problem by tracking whether any declaration was marked "inline", and clean up the semantics of GNU's "extern inline" semantics calculation based on this change. Fixes <rdar://problem/8740363>. llvm-svn: 121373
* Remove the TypesCompatibleExprClass AST node. Merge its functionality into ↵Francois Pichet2010-12-083-26/+2
| | | | | | BinaryTypeTraitExpr. llvm-svn: 121298
* Type traits intrinsic implementation: __is_base_of(T, U)Francois Pichet2010-12-072-0/+27
| | | | | | New AST node introduced: BinaryTypeTraitExpr; to be reused for more intrinsics. llvm-svn: 121074
* Re-implement caching for the linkage calculation of declarations.Douglas Gregor2010-12-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | My previous attempt at solving the compile-time problem with many redeclarations of the same entity cached both linkage and visibility, while this patch only tackles linkage. There are several reasons for this difference: - Linkage is a language concept, and is evaluated many times during semantic analysis and codegen, while visibility is only a code-generation concept that is evaluated only once per (unique) declaration. Hence, we *must* optimize linkage calculations but don't need to optimize visibility computation. - Once we know the linkage of a declaration, subsequent redeclarations can't change that linkage. Hence, cache invalidation is far simpler than for visibility, where a later redeclaration can completely change the visibility. - We have 3 spare bits in Decl to store the linkage cache, so the cache doesn't increase the size of declarations. With the visibility+linkage cache, NamedDecl got larger. llvm-svn: 121023
* Revert r120808, my previous implementation of caching for the linkageDouglas Gregor2010-12-061-2/+2
| | | | | | | | | and visibility of declarations, because it was extremely messy and it increased the size of NamedDecl. An improved implementation is forthcoming. llvm-svn: 121012
* Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall2010-12-062-7/+7
| | | | | | reason this is limited to C++, and it's certainly not limited to temporaries. llvm-svn: 120996
* More anonymous struct/union redesign. This one deals with anonymous field ↵Francois Pichet2010-12-042-8/+20
| | | | | | | | | | | | | | | | used in a constructor initializer list: struct X { X() : au_i1(123) {} union { int au_i1; float au_f1; }; }; clang will now deal with au_i1 explicitly as an IndirectFieldDecl. llvm-svn: 120900
* Added struct/class syntactic info for c++0x scoped enum.Abramo Bagnara2010-12-032-0/+2
| | | | llvm-svn: 120828
* Implement caching for the linkage and visibility calculations ofDouglas Gregor2010-12-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | declarations. The motivation for this patch is that linkage/visibility computations are linear in the number of redeclarations of an entity, and we've run into a case where a single translation unit has > 6500 redeclarations of the same (unused!) external variable. Since each redeclaration involves a linkage check, the resulting quadratic behavior makes Clang slow to a crawl. With this change, a simple test with 512 redeclarations of a variable syntax-checks ~20x faster than before. That said, I hate this change, and will probably end up reverting it in a few hours. Reasons to hate it: - It makes NamedDecl larger, since we don't have enough free bits in Decl to squeeze in the extra information about caching. - There are way too many places where we need to invalidate this cache, because the visibility of a declaration can change due to redeclarations (!). Despite self-hosting and passing the testsuite, I have no confidence that I've found all of places where this cache needs to be invalidated. llvm-svn: 120808
* Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ↵John McCall2010-12-022-49/+41
| | | | | | | | ObjCPropertyRefExpr into the latter. llvm-svn: 120643
* Serialization: support for CUDA language extensionsPeter Collingbourne2010-12-012-0/+3
| | | | llvm-svn: 120588
* When using a precompiled preamble with detailed preprocessing records,Douglas Gregor2010-11-303-38/+81
| | | | | | | | | | trap the serialized preprocessing records (macro definitions, macro instantiations, macro definitions) from the generation of the precompiled preamble, then replay those when walking the list of preprocessed entities. This eliminates a bug where clang_getCursor() wasn't able to find preprocessed-entity cursors in the preamble. llvm-svn: 120396
* When loading a precompiled preamble, use the file ID of theDouglas Gregor2010-11-301-0/+12
| | | | | | | | | | | | precompiled preamble as the "main" source file's file ID within the source manager. This makes compiling with a precompiled preamble produce the same source locations as when compiling without the precompiled preamble; prior to this change, we ended up with different file IDs for source locations within the precompiled preamble vs. those after the precompiled preamble, even for entities (e.g., preprocessing entities) in the same file. llvm-svn: 120390
* Merge System into Support.Michael J. Spencer2010-11-292-2/+2
| | | | llvm-svn: 120297
* Hide a bunch of symbols.Benjamin Kramer2010-11-251-6/+8
| | | | llvm-svn: 120153
* change the 'is directory' indicator to be a null-or-notChris Lattner2010-11-231-2/+3
| | | | | | | | | pointer that is passed down through the APIs, and make FileSystemStatCache::get be the one that filters out directory lookups that hit files. This also paves the way to have stat queries be able to return opened files. llvm-svn: 120060
* simplify the cache miss handling code, eliminating CacheMissing.Chris Lattner2010-11-231-1/+1
| | | | llvm-svn: 120038
* PCH files only cache successful stats. Remove the code that reads/writes Chris Lattner2010-11-232-31/+12
| | | | | | the result code of the stat to/from the PCH file since it is always 0. llvm-svn: 120031
* rework the stat cache, pulling it out of FileManager.h intoChris Lattner2010-11-233-13/+16
| | | | | | | its own header and giving it some more structure. No functionality change. llvm-svn: 120030
* tidy up. Split FileManager::getBufferForFile intoChris Lattner2010-11-231-3/+2
| | | | | | | | | | two copies, since they are fundamentally different operations and the StringRef one should go away (it shouldn't be part of FileManager at least). Remove some dead arguments. llvm-svn: 120013
* now the FileManager has a FileSystemOpts ivar, stop threadingChris Lattner2010-11-231-9/+4
| | | | | | | | | FileSystemOpts through a ton of apis, simplifying a lot of code. This also fixes a latent bug in ASTUnit where it would invoke methods on FileManager without creating one in some code paths in cindextext. llvm-svn: 120010
* remove old compatibility APIs, use StringRef versions instead.Chris Lattner2010-11-211-2/+2
| | | | llvm-svn: 119935
* Major anonymous union/struct redesign.Francois Pichet2010-11-212-0/+28
| | | | | | | | | | | A new AST node is introduced: def IndirectField : DDecl<Value>; IndirectFields are injected into the anonymous's parent scope and chain back to the original field. Name lookup for anonymous entities now result in an IndirectFieldDecl instead of a FieldDecl. There is no functionality change, the code generated should be the same. llvm-svn: 119919
* Revert r119838 "Don't warn for empty 'if' body if there is a macro that ↵Argyrios Kyrtzidis2010-11-202-2/+2
| | | | | | | | | | expands to nothing" and use a better and more general approach, where NullStmt has a flag to indicate whether it was preceded by an empty macro. Thanks to Abramo Bagnara for the hint! llvm-svn: 119887
* Don't warn for empty 'if' body if there is a macro that expands to nothing, e.g:Argyrios Kyrtzidis2010-11-192-0/+2
| | | | | | | | | if (condition) CALL(0); // empty macro but don't warn for empty body. Fixes rdar://8436021. llvm-svn: 119838
* Refactoring of Diagnostic class.Argyrios Kyrtzidis2010-11-181-1/+1
| | | | | | | | | | | -Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class. -DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units. -The rest of the state in Diagnostic object is considered related and tied to one translation unit. -Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a SourceLocation instead of a FullSourceLoc. -Reflect the changes to various interfaces. llvm-svn: 119730
* Calculate the value kind of an expression when it's created andJohn McCall2010-11-182-6/+10
| | | | | | | | | | | | | store it on the expression node. Also store an "object kind", which distinguishes ordinary "addressed" l-values (like variable references and pointer dereferences) and bitfield, @property, and vector-component l-values. Currently we're not using these for much, but I aim to switch pretty much everything calculating l-valueness over to them. For now they shouldn't necessarily be trusted. llvm-svn: 119685
* For an Objective-C @synthesize statement, e.g.,Douglas Gregor2010-11-172-3/+6
| | | | | | | | | @synthesize foo = _foo; keep track of the location of the ivar ("_foo"). Teach libclang to visit the ivar as a member reference. llvm-svn: 119447
* Add a new expression kind, OpaqueValueExpr, which is useful forJohn McCall2010-11-152-0/+19
| | | | | | | certain internal type-checking procedures as well as for representing certain implicitly-generated operations. Uses to follow. llvm-svn: 119289
* Add a variant of GCC-style vector types for ARM NEON.Bob Wilson2010-11-102-3/+3
| | | | | | | | | NEON vector types need to be mangled in a special way to comply with ARM's ABI, similar to some of the AltiVec-specific vector types. This patch is mostly just renaming a bunch of "AltiVecSpecific" things, since they will no longer be specific to AltiVec. Besides that, it just adds the new "NeonVector" enum. llvm-svn: 118724
* Replace UsingDecl's SmallPtrSet of UsingShadowDecls with a linked list to ↵Argyrios Kyrtzidis2010-11-102-16/+4
| | | | | | | | avoid leaking memory. Fixes rdar://8649963. llvm-svn: 118674
OpenPOWER on IntegriCloud