summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiateDecl.cpp
Commit message (Collapse)AuthorAge
* Convert some function arguments to use ArrayRef.Craig Topper2014-06-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211764 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix bug in code for avoiding dynamic initialization of dllimport globalsHans Wennborg2014-06-18
| | | | | | | | | | | | | When instantiating dllimport variables with dynamic initializers, don't bail out of Sema::InstantiateVariableInitializer without calling PopExpressionEvaluationContext(). This was causing a stale object to stay on the ExprEvalContexts stack, causing subsequent calls to getCurrentMangleNumberContext() to fail, resulting in incorrect numbering of static locals (and probably other broken things). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211137 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve checking for dynamic initializers of dllimport fields in template ↵Hans Wennborg2014-06-10
| | | | | | | | | instantiation We would previously assert if the initializer was dependent. I also think that checking isConstantInitializer is more correct here than checkInitIsICE. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210505 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't dynamically initialize dllimport vars (PR19933)Hans Wennborg2014-06-04
| | | | | | | | They should be initialized when they're exported. Differential Revision: http://reviews.llvm.org/D4020 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210217 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactoring. Remove Owned method from Sema.Nikola Smiljanic2014-05-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209812 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactoring. Remove release and take methods from ActionResult. Rename ↵Nikola Smiljanic2014-05-29
| | | | | | takeAs to getAs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209800 91177308-0d34-0410-b5e6-96231b3b80d8
* When merging functions across modules (and in particular, instantiations ofRichard Smith2014-05-29
| | | | | | | | member functions), ensure that the redecl chain never transitions from 'inline' to 'not inline', since that violates an AST invariant. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209794 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the logic for testing for namespace std into one location. This check canRichard Trieu2014-05-28
| | | | | | | be performed by using Decl::isInStdNamespace or DeclContext::isStdNamespace git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209708 91177308-0d34-0410-b5e6-96231b3b80d8
* Retain isImplicit flag for local variable declarations when instantiatingAlexander Kornienko2014-05-27
| | | | | | | | | | | | | | templates. Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3924 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209686 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'. Sema edition.Craig Topper2014-05-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209613 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bunch of mislayered clang/Lex includes from SemaAlp Toker2014-05-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207896 91177308-0d34-0410-b5e6-96231b3b80d8
* Rewrite NRVO determination. Track NRVO candidates on the parser Scope and ↵Nick Lewycky2014-05-03
| | | | | | | | | apply the NRVO candidate flag to all possible NRVO candidates here, and remove the flags in computeNRVO or upon template instantiation. A variable now has NRVO applied if and only if every return statement in that scope returns that variable. This is nearly optimal. Performs NRVO roughly 7% more often in a bootstrap build of clang. Patch co-authored by Richard Smith. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207890 91177308-0d34-0410-b5e6-96231b3b80d8
* Make typo-correction of inheriting constructors work a bit better. LimitRichard Smith2014-05-01
| | | | | | | | correction to direct base class members, and recover properly after we apply such a correction. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207731 91177308-0d34-0410-b5e6-96231b3b80d8
* If a using-declaration names a class member, but appears outside a class, tryRichard Smith2014-04-02
| | | | | | | to suggest a different syntax to get the same effect. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205467 91177308-0d34-0410-b5e6-96231b3b80d8
* PR19252: Fix crash if alignas is used with an auto-typed variable. Don't checkRichard Smith2014-03-27
| | | | | | | the type of the variable until it's known. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204887 91177308-0d34-0410-b5e6-96231b3b80d8
* Emit an update record if we instantiate the definition of a function templateRichard Smith2014-03-22
| | | | | | | | | specialization from a module. (This can also happen for function template specializations in PCHs if they're instantiated eagerly, because they're constexpr or have a deduced return type.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204547 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor: move loading pending instantiations from chained PCHs to a more ↵Richard Smith2014-03-22
| | | | | | appropriate place, so that we only ask the external source once. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204535 91177308-0d34-0410-b5e6-96231b3b80d8
* When the exception specification for a function in an imported PCH or module isRichard Smith2014-03-20
| | | | | | | resolved, emit an update record. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204403 91177308-0d34-0410-b5e6-96231b3b80d8
* PR19152: If a variable template's type involves 'auto', instantiate theRichard Smith2014-03-16
| | | | | | | initializer with the variable in order to determine the type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204015 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing OMPThreadPrivateDecl and OMPClause iterators ↵Aaron Ballman2014-03-14
| | | | | | varlist_begin() and varlist_end() with iterator_range varlists(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203937 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing UsingDecl iterators shadow_begin() and shadow_end() with ↵Aaron Ballman2014-03-13
| | | | | | iterator_range shadows(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203825 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing CXXRecordDecl iterators init_begin() and init_end() with ↵Aaron Ballman2014-03-13
| | | | | | iterator_range inits(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203819 91177308-0d34-0410-b5e6-96231b3b80d8
* PR18275: If a member function of a class template is declared with aRichard Smith2014-03-13
| | | | | | | | | | | | | | | | const-qualified parameter type and the defined with a non-const-qualified parameter type, the parameter is not const inside its body. Ensure that the type we use when instantiating the body is the right one. Patch by suyog sarda! This is still rather unsatisfactory; it seems like it might be better to instantiate at least the function parameters, and maybe the complete function declaration, when we instantiate the definition for such a member function (instead of reusing the declaration from inside the instantiated class definition). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203741 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing Decl iterators attr_begin() and attr_end() with ↵Aaron Ballman2014-03-08
| | | | | | | | iterator_range attrs(). Updating all of the usages of the iterators with range-based for loops. This is a reapplication of r203236 with modifications to the definition of attrs() and following the new style guidelines on auto usage. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203362 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing EnumDecl iterators enumerator_begin() and enumerator_end() ↵Aaron Ballman2014-03-08
| | | | | | with iterator_range enumerators(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203353 91177308-0d34-0410-b5e6-96231b3b80d8
* Renaming the chains() ranged iterator to chain() per suggestion by Richard ↵Aaron Ballman2014-03-07
| | | | | | Smith. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203262 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing IndirectFieldDecl iterators chain_begin() and chain_end() ↵Aaron Ballman2014-03-07
| | | | | | with iterator_range chains(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203261 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing iterators ddiag_begin() and ddiag_end() with ↵Aaron Ballman2014-03-07
| | | | | | iterator_range ddiags(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203240 91177308-0d34-0410-b5e6-96231b3b80d8
* Fully reverting r203236 -- it seems the only bots that are happy are the ↵Aaron Ballman2014-03-07
| | | | | | MSVC bots. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203237 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing iterators attr_begin() and attr_end() with iterator_range ↵Aaron Ballman2014-03-07
| | | | | | attrs(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203236 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Fix for threadprivate construct instantiatiation.Alexey Bataev2014-03-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203225 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing iterators redecls_begin() and redecls_end() with ↵Aaron Ballman2014-03-06
| | | | | | iterator_range redecls(). Updating all of the usages of the iterators with range-based for loops, which allows the begin/end forms to be removed entirely. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203179 91177308-0d34-0410-b5e6-96231b3b80d8
* [-cxx-abi microsoft] Implement local manglings accuratelyDavid Majnemer2014-03-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The MSVC ABI appears to mangle the lexical scope into the names of statics. Specifically, a counter is incremented whenever a scope is entered where things can be declared in such a way that an ambiguity can arise. For example, a class scope inside of a class scope doesn't do anything interesting because the nested class cannot collide with another nested class. There are problems with this scheme: - It is unreliable. The counter is only incremented when a previously never encountered scope is entered. There are cases where this will cause ambiguity amongst declarations that have the same name where one was introduced in a deep scope while the other was introduced right after in the previous lexical scope. - It is wasteful. Statements like: {{{{{{{ static int foo = a; }}}}}}} will make the mangling of "foo" larger than it need be because the scope counter has been incremented many times. Because of these problems, and practical implementation concerns. We choose not to implement this scheme if the local static or local type isn't visible. The mangling of these declarations will look very similar but the numbering will make far more sense, this scheme is lifted from the Itanium ABI implementation. Reviewers: rsmith, doug.gregor, rnk, eli.friedman, cdavis5x Reviewed By: rnk CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2953 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202951 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Don't crash when trying to instantiate a local class with an invalid ↵David Majnemer2014-02-22
| | | | | | | | | | | | | | | | | base specifier It was previously thought that Sema::InstantiateClass could not fail from within this point in instantiate. However, it can happen if the class is invalid some way (i.e. invalid base specifier). This fixes PR18907. Differential Revision: http://llvm-reviews.chandlerc.com/D2850 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201913 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement DR329. We already did the right thing here in C++98 mode, but r104014Richard Smith2014-02-03
| | | | | | | (which implemented the DR) was disabled in C++11. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200673 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename getResultType() on function and method declarations to getReturnType()Alp Toker2014-01-25
| | | | | | | | | | | | | | | A return type is the declared or deduced part of the function type specified in the declaration. A result type is the (potentially adjusted) type of the value of an expression that calls the function. Rule of thumb: * Declarations have return types and parameters. * Expressions have result types and arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200082 91177308-0d34-0410-b5e6-96231b3b80d8
* Update FunctionTypeLoc and related names to match r199686Alp Toker2014-01-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199699 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename FunctionProtoType accessors from 'arguments' to 'parameters'Alp Toker2014-01-20
| | | | | | | | | | | | | | | | | Fix a perennial source of confusion in the clang type system: Declarations and function prototypes have parameters to which arguments are supplied, so calling these 'arguments' was a stretch even in C mode, let alone C++ where default arguments, templates and overloading make the distinction important to get right. Readability win across the board, especially in the casting, ADL and overloading implementations which make a lot more sense at a glance now. Will keep an eye on the builders and update dependent projects shortly. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199686 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up variable template handling a bit, and correct the behavior of nameRichard Smith2014-01-16
| | | | | | | lookup when declaring a variable template specialization. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199438 91177308-0d34-0410-b5e6-96231b3b80d8
* Distinguish between attributes explicitly written at the request of the ↵Aaron Ballman2014-01-16
| | | | | | | | user, and attributes implicitly generated to assist in bookkeeping by the compiler. This is done so by table generating a CreateImplicit method for each attribute. Additionally, remove the optional nature of the spelling list index when creating attributes. This is supported by table generating a Spelling enumeration when the spellings for an attribute are distinct enough to warrant it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199378 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new attribute 'enable_if' which can be used to control overload ↵Nick Lewycky2014-01-11
| | | | | | resolution based on the values of the function arguments at the call site. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198996 91177308-0d34-0410-b5e6-96231b3b80d8
* PR18401: Fix assert by implementing the current proposed direction of coreRichard Smith2014-01-09
| | | | | | | | issue 1430. Don't allow a pack expansion to be used as an argument to an alias template unless the corresponding parameter is a parameter pack. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198833 91177308-0d34-0410-b5e6-96231b3b80d8
* Removing some more unnecessary manual quotes from attribute diagnostics.Aaron Ballman2014-01-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198387 91177308-0d34-0410-b5e6-96231b3b80d8
* PR18232: implement instantiation for class-scope explicit specializations ofRichard Smith2013-12-14
| | | | | | | class templates (a Microsoft extension). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197298 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Propagate the mangling number into instantiationsDavid Majnemer2013-12-04
| | | | | | | | | | | | | | | | | | | We would lose track of the mangling number assigned to the original declaration which would cause us to create manglings that didn't match the Itanium C++ specification. e.g. Two static fields with the same name inside of a function template would receive the same mangling with LLVM fixing up the second field so they wouldn't collide. This would create an incompatibility with other compilers following the Itanium ABI. I've confirmed that the new mangling is identical to the ones generated by icc and gcc. N.B. This was uncovered while working on Microsoft mangler. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196368 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Instantiation of variable definitions weren't local enoughDavid Majnemer2013-11-27
| | | | | | | | | | | | We wouldn't properly save and restore the pending local instantiations we had built up prior to instantiation of a variable definition. This would lead to us instantiating too much causing crashes and other general badness. This fixes PR14374. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195887 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Don't look for the instantiation of a local extern decl in a differentArgyrios Kyrtzidis2013-11-27
| | | | | | | | dependent context that the one we are instantiating, otherwise there will be an assertion. rdar://15464547 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195828 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Instantiate local class and their members appropriatelyDavid Majnemer2013-11-27
| | | | | | | | | | | | We would fail to instantiate them when the surrounding function was instantiated. Instantiate the class and add it's members to the list of pending instantiations, they should be resolved when we are finished with the function's body. This fixes PR9685. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195827 91177308-0d34-0410-b5e6-96231b3b80d8
* Add class-specific operator new to Decl hierarchy. This guarantees that DeclsRichard Smith2013-11-22
| | | | | | | | | | | | | | can't accidentally be allocated the wrong way (missing prefix data for decls from AST files, for instance) and simplifies the CreateDeserialized functions a little. An extra DeclContext* parameter to the not-from-AST-file operator new allows us to ensure that we don't accidentally call the wrong one when deserializing (when we don't have a DeclContext), allows some extra checks, and prepares for some planned modules-related changes to Decl allocation. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195426 91177308-0d34-0410-b5e6-96231b3b80d8
* A decl never becomes unused. Make that explicit in the API.Rafael Espindola2013-10-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193248 91177308-0d34-0410-b5e6-96231b3b80d8