summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriterDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Introduce a module import declaration, so that we properly represent, e.g.,Douglas Gregor2011-12-021-0/+19
| | | | | | | | __import_module__ std.vector; in the AST. llvm-svn: 145725
* Infer the submodule ID for a given declaration based on the locationDouglas Gregor2011-12-011-0/+8
| | | | | | | of that declaration, and encode the submodule ID in each declaration stored in an AST file. llvm-svn: 145555
* [PCH] Check for isTopLevelDeclInObjCContainer when picking abbreviations.Argyrios Kyrtzidis2011-11-231-0/+5
| | | | llvm-svn: 145110
* [libclang] Fix operations (token annotation, getting cursor, etc.) with a ↵Argyrios Kyrtzidis2011-11-231-0/+8
| | | | | | | | | | | | | | | file region inside an objc container that "contains" other file-level declarations. When getting the array of file-level declarations that overlap with a file region, we failed to report that the region overlaps with an objc container, if the container had other file-level declarations declared lexically inside it. Fix this by marking such declarations as "isTopLevelDeclInObjCContainer" in the AST and handling them appropriately. llvm-svn: 145109
* Use Decl's isImplicit field to indicate whether an ObjCInterfaceDecl is ↵Argyrios Kyrtzidis2011-11-151-1/+0
| | | | | | | | 'ImplicitInterfaceDecl', no need to store it in another field. llvm-svn: 144624
* [PCH] Now that we store the location of a decl outside its recordArgyrios Kyrtzidis2011-10-311-1/+2
| | | | | | make sure that we keep track of locations of replaced decls as well. llvm-svn: 143341
* [PCH] In ASTWriter::associateDeclWithFile don't bother finding the file locArgyrios Kyrtzidis2011-10-281-4/+2
| | | | | | if we are not interested in the decl. llvm-svn: 143255
* [PCH] Keep track of file-level declarations that are contained by files.Argyrios Kyrtzidis2011-10-281-3/+10
| | | | | | | | | | | | Introduce a FILE_SORTED_DECLS [de]serialization record that contains a file sorted array of file-level DeclIDs in a PCH/Module. The rationale is to allow "targeted" deserialization of decls inside a range of a source file. Cocoa PCH increased by 0.8% Difference of creation time for Cocoa PCH is below the noise level. llvm-svn: 143238
* [PCH] Pull the location out of the serialized declarations and put it in the ↵Argyrios Kyrtzidis2011-10-271-10/+4
| | | | | | | | | | | array of decl bit offsets. This allows us to easily get at the location of a decl without deserializing it. It increases size of Cocoa PCH by only 0.2%. llvm-svn: 143123
* Eliminate a hang while loading a sequence of redeclarable entities. InDouglas Gregor2011-10-261-9/+11
| | | | | | | | | | | essence, the redeclaration chain for a class could end up in an inconsistent state while deserializing multiple declarations in that chain, where the circular linked list was not, in fact, circular. Since only two redeclarations of the same entity will get loaded when we're in this state, restore circularity when both have been loaded. Fixes <rdar://problem/10324940> / PR11195. llvm-svn: 143037
* Keep track when a ObjC interface/protocol was initially created as a forward ↵Argyrios Kyrtzidis2011-10-171-0/+2
| | | | | | reference. llvm-svn: 142230
* [PCH] Serialize info about redeclared objc methods.Argyrios Kyrtzidis2011-10-141-0/+8
| | | | llvm-svn: 141964
* Rename TagDecl::isDefinition -> isCompleteDefinitionJohn McCall2011-10-071-4/+4
| | | | | | | for better self-documenting code, since the semantics are subtly different from getDefinition(). llvm-svn: 141355
* Added a flag to identify resolved overloaded function references.Abramo Bagnara2011-10-051-0/+1
| | | | llvm-svn: 141171
* Improve location fidelity of objc decls.Argyrios Kyrtzidis2011-10-041-2/+1
| | | | | | | | -Add the location of the class name to all objc container decls, not just ObjCInterfaceDecl. -Make objc decls consistent with the rest of the NamedDecls and have getLocation() point to the class name, not the location of '@'. llvm-svn: 141061
* Allow getting all source locations of selector identifiers in a ObjCMethodDecl.Argyrios Kyrtzidis2011-10-031-0/+8
| | | | | | | | | | | | | Instead of always storing all source locations for the selector identifiers we check whether all the identifiers are in a "standard" position; "standard" position is -Immediately before the arguments: -(id)first:(int)x second:(int)y; -With a space between the arguments: -(id)first: (int)x second: (int)y; -For nullary selectors, immediately before ';': -(void)release; In such cases we infer the locations instead of storing them. llvm-svn: 140989
* Don't keep NumSelectorArgs in the ObjCMethodDecl, the number can be derived ↵Argyrios Kyrtzidis2011-10-031-1/+0
| | | | | | from the selector. llvm-svn: 140983
* Mark a TagDecl when it is free standing (e.g. "struct foo;")Argyrios Kyrtzidis2011-09-301-0/+3
| | | | llvm-svn: 140894
* Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie2011-09-231-1/+0
| | | | llvm-svn: 140407
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-1/+1
| | | | llvm-svn: 140367
* Don't use TemplateArgumentListInfo inside AST nodes because it may leak.Argyrios Kyrtzidis2011-09-221-4/+5
| | | | | | Use ASTTemplateArgumentListInfo instead. llvm-svn: 140331
* [PCH] Fix a regression that r139441 introduced (decls were getting passedArgyrios Kyrtzidis2011-09-131-0/+3
| | | | | | | | | | | | | | | | | to the consumer without being fully deserialized). The regression was on compiling boost.python and it was too difficult to get a reduced test case unfortunately. Also modify the logic of how objc methods are getting passed to the consumer; codegen depended on receiving objc methods before the implementation decl. Since the interesting objc methods are ones with a body and such methods only exist inside an ObjCImplDecl, deserialize and pass to consumer all the methods of ObCImplDecl when we see one. Fixes http://llvm.org/PR10922 & rdar://10117105. llvm-svn: 139644
* Clean up our handling of Objective-C definitions in AST files. RatherDouglas Gregor2011-09-101-1/+1
| | | | | | | | | than having CodeGen check whether a declaration comes from an AST file (which it shouldn't know or care about), make sure that the AST writer and reader pass along "interesting" declarations that CodeGen needs to know about. llvm-svn: 139441
* Kill of the Decl::PCHLevel field entirely. We now only need to knowDouglas Gregor2011-09-101-15/+0
| | | | | | whether a Decl was deserialized from an AST file (any AST file). llvm-svn: 139438
* Eliminate all but one caller of Decl::getPCHLevel()Douglas Gregor2011-09-091-2/+2
| | | | llvm-svn: 139430
* Introduce a new predicate Decl::isFromASTFile() to determine whether aDouglas Gregor2011-09-091-10/+10
| | | | | | | | declaration was deserialized from an AST file. Use this instead of Decl::getPCHLevel() wherever possible. This is a simple step toward killing off Decl::getPCHLevel(). llvm-svn: 139427
* Modules: introduce the __module_private__ declaration specifier, whichDouglas Gregor2011-09-091-0/+15
| | | | | | | indicates that a declaration is only visible within the module it is declared in. llvm-svn: 139348
* objective-c: Treat top-level objective-c declarationsFariborz Jahanian2011-08-271-9/+6
| | | | | | | | | | , such as list of forward @class decls, in a DeclGroup node. Deal with its consequence throught clang. This is in preparation for more Sema work ahead. // rdar://8843851. Feel free to reverse if it breaks something important and I am unavailable. llvm-svn: 138709
* Remove an unnecessary assignment (to InstFromD).Argyrios Kyrtzidis2011-08-171-7/+3
| | | | | | Caught by the static analyzer! llvm-svn: 137878
* Add serialization support for ClassScopeFunctionSpecializationDecl.Francois Pichet2011-08-171-0/+10
| | | | llvm-svn: 137799
* Track in the AST whether a function is constexpr.Richard Smith2011-08-151-0/+1
| | | | llvm-svn: 137653
* In the serialized AST format, make the translation unit a "predefined"Douglas Gregor2011-08-121-4/+2
| | | | | | | | | | declaration that never actually gets serialized. Instead, serialize the various kinds of update records (lexical decls, visible decls, the addition of an anonymous namespace) for the translation unit, even if we're not chaining. This way, we won't have to deal with multiple loaded translation unit declarations. llvm-svn: 137395
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-1/+1
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Introduce the notion of instantiation dependence into Clang's AST. ADouglas Gregor2011-07-011-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | type/expression/template argument/etc. is instantiation-dependent if it somehow involves a template parameter, even if it doesn't meet the requirements for the more common kinds of dependence (dependent type, type-dependent expression, value-dependent expression). When we see an instantiation-dependent type, we know we always need to perform substitution into that instantiation-dependent type. This keeps us from short-circuiting evaluation in places where we shouldn't, and lets us properly implement C++0x [temp.type]p2. In theory, this would also allow us to properly mangle instantiation-dependent-but-not-dependent decltype types per the Itanium C++ ABI, but we aren't quite there because we still mangle based on the canonical type in cases like, e.g., template<unsigned> struct A { }; template<typename T> void f(A<sizeof(sizeof(decltype(T() + T())))>) { } template void f<int>(A<sizeof(sizeof(int))>); and therefore get the wrong answer. llvm-svn: 134225
* Objective-C fast enumeration loop variables are not retained in ARC, butJohn McCall2011-06-171-1/+6
| | | | | | | | | | | | they should still be officially __strong for the purposes of errors, block capture, etc. Make a new bit on variables, isARCPseudoStrong(), and set this for 'self' and these enumeration-loop variables. Change the code that was looking for the old patterns to look for this bit, and change IR generation to find this bit and treat the resulting variable as __unsafe_unretained for the purposes of init/destroy in the two places it can come up. llvm-svn: 133243
* Implement support for C++11 in-class initialization of non-static data members.Richard Smith2011-06-111-1/+4
| | | | llvm-svn: 132878
* Implement Objective-C Related Result Type semantics.Douglas Gregor2011-06-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related result types apply Cocoa conventions to the type of message sends and property accesses to Objective-C methods that are known to always return objects whose type is the same as the type of the receiving class (or a subclass thereof), such as +alloc and -init. This tightens up static type safety for Objective-C, so that we now diagnose mistakes like this: t.m:4:10: warning: incompatible pointer types initializing 'NSSet *' with an expression of type 'NSArray *' [-Wincompatible-pointer-types] NSSet *array = [[NSArray alloc] init]; ^ ~~~~~~~~~~~~~~~~~~~~~~ /System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:72:1: note: instance method 'init' is assumed to return an instance of its receiver type ('NSArray *') - (id)init; ^ It also means that we get decent type inference when writing code in Objective-C++0x: auto array = [[NSMutableArray alloc] initWithObjects:@"one", @"two",nil]; // ^ now infers NSMutableArray* rather than id llvm-svn: 132868
* Touchup to comments that weren't quite in sync with codeJonathan D. Turner2011-06-061-2/+3
| | | | llvm-svn: 132679
* Improvements to abbreviations for PCH which add support for EnumDecl, ↵Jonathan D. Turner2011-06-031-30/+241
| | | | | | ObjCIvarDecl, TypedefDecl, VarDecl and FieldDecl and improve support for ParmVarDecl. llvm-svn: 132604
* Test of commit access. Jonathan D. Turner2011-06-031-1/+1
| | | | llvm-svn: 132596
* Introduce additional abbreviations into the AST writer forDouglas Gregor2011-06-031-5/+152
| | | | | | | DeclRefExprs, IntegerLiterals, and others, reducing Cocoa PCH size by ~1% and C++ header size by ~2.5%. From Jonathan Turner! llvm-svn: 132528
* Implement defaulting of destructors.Alexis Hunt2011-05-121-0/+2
| | | | llvm-svn: 131260
* Modify some deleted function methods to better reflect reality:Alexis Hunt2011-05-061-3/+3
| | | | | | | | | | | | | | | | | | | | - New isDefined() function checks for deletedness - isThisDeclarationADefinition checks for deletedness - New doesThisDeclarationHaveABody() does what isThisDeclarationADefinition() used to do - The IsDeleted bit is not propagated across redeclarations - isDeleted() now checks the canoncial declaration - New isDeletedAsWritten() does what it says on the tin. - isUserProvided() now correct (thanks Richard!) This fixes the bug that we weren't catching void foo() = delete; void foo() {} as being a redefinition. llvm-svn: 131013
* Implement support for C++0x alias templates.Richard Smith2011-05-051-0/+6
| | | | llvm-svn: 130953
* Revise the representation of parameter scope data so that theJohn McCall2011-05-021-0/+3
| | | | | | | scope depth overlaps with the ObjCDeclQualifier, dropping memory usage back to previous levels. llvm-svn: 130671
* Store a parameter index and function prototype depth in everyJohn McCall2011-05-011-0/+4
| | | | | | | | | | parameter node and use this to correctly mangle parameter references in function template signatures. A follow-up patch will improve the storage usage of these fields; here I've just done the lazy thing. llvm-svn: 130669
* Re-applies the patch first applied way back in r106099, withChandler Carruth2011-05-011-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | accompanying fixes to make it work today. The core of this patch is to provide a link from a TemplateTypeParmType back to the TemplateTypeParmDecl node which declared it. This in turn provides much more precise information about the type, where it came from, and how it functions for AST consumers. To make the patch work almost a year after its first attempt, it needed serialization support, and it now retains the old getName() interface. Finally, it requires us to not attempt to instantiate the type in an unsupported friend decl -- specifically those coming from template friend decls but which refer to a specific type through a dependent name. A cleaner representation of the last item would be to build FriendTemplateDecl nodes for these, storing their template parameters etc, and to perform proper instantation of them like any other template declaration. They can still be flagged as unsupported for the purpose of access checking, etc. This passed an asserts-enabled bootstrap for me, and the reduced test case mentioned in the original review thread no longer causes issues, likely fixed at somewhere amidst the 24k revisions that have elapsed. llvm-svn: 130628
* Set the correct anonymous namespace (must be last reopening), and behave ↵Sebastian Redl2011-04-241-5/+7
| | | | | | correctly in the presence of the ever-annoying linkage specifications. llvm-svn: 130105
* Fix adding an anonymous namespace in a chained PCH to a namespace from a ↵Sebastian Redl2011-04-241-0/+14
| | | | | | | | previous PCH. Fix anonymous namespaces in PCH. llvm-svn: 130104
* We regard a function as 'unused' from the codegen perspective, so our ↵Argyrios Kyrtzidis2011-04-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | warnings diverge from gcc's unused warnings which don't get emitted if the function is referenced even in an unevaluated context (e.g. in templates, sizeof, etc.). Also, saying that a function is 'unused' because it won't get codegen'ed is somewhat misleading. - Don't emit 'unused' warnings for functions that are referenced in any part of the user's code. - A warning that an internal function/variable won't get emitted is useful though, so introduce -Wunneeded-internal-declaration which will warn if a function/variable with internal linkage is not "needed" ('used' from the codegen perspective), e.g: static void foo() { } template <int> void bar() { foo(); } test.cpp:1:13: warning: function 'foo' is not needed and will not be emitted static void foo() { } ^ Addresses rdar://8733476. llvm-svn: 129794
OpenPOWER on IntegriCloud