summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplate.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Support for C1x _Atomic specifier (see testcase). This is primarily being ↵Eli Friedman2011-10-061-0/+4
| | | | | | | | committed at the moment to help support C++0x <atomic>, but it should be a solid base for implementing the full specification of C1x _Atomic. Thanks to Jeffrey Yasskin for the thorough review! llvm-svn: 141330
* Fixed source range for template implicit instantiations.Abramo Bagnara2011-10-031-1/+1
| | | | llvm-svn: 141018
* Only print _Bool as 'bool' when 'bool' is defined as an object-likeDouglas Gregor2011-09-271-1/+1
| | | | | | macro whose only replacement token is '_Bool'. llvm-svn: 140656
* When 'bool' is not a built-in type but is defined as a macro, printDouglas Gregor2011-09-271-1/+1
| | | | | | | 'bool' rather than '_Bool' within types, to make things a bit more readable. Fixes <rdar://problem/10063263>. llvm-svn: 140650
* Get rid of useless helper Sema::CastCategory.Eli Friedman2011-09-271-2/+4
| | | | llvm-svn: 140642
* Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie2011-09-231-5/+0
| | | | llvm-svn: 140407
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-5/+6
| | | | llvm-svn: 140367
* Don't use TemplateArgumentListInfo inside AST nodes because it may leak.Argyrios Kyrtzidis2011-09-221-3/+1
| | | | | | Use ASTTemplateArgumentListInfo instead. llvm-svn: 140331
* Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear ↵Francois Pichet2011-09-171-3/+3
| | | | | | | | that this flag must be used only for Microsoft extensions and not emulation; to avoid confusion with the new LangOptions::MicrosoftMode flag. Many of the code now under LangOptions::MicrosoftExt will eventually be moved under the LangOptions::MicrosoftMode flag. llvm-svn: 139987
* Specializations cannot be module-hidden. Diagnose attempts to do so.Douglas Gregor2011-09-091-0/+6
| | | | llvm-svn: 139406
* __module_private__ is inherited by redeclarations of an entity, andDouglas Gregor2011-09-091-5/+10
| | | | | | must also be present of the first declaration of that entity. llvm-svn: 139384
* Propagate __module_private__ from previous declarations to laterDouglas Gregor2011-09-091-3/+5
| | | | | | declarations. llvm-svn: 139380
* Changed references of BaseTy, MemInitTy, CXXScopeTy, TemplateParamsTy to ↵Richard Trieu2011-09-091-2/+2
| | | | | | CXXBaseSpecifier, CXXCtorInitializer, NestedNameSpecifier, TemplateParameterList and removed their typedefs. llvm-svn: 139350
* Modules: introduce the __module_private__ declaration specifier, whichDouglas Gregor2011-09-091-4/+8
| | | | | | | indicates that a declaration is only visible within the module it is declared in. llvm-svn: 139348
* Fix a crash-on-invalid.Matt Beaumont-Gay2011-08-251-1/+1
| | | | | | | | Much to everyone's surprise, the default constructor for TypeResult produces an instance with Invalid == false. This seems like a decision we may want to revisit. llvm-svn: 138601
* Implement function template specialization at class scope extension in ↵Francois Pichet2011-08-141-3/+12
| | | | | | | | | | | | | | | | | Microsoft mode. A new AST node is introduced: ClassScopeFunctionSpecialization. This node holds a FunctionDecl that is not yet specialized; then during the class template instantiation the ClassScopeFunctionSpecialization will spawn the actual function specialization. Example: template <class T> class A { public: template <class U> void f(U p) { } template <> void f(int p) { } // <== class scope specialization }; This extension is necessary to parse MSVC standard C++ headers, MFC and ATL code. BTW, with this feature in, clang can parse (-fsyntax-only) all the MSVC 2010 standard header files without any error. llvm-svn: 137573
* When performing the lookup in the current scope for a member access toDouglas Gregor2011-08-101-1/+3
| | | | | | | | | | | | a member template, e.g., x.f<int> if we have found a template in the type of x, but the lookup in the current scope is ambiguous, just ignore the lookup in the current scope. Fixes <rdar://problem/9915664>. llvm-svn: 137255
* Make sure to canonicalize the argument type of a non-type templateDouglas Gregor2011-08-091-2/+3
| | | | | | argument of enumeration type when checking template arguments. Fixes PR10579. llvm-svn: 137101
* Add support for C++0x unicode string and character literals, from Craig Topper!Douglas Gregor2011-07-271-3/+15
| | | | llvm-svn: 136210
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-14/+14
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Restore the C-style cast hack for enum template arguments,John McCall2011-07-151-1/+10
| | | | | | | | which is required given the current setup for template argument deduction substitution validation, and add a test case to make sure we don't break it in the future. llvm-svn: 135262
* Create a new expression node, SubstNonTypeTemplateParmExpr,John McCall2011-07-151-30/+24
| | | | | | | | to represent a fully-substituted non-type template parameter. This should improve source fidelity, as well as being generically useful for diagnostics and such. llvm-svn: 135243
* Random cleanup:Francois Pichet2011-07-081-8/+7
| | | | | | | - fix a comment. - Remove an unnecessary { } block. llvm-svn: 134690
OpenPOWER on IntegriCloud