summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTImporter.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Started implementing variable templates. Top level declarations should be ↵Larisse Voufo2013-08-061-7/+240
| | | | | | fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention... llvm-svn: 187762
* Use SmallVectorImpl instead of SmallVector for iterators and references to ↵Craig Topper2013-07-041-1/+1
| | | | | | avoid specifying the vector size unnecessarily. llvm-svn: 185610
* [AST] Introduce a new DecayedType sugar nodeReid Kleckner2013-06-241-0/+7
| | | | | | | | | | | | | | The goal of this sugar node is to be able to look at an arbitrary FunctionType and tell if any of the parameters were decayed from an array or function type. Ultimately this is necessary to implement Microsoft's C++ name mangling scheme, which mangles decayed arrays differently from normal pointers. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D1014 llvm-svn: 184763
* Use FPT::getArgTypes() instead of manually building ArrayRefsReid Kleckner2013-06-101-4/+1
| | | | | | | | Made significantly easier with git-clang-format. Differential Revision: http://llvm-reviews.chandlerc.com/D947 llvm-svn: 183694
* Use only explicit bool conversion operatorDavid Blaikie2013-05-151-1/+1
| | | | | | | | | | | | | | | | | | | The most common (non-buggy) case are where such objects are used as return expressions in bool-returning functions or as boolean function arguments. In those cases I've used (& added if necessary) a named function to provide the equivalent (or sometimes negative, depending on convenient wording) test. DiagnosticBuilder kept its implicit conversion operator owing to the prevalent use of it in return statements. One bug was found in ExprConstant.cpp involving a comparison of two PointerUnions (PointerUnion did not previously have an operator==, so instead both operands were converted to bool & then compared). A test is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix (adding operator== to PointerUnion in LLVM). llvm-svn: 181869
* Cleanup handling of UniqueExternalLinkage.Rafael Espindola2013-05-131-4/+4
| | | | | | | | | | | | | This patch renames getLinkage to getLinkageInternal. Only code that needs to handle UniqueExternalLinkage specially should call this. Linkage, as defined in the c++ standard, is provided by getFormalLinkage. It maps UniqueExternalLinkage to ExternalLinkage. Most places in the compiler actually want isExternallyVisible, which handles UniqueExternalLinkage as internal. llvm-svn: 181677
* Rename ObjCImplementationDecl::getSuperLoc() -> getSuperClassLoc() for ↵Argyrios Kyrtzidis2013-05-031-1/+1
| | | | | | consistency with ObjCInterfaceDecl::getSuperClassLoc() llvm-svn: 181064
* Keep track of an @implementation's super class name location, if one was ↵Argyrios Kyrtzidis2013-05-031-0/+1
| | | | | | provided. llvm-svn: 181039
* In the ASTImporter, when checking whether twoSean Callanan2013-04-261-0/+6
| | | | | | | | | structs are compatible, check whether the fields of the structs have the same name. This prevents erroneous coalescing of (in particular) anonymous structs. llvm-svn: 180644
* Implement C++1y decltype(auto).Richard Smith2013-04-261-2/+2
| | | | llvm-svn: 180610
* Add 178663 back.Rafael Espindola2013-04-031-6/+2
| | | | | | | | | | | http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green before it processed the reverted 178663, so it could not have been the culprit. Revert "Revert 178663." This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41. llvm-svn: 178682
* Revert 178663.Rafael Espindola2013-04-031-2/+6
| | | | | | | | | | Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb Revert "Don't compute a patched/semantic storage class." This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05. llvm-svn: 178681
* Don't compute a patched/semantic storage class.Rafael Espindola2013-04-031-6/+2
| | | | | | | | | | | For variables and functions clang used to store two storage classes. The one "as written" in the code and a patched one, which, for example, propagates static to the following decls. This apparently is from the days clang lacked linkage computation. It is now redundant and this patch removes it. llvm-svn: 178663
* ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType.Jordan Rose2013-03-081-4/+3
| | | | | | No (intended) functionality change. llvm-svn: 176726
* Use None rather than Optional<T>() where possible.David Blaikie2013-02-211-1/+1
| | | | llvm-svn: 175705
* Include llvm::Optional in clang/Basic/LLVM.hDavid Blaikie2013-02-201-10/+7
| | | | | | Post-commit CR feedback from Jordan Rose regarding r175594. llvm-svn: 175679
* Rework the traversal of Objective-C categories and extensions toDouglas Gregor2013-01-161-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | consider (sub)module visibility. The bulk of this change replaces myriad hand-rolled loops over the linked list of Objective-C categories/extensions attached to an interface declaration with loops using one of the four new category iterator kinds: visible_categories_iterator: Iterates over all visible categories and extensions, hiding any that have their "hidden" bit set. This is by far the most commonly used iterator. known_categories_iterator: Iterates over all categories and extensions, ignoring the "hidden" bit. This tends to be used for redeclaration-like traversals. visible_extensions_iterator: Iterates over all visible extensions, hiding any that have their "hidden" bit set. known_extensions_iterator: Iterates over all extensions, whether they are visible to normal name lookup or not. The effect of this change is that any uses of the visible_ iterators will respect module-import visibility. See the new tests for examples. Note that the old accessors for categories and extensions are gone; there are *Raw() forms for some of them, for those (few) areas of the compiler that have to manipulate the linked list of categories directly. This is generally discouraged. Part two of <rdar://problem/10634711>. llvm-svn: 172665
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-15/+15
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Fixed a bug that caused the AST importer to erroneouslySean Callanan2013-01-111-1/+1
| | | | | | | import incomplete definitions for RecordDecls and then mark the resulting definition as complete. llvm-svn: 172273
* 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
OpenPOWER on IntegriCloud