summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
Commit message (Collapse)AuthorAgeFilesLines
...
* Add info to ObjCPropertyRefExpr to indicate whether the dot syntax propertyArgyrios Kyrtzidis2012-03-302-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | reference is going to message the setter, the getter, or both. Having this info on the ObjCPropertyRefExpr node makes it easier for AST clients (like libclang) to reason about the meaning of the property reference. [AST/Sema] -Use 2 bits (with a PointerIntPair) in ObjCPropertyRefExpr to record the above info -Have ObjCPropertyOpBuilder set the info appropriately. [libclang] -When there is an implicit property reference (property syntax using methods) have clang_getCursorReferenced return a cursor for the method. If the property reference is going to result in messaging both the getter and the setter choose to return a cursor for the setter because it is less obvious from source inspection that the setter is getting called. The general idea has the seal of approval by John. rdar://11151621 llvm-svn: 153709
* Canonicalize the declaration we write to a PCH file for anDouglas Gregor2012-03-261-1/+1
| | | | | | | | InjectedClassNameType; otherwise, it won't be properly wired to the original (canonical) declaration when it is deserialized. Fixes <rdar://problem/11112464>. llvm-svn: 153442
* [PCH] When we are replacing a decl in a chained PCH that is also a DeclContext,Argyrios Kyrtzidis2012-03-222-13/+69
| | | | | | | | | make sure to fully load its external lexical and visible declarations before re-writing it. rdar://10914192 llvm-svn: 153254
* Fix Objective-C compilation-time performance regression introduced in r152608.Richard Smith2012-03-162-5/+4
| | | | | | | | | | | | | | | | Reintroduce lazy name lookup table building, ensuring that the lazy building step produces the same lookup table that would be built by the eager step. Avoid building a lookup table for the translation unit outside C++, even in cases where we can't recover the contents of the table from the declaration chain on the translation unit, since we're not going to perform qualified lookup into it anyway. Continue to support lazily building such lookup tables for now, though, since ASTMerge uses them. In my tests, this performs very similarly to ToT with r152608 backed out, for C, Obj-C and C++, and does not suffer from PR10447. llvm-svn: 152905
* Instantiating a class template should not instantiate the definition of anyRichard Smith2012-03-142-2/+14
| | | | | | | | scoped enumeration members. Later uses of an enumeration temploid as a nested name specifier should cause its instantiation. Plus some groundwork for explicit specialization of member enumerations of class templates. llvm-svn: 152750
* It never makes sense to do a lookup into a LinkageSpecDecl, so assert that weNick Lewycky2012-03-131-4/+0
| | | | | | | | | don't, and clean up the places that do it. The change to ASTWriter is surprising, but the deleted code is a no-op as of r152608. llvm-svn: 152609
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-113-9/+9
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall2012-03-104-23/+4
| | | | | | | | track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491
* Allow serializing an invalid ParmVarDecl and don't set access to public forArgyrios Kyrtzidis2012-03-091-8/+8
| | | | | | | | invalid ParmVarDecls. Part of rdar://11007039. llvm-svn: 152437
* [libclang] Fix a crash when serializing a preprocessing record that containsArgyrios Kyrtzidis2012-03-082-4/+8
| | | | | | | | an #include entry that did not resolve to header file. Part of rdar://11007039 llvm-svn: 152275
* AST representation for user-defined literals, plus just enough of semanticRichard Smith2012-03-073-0/+16
| | | | | | | | | | | | | | | | | | | | | analysis to make the AST representation testable. They are represented by a new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic properties, including full CodeGen support, are achieved for free by this representation. UserDefinedLiterals can never be dependent, so no custom instantiation behavior is required. They are mangled as if they were direct calls to the underlying literal operator. This matches g++'s apparent behavior (but not its actual mangling, which is broken for literal-operator-ids). User-defined *string* literals are now fully-operational, but the semantic analysis is quite hacky and needs more work. No other forms of user-defined literal are created yet, but the AST support for them is present. This patch committed after midnight because we had already hit the quota for new kinds of literal yesterday. llvm-svn: 152211
* [PCH] Mark a PCH file with a flag to indicate if the serialized AST hadArgyrios Kyrtzidis2012-03-072-4/+16
| | | | | | | | | | | | | | | | compiler errors or not. -Control whether ASTReader should reject such a PCH by a boolean flag at ASTReader's creation time. By default, such a PCH file will be rejected with an error when trying to load it. [libclang] Allow clang_saveTranslationUnit to create a PCH file even if compiler errors occurred. -Have libclang API calls accept a PCH that had compiler errors. The general idea is that we want libclang to stay functional even if a PCH had a compiler error. rdar://10976363. llvm-svn: 152192
* Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,Ted Kremenek2012-03-063-2/+134
| | | | | | | | | | | | | NSNumber, and boolean literals. This includes both Sema and Codegen support. Included is also support for new Objective-C container subscripting. My apologies for the large patch. It was very difficult to break apart. The patch introduces changes to the driver as well to cause clang to link in additional runtime support when needed to support the new language features. Docs are forthcoming to document the implementation and behavior of these features. llvm-svn: 152137
* [preprocessor] Enhance PreprocessingRecord to keep track of locations of ↵Argyrios Kyrtzidis2012-03-051-2/+2
| | | | | | | | | conditional directives. Introduce PreprocessingRecord::rangeIntersectsConditionalDirective() which returns true if a given range intersects with a conditional directive block. llvm-svn: 152018
* Move llvm/ADT/SaveAndRestore.h -> llvm/Support/SaveAndRestore.h.Argyrios Kyrtzidis2012-03-011-1/+1
| | | | | | Needs llvm update. llvm-svn: 151829
* objective-c: provide fixit hint when atomic property does notFariborz Jahanian2012-02-292-0/+2
| | | | | | | have matching user defined setter/getter and a warning is issued. In this case, a fixit note is displayed. // rdar://10267155 llvm-svn: 151766
* ASTWriter: Cache some DenseMaps we use repeatedly.Daniel Dunbar2012-02-291-5/+4
| | | | | | | | - This reduces our total # of allocations building a PCH for Cocoa.h by almost a whopping 50%. - A SmallPtrMap would be cleaner, but since we don't have one yet... llvm-svn: 151697
* Move "clang/Analysis/Support/SaveAndRestore.h" to "llvm/ADT/SaveAndRestore.h"Argyrios Kyrtzidis2012-02-271-1/+1
| | | | | | | | to make it more widely available. Depends on llvm commit r151564 llvm-svn: 151566
* Serialize InitListExpr's initializesStdInitializerList bit, so it's not left ↵Benjamin Kramer2012-02-272-0/+2
| | | | | | | | uninitialized. Found by valgrind. llvm-svn: 151527
* Teach CXXRecordDecl::hasIrrelevantDestructor to check the base classes andRichard Smith2012-02-252-0/+17
| | | | | | | | | data members for deleted or user-provided destructors. Now it's computed in advance, serialize it, and in passing fix all the other record DefinitionData flags whose serialization was missing. llvm-svn: 151441
* Don't record nested macro expansions in the preprocessing record,Argyrios Kyrtzidis2012-02-251-2/+2
| | | | | | | | it can only bring pain when dealing with preprocessor abuse (see: boost). rdar://10898986 llvm-svn: 151427
* Change the text of a FIXME.Argyrios Kyrtzidis2012-02-241-1/+2
| | | | llvm-svn: 151387
* Implement a new type trait __is_trivially_constructible(T, Args...)Douglas Gregor2012-02-242-0/+26
| | | | | | | | | | | | | | | | that provides the behavior of the C++11 library trait std::is_trivially_constructible<T, Args...>, which can't be implemented purely as a library. Since __is_trivially_constructible can have zero or more arguments, I needed to add Yet Another Type Trait Expression Class, this one handling arbitrary arguments. The next step will be to migrate UnaryTypeTrait and BinaryTypeTrait over to this new, more general TypeTrait class. Fixes the Clang side of <rdar://problem/10895483> / PR12038. llvm-svn: 151352
* [PCH] When keeping track of top-level decls for "targeted deserialization"Argyrios Kyrtzidis2012-02-241-0/+3
| | | | | | | | make sure we don't mistake ParmVarDecls for top-level decls. Fixes rdar://10920009. llvm-svn: 151330
* Generate an AST for the conversion from a lambda closure type to aDouglas Gregor2012-02-222-4/+0
| | | | | | | | | | | | | | | block pointer that returns a block literal which captures (by copy) the lambda closure itself. Some aspects of the block literal are left unspecified, namely the capture variable (which doesn't actually exist) and the body (which will be filled in by IRgen because it can't be written as an AST). Because we're switching to this model, this patch also eliminates tracking the copy-initialization expression for the block capture of the conversion function, since that information is now embedded in the synthesized block literal. -1 side tables FTW. llvm-svn: 151131
* Improve our handling of lambda expressions that occur within defaultDouglas Gregor2012-02-212-1/+3
| | | | | | | | | | | | | | | | | | | arguments. There are two aspects to this: - Make sure that when marking the declarations referenced in a default argument, we don't try to mark local variables, both because it's a waste of time and because the semantics are wrong: we're not in a place where we could capture these variables again even if it did make sense. - When a lambda expression occurs in a default argument of a function template, make sure that the corresponding closure type is considered dependent, so that it will get properly instantiated. The second bit is a bit of a hack; to fix it properly, we may have to rearchitect our handling of default arguments, parsing them only after creating the function definition. However, I'd like to separate that work from the lambdas work. llvm-svn: 151076
* Implement name mangling for lambda expressions that occur within theDouglas Gregor2012-02-212-0/+2
| | | | | | | | | | | | | | | | default arguments of function parameters. This simple-sounding task is complicated greatly by two issues: (1) Default arguments aren't actually a real context, so we need to maintain extra state within lambda expressions to track when a lambda was actually in a default argument. (2) At the time that we parse a default argument, the FunctionDecl doesn't exist yet, so lambda closure types end up in the enclosing context. It's not clear that we ever want to change that, so instead we introduce the notion of the "effective" context of a declaration for the purposes of name mangling. llvm-svn: 151011
* [PCH] Recover gracefully if the ASTReader detects that a file is differentArgyrios Kyrtzidis2012-02-201-1/+8
| | | | | | | | | | | | | | | | | | | from the one stored in the PCH/AST, while trying to load a SLocEntry. We verify that all files of the PCH did not change before loading it but this is not enough because: - The AST may have been 1) kept around, 2) to do queries on it. - We may have 1) verified the PCH and 2) started parsing. Between 1) and 2) files may change and we are going to have crashes because the rest of clang cannot deal with the ASTReader failing to read a SLocEntry. Handle this by recovering gracefully in such a case, by initializing the SLocEntry with the info from the PCH/AST as well as reporting failure by the ASTReader. rdar://10888929 llvm-svn: 151004
* modern objc translator. Finish off first cut of theFariborz Jahanian2012-02-202-0/+8
| | | | | | | modern meta-data translation by commenting out private ivar declarations in user source. Also, added several tests. llvm-svn: 150985
* Basic support for name mangling of C++11 lambda expressions. BecauseDouglas Gregor2012-02-202-0/+2
| | | | | | | | | | | | | | | name mangling in the Itanium C++ ABI for lambda expressions is so dependent on context, we encode the number used to encode each lambda as part of the lambda closure type, and maintain this value within Sema. Note that there are a several pieces still missing: - We still get the linkage of lambda expressions wrong - We aren't properly numbering or mangling lambda expressions that occur in default function arguments or in data member initializers. - We aren't (de-)serializing the lambda numbering tables llvm-svn: 150982
* Deserialize the direct-initialization range of a "new" expressionDouglas Gregor2012-02-201-7/+2
| | | | | | | properly. Previously, we deserialized it but failed to set the corresponding member in CXXNewExpr. Fixes <rdar://problem/10893600>. llvm-svn: 150963
* Revert "Revert "Make CXXNewExpr contain only a single initialier, and not ↵Sebastian Redl2012-02-162-18/+10
| | | | | | | | hold the used constructor itself."" This reintroduces commit r150682 with a fix for the Bullet benchmark crash. llvm-svn: 150685
* Revert "Make CXXNewExpr contain only a single initialier, and not hold the ↵Sebastian Redl2012-02-162-10/+18
| | | | | | | | | | used constructor itself." It leads to a compiler crash in the Bullet benchmark. This reverts commit r12014. llvm-svn: 150684
* Make CXXNewExpr contain only a single initialier, and not hold the used ↵Sebastian Redl2012-02-162-18/+10
| | | | | | | | | | constructor itself. Holding the constructor directly makes no sense when list-initialized arrays come into play. The constructor is now held in a CXXConstructExpr, if construction is what is done. The new design can also distinguish properly between list-initialization and direct-initialization, as well as implicit default-initialization constructors and explicit value-initialization constructors. Finally, doing it this way removes redundance from the AST because CXXNewExpr doesn't try to handle both the allocation and the initialization responsibilities. This breaks the static analysis of new expressions. I've filed PR12014 to track this. llvm-svn: 150682
* Implicitly define a lambda's conversion functions (to functionDouglas Gregor2012-02-162-0/+4
| | | | | | | | | | | | | pointers and block pointers). We use dummy definitions to keep the invariant that an implicit, used definition has a body; IR generation will substitute the actual contents, since they can't be represented as C++. For the block pointer case, compute the copy-initialization needed to capture the lambda object in the block, which IR generation will need later. llvm-svn: 150645
* Implement AST (de-)serialization for lambda expressions.Douglas Gregor2012-02-144-3/+107
| | | | llvm-svn: 150491
* Within the body of a lambda expression, decltype((x)) for anDouglas Gregor2012-02-122-2/+5
| | | | | | | | | | | | | | | | id-expression 'x' will compute the type based on the assumption that 'x' will be captured, even if it isn't captured, per C++11 [expr.prim.lambda]p18. There are two related refactors that go into implementing this: 1) Split out the check that determines whether we should capture a particular variable reference, along with the computation of the type of the field, from the actual act of capturing the variable. 2) Always compute the result of decltype() within Sema, rather than AST, because the decltype() computation is now context-sensitive. llvm-svn: 150347
* Represent C++ direct initializers as ParenListExprs before semantic analysisSebastian Redl2012-02-112-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | instead of having a special-purpose function. - ActOnCXXDirectInitializer, which was mostly duplication of AddInitializerToDecl (leading e.g. to PR10620, which Eli fixed a few days ago), is dropped completely. - MultiInitializer, which was an ugly hack I added, is dropped again. - We now have the infrastructure in place to distinguish between int x = {1}; int x({1}); int x{1}; -- VarDecl now has getInitStyle(), which indicates which of the above was used. -- CXXConstructExpr now has a flag to indicate that it represents list- initialization, although this is not yet used. - InstantiateInitializer was renamed to SubstInitializer and simplified. - ActOnParenOrParenListExpr has been replaced by ActOnParenListExpr, which always produces a ParenListExpr. Placed that so far failed to convert that back to a ParenExpr containing comma operators have been fixed. I'm pretty sure I could have made a crashing test case before this. The end result is a (I hope) considerably cleaner design of initializers. More importantly, the fact that I can now distinguish between the various initialization kinds means that I can get the tricky generalized initializer test cases Johannes Schaub supplied to work. (This is not yet done.) This commit passed self-host, with the resulting compiler passing the tests. I hope it doesn't break more complicated code. It's a pretty big change, but one that I feel is necessary. llvm-svn: 150318
* Track whether a function type has a trailing return type as type sugar. Use thisRichard Smith2012-02-102-1/+2
| | | | | | | | | | | to pretty-print such function types better, and to fix a case where we were not instantiating templates in lexical order. In passing, move the Variadic bit from Type's bitfields to FunctionProtoType to get the Type bitfields down to 32 bits. Also ensure that we always substitute the return type of a function when substituting explicitly-specified arguments, since that can cause us to bail out with a SFINAE error before we hit a hard error in parameter substitution. llvm-svn: 150241
* [PCH] Add some comments, per Ted's request.Argyrios Kyrtzidis2012-02-091-0/+4
| | | | llvm-svn: 150162
* Fix ASTReader::FinishedDeserializing().Argyrios Kyrtzidis2012-02-091-18/+14
| | | | | | | | | | | | | | | We were passing a decl to the consumer after all pending deserializations were finished but this was not enough; due to processing by the consumer we may end up into yet another deserialization process but the way FinishedDeserializing() was setup we would not ensure that everything was fully deserialized before returning to the consumer. Separate ASTReader::FinishedDeserializing() into two semantic actions. The first is ensuring that a deserialization process ends up will fully deserialized decls/types even if the process is started by the consumer. The second is pushing "interesting" decls to the consumer; we make sure that we don't re-enter this section recursively be checking a variable. llvm-svn: 150160
* [PCH] Set the DeclContext before doing any deserialization, to make sure ↵Argyrios Kyrtzidis2012-02-091-0/+4
| | | | | | | | | internal calls to Decl::getASTContext() by Decl's methods will find the TranslationUnitDecl without crashing due to a parent declaration context still deserializing. llvm-svn: 150153
* [PCH] Avoid using Decl::setAttrs() and Decl::setLexicalDeclContext() from ↵Argyrios Kyrtzidis2012-02-091-9/+9
| | | | | | | | | the ASTReaderDecl directly; they internally call Decl::getASTContext() which may crash if a declaration context parent is still deserializing. llvm-svn: 150137
* Revert my patches which removed Diagnostic.h includes by moving some ↵Benjamin Kramer2012-02-072-2/+0
| | | | | | | | | | | | | | | | | | operator overloads out of line. This seems to negatively affect compile time onsome ObjC tests (which use a lot of partial diagnostics I assume). I have to come up with a way to keep them inline without including Diagnostic.h everywhere. Now adding a new diagnostic requires a full rebuild of e.g. the static analyzer which doesn't even use those diagnostics. This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99. This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789. This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7. This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f. This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5. llvm-svn: 150006
* Introduce basic ASTs for lambda expressions. This covers:Douglas Gregor2012-02-072-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | - Capturing variables by-reference and by-copy within a lambda - The representation of lambda captures - The creation of the non-static data members in the lambda class that store the captured variables - The initialization of the non-static data members from the captured variables - Pretty-printing lambda expressions There are a number of FIXMEs, both explicit and implied, including: - Creating a field for a capture of 'this' - Improved diagnostics for initialization failures when capturing variables by copy - Dealing with temporaries created during said initialization - Template instantiation - AST (de-)serialization - Binding and returning the lambda expression; turning it into a proper temporary - Lots and lots of semantic constraints - Parameter pack captures llvm-svn: 149977
* Added source location for the template keyword in ↵Abramo Bagnara2012-02-062-0/+2
| | | | | | | | | | DependentTemplateSpecializationTypeLoc nodes (DTSTLoc). The new info is propagated to TSTLoc on template instantiation, getting rid of 3 FIXMEs in TreeTransform.h and another one Parser.cpp. Simplified code in TypeSpecLocFiller visitor methods for DTSTLoc and DependentNameTypeLoc by removing what now seems to be dead code (adding corresponding assertions). llvm-svn: 149923
* Removed redundant location info from ElaboratedTypeLoc / DependentNameLoc / ↵Abramo Bagnara2012-02-062-4/+4
| | | | | | DependentTSTLoc. Uniformed names referencing elaborated keyword. No intended functionality changes. llvm-svn: 149889
* Added location for template keyword in TemplateSpecializationTypeLoc. In the ↵Abramo Bagnara2012-02-062-4/+6
| | | | | | process removed some naming ambiguities. llvm-svn: 149870
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-053-16/+16
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Basic: import OwningPtr<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | llvm-svn: 149798
OpenPOWER on IntegriCloud