summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTImporter.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix code that attempted to produce a diagnostic with one DiagnosticEngine, thenRichard Smith2012-12-201-2/+20
| | | | | | | | produce a note for that diagnostic either with a different DiagnosticEngine or after calling DiagnosticEngine::Reset(). That didn't make any sense, and did the wrong thing if the original diagnostic was suppressed. llvm-svn: 170636
* Finish implementing 'selected constructor' rules for triviality in C++11. InRichard Smith2012-12-081-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | the cases where we can't determine whether special members would be trivial while building the class, we eagerly declare those special members. The impact of this is bounded, since it does not trigger implicit declarations of special members in classes which merely *use* those classes. In order to determine whether we need to apply this rule, we also need to eagerly declare move operations and destructors in cases where they might be deleted. If a move operation were supposed to be deleted, it would instead be suppressed, and we could need overload resolution to determine if we fall back to a trivial copy operation. If a destructor were implicitly deleted, it would cause the move constructor of any derived classes to be suppressed. As discussed on cxx-abi-dev, C++11's selected constructor rules are also retroactively applied as a defect resolution in C++03 mode, in order to identify that class B has a non-trivial copy constructor (since it calls A's constructor template, not A's copy constructor): struct A { template<typename T> A(T &); }; struct B { mutable A a; }; llvm-svn: 169673
* Implement C++03 [dcl.init]p5's checking for value-initialization of referencesRichard Smith2012-12-081-0/+2
| | | | | | | | properly, rather than faking it up by pretending that a reference member makes the default constructor non-trivial. That leads to rejects-valids when putting such types inside unions. llvm-svn: 169662
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-1/+0
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Refactor to reduce duplication in handling of special member functions. No ↵Richard Smith2012-11-301-18/+4
| | | | | | functionality change. llvm-svn: 168977
* Store on the CXXRecordDecl whether the class has, or would have, a copyRichard Smith2012-11-281-0/+8
| | | | | | | constructor/assignment operator with a const-qualified parameter type. The prior method for determining this incorrectly used overload resolution. llvm-svn: 168775
* Teach the AST importer to merge enumerator constants. FixesDouglas Gregor2012-11-141-2/+20
| | | | | | <rdar://problem/12676166>, and tested on the LLDB side of the world. llvm-svn: 167990
* Add a FileCharacteristic parameter to SourceManager::createFileIDForMemBufferArgyrios Kyrtzidis2012-11-091-1/+2
| | | | | | | for completeness and use it in CompilerInstance::InitializeSourceManager if the input is a memory buffer. llvm-svn: 167628
* Match up anonymous structs/unions in the ASTImporter. Previously, we'dDouglas Gregor2012-10-261-3/+101
| | | | | | | | only actually get the answer right if there was only a single anonymous struct/union at that level. This is part of <rdar://problem/11904570>; the test will go into LLDB itself. llvm-svn: 166781
* Eliminate some longstanding FIXMEs regarding variadic templates in theDouglas Gregor2012-10-261-8/+2
| | | | | | ASTImporter. llvm-svn: 166777
* In the ASTImporter, don't try to emit a diagnostic if we're notDouglas Gregor2012-10-261-120/+154
| | | | | | allowed to complain about a failure. llvm-svn: 166776
* Rename ObjCMethodDecl::isSynthesized to isPropertyAccessor.Jordan Rose2012-10-101-1/+1
| | | | | | | | | | | | | This more accurately reflects its use: this flag is set when a method matches the getter or setter name for a property in the same class, and does not actually specify whether or not the definition of the method will be synthesized (either implicitly or explicitly with @synthesize). This renames the setter and backing field as well, and changes the (soon-to-be-obsolete?) XML dump format to use 'property_accessor' instead of 'synthesized'. llvm-svn: 165626
* Add FP_CONTRACT support for clang.Lang Hames2012-10-021-2/+4
| | | | | | | | Clang will now honor the FP_CONTRACT pragma and emit LLVM fmuladd intrinsics for expressions of the form A * B + C (when they occur in a single statement). llvm-svn: 164989
* Fix the AST representation for non-type template arguments to encodeEli Friedman2012-09-261-8/+18
| | | | | | | | | | | | enough information so we can mangle them correctly in cases involving dependent parameter types. (This specifically impacts cases involving null pointers and cases involving parameters of reference type.) Fix the mangler to use this information instead of trying to scavenge it out of the parameter declaration. <rdar://problem/12296776>. llvm-svn: 164656
* Improve upon r164450 and localize the logic of updating the type ofArgyrios Kyrtzidis2012-09-251-28/+34
| | | | | | a function decl inside the ASTNodeImporter::VisitFunctionDecl function. llvm-svn: 164625
* When importing a FunctionProtoType::ExtProtoInfo, its ExceptionSpecDecl can ↵Argyrios Kyrtzidis2012-09-221-10/+44
| | | | | | | | | | | | point to the FunctionDecl that we are importing the FunctionProtoType for, in which case we'll have infinite recursion when importing. Initially create a FunctionProtoType with null ExceptionSpecDecl/ExceptionSpecTemplate and update the type in ASTNodeImporter::VisitFunctionDecl after the FunctionDecl has been created. llvm-svn: 164450
* Fix build errors.Argyrios Kyrtzidis2012-09-211-2/+4
| | | | llvm-svn: 164417
* [AST importer] Do a correct import of a FunctionProtoType::ExtProtoInfo, ↵Argyrios Kyrtzidis2012-09-211-0/+3
| | | | | | | | | | don't pass nodes from the imported ASTContext. rdar://12348924 llvm-svn: 164416
* Teach the ASTImporter how to handle anonymous structs/unionsDouglas Gregor2012-07-171-15/+42
| | | | | | | better. Fixes <rdar://problem/11466212>; the test (and back-ported version of this code) were committed to LLDB in r160186. llvm-svn: 160395
* Replace IsSameValue with the llvm::APSInt/llvm::APInt versionsEric Christopher2012-07-151-42/+3
| | | | | | | | that we just copied from here and replace all uses. Part of rdar://11875995 llvm-svn: 160224
* Remove CXXRecordDecl flags which are unused after r158289.Richard Smith2012-06-101-6/+0
| | | | | | | | | | | | | | | | | | | | | We need an efficient mechanism to determine whether a defaulted default constructor is constexpr, in order to determine whether a class is a literal type, so keep the incrementally-built form on CXXRecordDecl. Remove the on-demand computation of same, so that we only have one method for determining whether a default constructor is constexpr. This doesn't affect correctness, since default constructor lookup is much simpler than selecting a constructor for copying or moving. We don't need a corresponding mechanism for defaulted copy or move constructors, since they can't affect whether a type is a literal type. Conversely, checking whether such functions are constexpr can require non-trivial effort, so we defer such checks until the copy or move constructor is required. Thus we now only compute whether a copy or move constructor is constexpr on demand, and only compute whether a default constructor is constexpr in advance. This is unfortunate, but seems like the best solution. llvm-svn: 158290
* PR13064: Store whether an in-class initializer uses direct or copyRichard Smith2012-06-101-1/+1
| | | | | | | initialization, and use that information to produce the right kind of initialization during template instantiation. llvm-svn: 158288
* Plug a long standing memory leak in TemplateArgument.Benjamin Kramer2012-06-071-2/+2
| | | | | | | | | | | | | | | The integral APSInt value is now stored in a decomposed form and the backing store for large values is allocated via the ASTContext. This way its not leaked as TemplateArguments are never destructed when they are allocated in the ASTContext. Since the integral data is immutable it is now shared between instances, making copying TemplateArguments a trivial operation. Currently getting the integral data out of a TemplateArgument requires creating a new APSInt object. This is cheap when the value is small but can be expensive if it's not. If this turns out to be an issue a more efficient accessor could be added. llvm-svn: 158150
* Revert Decl's iterators back to pointer value_type rather than reference ↵David Blaikie2012-06-061-1/+1
| | | | | | | | | | | | | | value_type In addition, I've made the pointer and reference typedef 'void' rather than T* just so they can't get misused. I would've omitted them entirely but std::distance likes them to be there even if it doesn't use them. This rolls back r155808 and r155869. Review by Doug Gregor incorporating feedback from Chandler Carruth. llvm-svn: 158104
* Use RecordDecl::field_iterator because D1, D2 are RecordDecls. No ↵Dmitri Gribenko2012-05-191-2/+2
| | | | | | functional change. llvm-svn: 157119
* A union can have a constexpr defaulted default constructor, if it has anRichard Smith2012-05-071-0/+1
| | | | | | | | | in-class initializer for one of its fields. Value-initialization of such a type should use the in-class initializer! The former was just a bug, the latter is a (reported) standard defect. llvm-svn: 156274
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-1/+1
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* Implement support for null non-type template arguments for non-typeDouglas Gregor2012-04-061-0/+2
| | | | | | | template parameters of pointer, pointer-to-member, or nullptr_t type in C++11. Fixes PR9700 / <rdar://problem/11193097>. llvm-svn: 154219
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-5/+5
| | | | | | | | | | (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-101-0/+1
| | | | | | | | 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
* [AST/Sema/libclang] Replace getSourceRange().getBegin() with getLocStart().Daniel Dunbar2012-03-091-6/+6
| | | | | | | | | - getSourceRange().getBegin() is about as awesome a pattern as .copy().size(). I already killed the hot paths so this doesn't seem to impact performance on my tests-of-the-day, but it is a much more sensible (and shorter) pattern. llvm-svn: 152419
* objective-c: provide fixit hint when atomic property does notFariborz Jahanian2012-02-291-0/+1
| | | | | | | have matching user defined setter/getter and a warning is issued. In this case, a fixit note is displayed. // rdar://10267155 llvm-svn: 151766
* Teach CXXRecordDecl::hasIrrelevantDestructor to check the base classes andRichard Smith2012-02-251-1/+15
| | | | | | | | | 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
* modern objc translator. Finish off first cut of theFariborz Jahanian2012-02-201-2/+6
| | | | | | | modern meta-data translation by commenting out private ivar declarations in user source. Also, added several tests. llvm-svn: 150985
* Within the body of a lambda expression, decltype((x)) for anDouglas Gregor2012-02-121-1/+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
* Make sure that imported definitions get completed before we addDouglas Gregor2012-02-011-31/+100
| | | | | | | anything into the corresponding DeclContext. Co-hacked with Sean; fixes <rdar://problem/10768928>. llvm-svn: 149535
* Added source location for the template keyword in AST template-id expressions.Abramo Bagnara2012-01-271-0/+1
| | | | llvm-svn: 149127
* Only try to import a definition if there is an definition to import.Douglas Gregor2012-01-251-2/+5
| | | | llvm-svn: 148894
* When importing a RecordDecl as a DeclContext, make sure that we pullDouglas Gregor2012-01-241-8/+38
| | | | | | in the definition as well. llvm-svn: 148831
* Teach the AST importer about redeclaration chains for Objective-CDouglas Gregor2012-01-241-152/+197
| | | | | | classes and protocols, implementing lazy-import semantics for both. llvm-svn: 148816
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-8/+3
| | | | llvm-svn: 148577
* Switch NamespaceDecl from its own hand-rolled redeclaration chain overDouglas Gregor2012-01-071-1/+3
| | | | | | | | | | | | to Redeclarable<NamespaceDecl>, so that we benefit from the improveed redeclaration deserialization and merging logic provided by Redeclarable<T>. Otherwise, no functionality change. As a drive-by fix, collapse the "inline" bit into the low bit of the original namespace/anonymous namespace, saving 8 bytes per NamespaceDecl on x86_64. llvm-svn: 147729
* Eliminate the ForwardDecl/InitiallyForwardDecl bits from ObjCProtocolDecl. ↵Douglas Gregor2012-01-011-2/+1
| | | | | | They are no longer needed llvm-svn: 147419
* Eliminate ObjCForwardProtocolDecl, which is redundant now thatDouglas Gregor2012-01-011-45/+0
| | | | | | ObjCProtocolDecl modules forward declarations properly. llvm-svn: 147415
* Wire up redeclaration chains for Objective-C protocols, so that bothDouglas Gregor2012-01-011-2/+1
| | | | | | | forward declarations and definitions of an Objective-C protocol are represented within a single chain of ObjCProtocolDecls. llvm-svn: 147412
* Move the data that corresponds to the definition of a protocol into aDouglas Gregor2012-01-011-2/+5
| | | | | | | | | separately-allocated DefinitionData structure. Introduce various functions that will help with the separation of declarations from definitions (isThisDeclarationADefinition(), hasDefinition(), getDefinition()). llvm-svn: 147408
* Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDeclDouglas Gregor2011-12-271-30/+0
| | | | | | | covers both declarations (@class) and definitions (@interface) of an Objective-C class. llvm-svn: 147299
* constexpr handling improvements. Produce detailed diagnostics when a 'constexpr'Richard Smith2011-12-191-0/+5
| | | | | | | | | | | | | | | | | | | | | variable is initialized by a non-constant expression, and pass in the variable being declared so that earlier-initialized fields' values can be used. Rearrange VarDecl init evaluation to make this possible, and in so doing fix a long-standing issue in our C++ constant expression handling, where we would mishandle cases like: extern const int a; const int n = a; const int a = 5; int arr[n]; Here, n is not initialized by a constant expression, so can't be used in an ICE, even though the initialization expression would be an ICE if it appeared later in the TU. This requires computing whether the initializer is an ICE eagerly, and saving that information in PCH files. llvm-svn: 146856
* Fix chaining of ObjCInterfaceDecl redeclarationsDouglas Gregor2011-12-161-1/+2
| | | | llvm-svn: 146722
* Keep track of all declarations of an Objective-C class (both forwardDouglas Gregor2011-12-151-1/+0
| | | | | | | | | | declarations and definitions) as ObjCInterfaceDecls within the same redeclaration chain. This new representation matches what we do for C/C++ variables/functions/classes/templates/etc., and makes it possible to answer the query "where are all of the declarations of this class?" llvm-svn: 146679
OpenPOWER on IntegriCloud