summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplate.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement [temp.param]p5: the top-level cv-qualifiers on a non-type templateRichard Smith2012-03-131-2/+6
| | | | | | parameter's declaration are ignored when determining the parameter's type. llvm-svn: 152619
* Fix PR10447: lazily building name lookup tables for DeclContexts was broken.Richard Smith2012-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | The deferred lookup table building step couldn't accurately tell which Decls should be included in the lookup table, and consequently built different tables in some cases. Fix this by removing lazy building of DeclContext name lookup tables. In practice, the laziness was frequently not worthwhile in C++, because we performed lookup into most DeclContexts. In C, it had a bit more value, since there is no qualified lookup. In the place of lazy lookup table building, we simply don't build lookup tables for function DeclContexts at all. Such name lookup tables are not useful, since they don't capture the scoping information required to correctly perform name lookup in a function scope. The resulting performance delta is within the noise on my testing, but appears to be a very slight win for C++ and a very slight loss for C. The C performance can probably be recovered (if it is a measurable problem) by avoiding building the lookup table for the translation unit. llvm-svn: 152608
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-24/+24
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* When determining whether an identifier followed by a '<' in a memberDouglas Gregor2012-03-101-9/+21
| | | | | | | | access expression is the start of a template-id, ignore function templates found in the context of the entire postfix-expression. Fixes PR11856. llvm-svn: 152520
* [AST/Sema/libclang] Replace getSourceRange().getBegin() with getLocStart().Daniel Dunbar2012-03-091-27/+26
| | | | | | | | | - 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
* Two fixes to how we compute visibility:Rafael Espindola2012-02-231-0/+1
| | | | | | | | | | | | * Handle some situations where we should never make a decl more visible, even when merging in an explicit visibility. * Handle attributes in members of classes that are explicitly specialized. Thanks Nico for the report and testing, Eric for the initial review, and dgregor for the awesome test27 :-) llvm-svn: 151236
* Fix a constexpr FIXME: When implicitly instantiating the primary template for anRichard Smith2012-02-201-1/+6
| | | | | | | explicit specialization of a function template, mark the instantiation as constexpr if the specialization is, rather than requiring them to match. llvm-svn: 151001
* Introduce support for template instantiation of lambdaDouglas Gregor2012-02-131-0/+5
| | | | | | | | | | | | | | | | | | expressions. This is mostly a simple refact, splitting the main "start a lambda expression" function into smaller chunks that are driven either from the parser (Sema::ActOnLambdaExpr) or during AST transformation (TreeTransform::TransformLambdaExpr). A few minor interesting points: - Added new entry points for TreeTransform, so that we can explicitly establish the link between the lambda closure type in the template and the lambda closure type in the instantiation. - Added a bit into LambdaExpr specifying whether it had an explicit result type or not. We should have had this anyway. This code is 'lightly' tested. llvm-svn: 150417
* Make sure we convert struct layout pragmas to attributes for class templates ↵Eli Friedman2012-02-101-0/+5
| | | | | | the same way we do for non-template classes. <rdar://problem/10791194>. llvm-svn: 150221
* Added source location for the template keyword in ↵Abramo Bagnara2012-02-061-0/+3
| | | | | | | | | | 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-061-6/+6
| | | | | | 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-061-24/+26
| | | | | | process removed some naming ambiguities. llvm-svn: 149870
* Fixed instantiation of DependentScopeDeclRefExpr.Abramo Bagnara2012-02-061-4/+4
| | | | llvm-svn: 149868
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Move a method from IdentifierTable.h out of line and remove the SmallString ↵Benjamin Kramer2012-02-041-0/+1
| | | | | | | | include. Fix all the transitive include users. llvm-svn: 149783
* In C++11 mode, when an integral constant expression is desired and we have aRichard Smith2012-02-041-5/+5
| | | | | | | | | | | | | | | | | | value of class type, look for a unique conversion operator converting to integral or unscoped enumeration type and use that. Implements [expr.const]p5. Sema::VerifyIntegerConstantExpression now performs the conversion and returns the converted result. Some important callers of Expr::isIntegralConstantExpr have been switched over to using it (including all of those required for C++11 conformance); this switch brings a side-benefit of improved diagnostics and, in several cases, simpler code. However, some language extensions and attributes have not been moved across and will not perform implicit conversions on constant expressions of literal class type where an ICE is required. In passing, fix static_assert to perform a contextual conversion to bool on its argument. llvm-svn: 149776
* When a pack expansion occurs in the template argument list of an aliasDouglas Gregor2012-02-031-5/+14
| | | | | | | | template without a corresponding parameter pack, don't immediately substitute the alias template. This is under discussion in the C++ committee, and may become ill-formed, but for now we match GCC. llvm-svn: 149697
* Implement support for a pack expansion into a fixed-lengthDouglas Gregor2012-02-031-45/+101
| | | | | | | | | template. Such pack expansions can easily fail at template instantiation time, if the expanded parameter packs are of the wrong length. Fixes <rdar://problem/10040867>, PR9021, and the example that came up today at Going Native. llvm-svn: 149685
* Split Sema::MarkDeclarationReferenced into multiple functions; the ↵Eli Friedman2012-02-021-1/+1
| | | | | | additional entry points are needed to implement C++11 odr-use marking correctly. No functional change in this patch; I'll actually make the change which fixes the odr-use marking in a followup patch. llvm-svn: 149586
* Make the callback object to Sema::CorrectTypo mandatory.Kaelyn Uhrain2012-01-311-1/+1
| | | | llvm-svn: 149451
* SmallBitVectorize the deduced parameter set.Benjamin Kramer2012-01-301-7/+4
| | | | llvm-svn: 149253
* Added source location for the template keyword in AST template-id expressions.Abramo Bagnara2012-01-271-5/+18
| | | | llvm-svn: 149127
* Avoid redundant NNS qualification in constructor/destructor names.Abramo Bagnara2012-01-271-8/+12
| | | | llvm-svn: 149124
* constexpr: converted constant expression handling for enumerator values, caseRichard Smith2012-01-181-19/+62
| | | | | | | | | | values and non-type template arguments of integral and enumeration types. This change causes some legal C++98 code to no longer compile in C++11 mode, by enforcing the C++11 rule that narrowing integral conversions are not permitted in the final implicit conversion sequence for the above cases. llvm-svn: 148439
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-171-14/+4
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* De-virtualize getPreviousDecl() and getMostRecentDecl() when we knowDouglas Gregor2012-01-141-2/+2
| | | | | | | | | | | | we have a redeclarable type, and only use the new virtual versions (getPreviousDeclImpl() and getMostRecentDeclImpl()) when we don't have that type information. This keeps us from penalizing users with strict type information (and is the moral equivalent of a "final" method). Plus, settle on the names getPreviousDecl() and getMostRecentDecl() throughout. llvm-svn: 148187
* Introduce Decl::getPreviousDecl() and Decl::getMostRecentDecl(),Douglas Gregor2012-01-141-24/+7
| | | | | | | | virtual functions that provide previous/most recent redeclaration information for any declaration. Use this to eliminate the redundant, less efficient getPreviousDecl() functions. llvm-svn: 148184
* Convert SemaTemplate*.cpp to pass a callback object to CorrectTypo.Kaelyn Uhrain2012-01-131-2/+7
| | | | | | | | The change to SemaTemplateVariadic.cpp improves the typo correction results in certain situations, while the change to SemaTemplate.cpp does not change existing behavior. llvm-svn: 148155
* In Objective-C++, actually compute the base type of a member accessDouglas Gregor2012-01-121-0/+6
| | | | | | | | expression for an Objective-C object or pointer type, so that we don't attempt to treat the member name as a template. Fixes <rdar://problem/10672501>. llvm-svn: 148028
* Update C++11 scoped enumeration support to match the final proposal:Richard Smith2012-01-101-1/+1
| | | | | | | | - reject definitions of enums within friend declarations - require 'enum', not 'enum class', for non-declaring references to scoped enumerations llvm-svn: 147824
* Fix "note" of a duplicate explicit instantiation definition following a ↵Nico Weber2012-01-091-9/+20
| | | | | | specialization. llvm-svn: 147798
* Process attributes in explicit function template instantiations. Fixes part ofRafael Espindola2012-01-041-0/+3
| | | | | | PR11690. llvm-svn: 147523
* Process attributes in explicit template instatiation definitions. Fixes PR11690.Rafael Espindola2012-01-031-0/+3
| | | | llvm-svn: 147441
* Fix several issues related to specializations and explicit instantiations.Nico Weber2011-12-231-4/+26
| | | | | | | | | | | | | | | Explicit instantiations following specializations are no-ops and hence have no PointOfInstantiation. That was done correctly in most cases, but for a specialization -> instantiation decl -> instantiation definition chain, the definition didn't realize that it was a no-op. Fix that. Also, when printing diagnostics for these no-ops, get the diag location from the decl name location. Add many test cases, one of them not yet passing (but it failed the same way before this change). Fixes http://llvm.org/pr11558 and more. llvm-svn: 147225
* When performing name lookup for a redeclaration, ignore moduleDouglas Gregor2011-12-201-8/+1
| | | | | | | | | | | | | | | | | | | | | visibility restrictions. This ensures that all declarations of the same entity end up in the same redeclaration chain, even if some of those declarations aren't visible. While this may seem unfortunate to some---why can't two C modules have different functions named 'f'?---it's an acknowedgment that a module does not introduce a new "namespace" of names. As part of this, stop merging the 'module-private' bit from previous declarations to later declarations, because we want each declaration in a module to stand on its own because this can effect, for example, submodule visibility. Note that this notion of names that are invisible to normal name lookup but are available for redeclaration lookups is how we should implement friend declarations and extern declarations within local function scopes. I'm not tackling that problem now. llvm-svn: 146980
* When we notice that a member function is defined with "= delete" or "=Douglas Gregor2011-11-071-1/+1
| | | | | | | | | | | | default", make a note of which is used when creating the initial declaration. Previously, we would wait until later to handle default/delete as a definition, but this is too late: when adding the declaration, we already treated the declaration as "user-provided" when in fact it was merely "user-declared". Fixes PR10861 and PR10442, along with a bunch of FIXMEs. llvm-svn: 144011
* When we're checking a friend function template in an out-of-line classDouglas Gregor2011-11-031-0/+3
| | | | | | | | | | definition, we may not have a scope corresponding to the namespace where that friend function template actually lives. Work around this issue by faking up a scope with the appropriate DeclContext. This is a bit of a hack, but it fixes <rdar://problem/10204947>. llvm-svn: 143614
* Fix various minor issues find via unreachable code warnings, fromDouglas Gregor2011-11-021-4/+0
| | | | | | Ahmed Charles! llvm-svn: 143569
* When we see an out-of-line definition of a member class template thatDouglas Gregor2011-11-011-1/+3
| | | | | | | does not match any declaration in the class (or class template), be sure to mark it as invalid. Fixes PR10924 / <rdar://problem/10119422>. llvm-svn: 143504
* Fix some cases where a CK_IntegralCast was being used to convert an lvalue to anRichard Smith2011-10-271-1/+10
| | | | | | | | | rvalue. An assertion to catch this is in ImpCastExprToType will follow, but vector operations currently trip over this (due to omitting the usual arithmetic conversions). Also add an assert to catch missing lvalue-to-rvalue conversions on the LHS of ->. llvm-svn: 143155
* Check for unexpanded parameter packs in the name that guards aDouglas Gregor2011-10-251-1/+1
| | | | | | | | | Microsoft __if_exists/__if_not_exists statement. Also note that we weren't traversing DeclarationNameInfo *at all* within the RecursiveASTVisitor, which would be rather fatal for variadic templates. llvm-svn: 142906
* There's no point in marking a declaration invalid just because itDouglas Gregor2011-10-201-9/+11
| | | | | | | | shadows a template parameter. Complain about the shadowing (or not, under -fms-extensions), but don't invalidate the declaration. Merely forget about the template parameter declaration. llvm-svn: 142596
* Diagnose class template (partial) specializations that occur in theDouglas Gregor2011-10-201-1/+10
| | | | | | | *wrong* class scope. This is one of the problems behind <rdar://problem/9676205>. llvm-svn: 142588
* Fix pr9789, assert-on-invalid while instantiating an (invalid) class ↵David Blaikie2011-10-191-17/+16
| | | | | | template with a non-final parameter pack. Also improve the warning for non-final parameter packs in this scenario so it only fires once, rather than once for every template parameter after the non-final parameter pack. llvm-svn: 142473
* -Wc++98-compat and -Wc++98-compat-pedantic warnings for Sema, part 1.Richard Smith2011-10-181-43/+68
| | | | llvm-svn: 142419
* Add -Wc++11-compat warning for an inline specifier on an explicit instantiation.Richard Smith2011-10-181-2/+4
| | | | llvm-svn: 142333
* Refactor the checking for explicit template instantiations being performed inRichard Smith2011-10-181-31/+27
| | | | | | | | | the right namespace in C++11 mode. Teach the code to prefer the 'must be in precisely this namespace' diagnostic whenever that's true, and fix a defect which resulted in the -Wc++11-compat warning in C++98 mode sometimes being omitted. llvm-svn: 142329
* [temp.explicit]p1: constexpr cannot be specified in explicit instantiations.Richard Smith2011-10-141-3/+6
| | | | llvm-svn: 141982
* When declaring an out-of-line template, attempt to rebuild any typesDouglas Gregor2011-10-141-0/+48
| | | | | | | within the template parameter list that may have changed now that we know the current instantiation. Fixes <rdar://problem/10194295>. llvm-svn: 141954
* Move some bool flags out of function parameter lists.Kaelyn Uhrain2011-10-111-3/+3
| | | | llvm-svn: 141610
OpenPOWER on IntegriCloud