r179521 - Fix the storage class of method instantiations.
Rafael Espindola
rafael.espindola at gmail.com
Mon Apr 15 05:38:21 PDT 2013
Author: rafael
Date: Mon Apr 15 07:38:20 2013
New Revision: 179521
URL: http://llvm.org/viewvc/llvm-project?rev=179521&view=rev
Log:
Fix the storage class of method instantiations.
We keep the "as written" storage class, but that is a fuzzy concept for
instantiations. With this patch instantiations of methods of class templates
now get a storage class that is based on the semantics of isStatic(). With this
can simplify isStatic() itself.
Modified:
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=179521&r1=179520&r2=179521&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Mon Apr 15 07:38:20 2013
@@ -1258,20 +1258,7 @@ bool CXXRecordDecl::mayBeAbstract() cons
void CXXMethodDecl::anchor() { }
bool CXXMethodDecl::isStatic() const {
- const CXXMethodDecl *MD = this;
- for (;;) {
- const CXXMethodDecl *C = MD->getCanonicalDecl();
- if (C != MD) {
- MD = C;
- continue;
- }
-
- FunctionTemplateSpecializationInfo *Info =
- MD->getTemplateSpecializationInfo();
- if (!Info)
- break;
- MD = cast<CXXMethodDecl>(Info->getTemplate()->getTemplatedDecl());
- }
+ const CXXMethodDecl *MD = getCanonicalDecl();
if (MD->getStorageClass() == SC_Static)
return true;
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=179521&r1=179520&r2=179521&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Mon Apr 15 07:38:20 2013
@@ -1530,10 +1530,10 @@ TemplateDeclInstantiator::VisitCXXMethod
Conversion->isConstexpr(),
Conversion->getLocEnd());
} else {
+ StorageClass SC = D->isStatic() ? SC_Static : SC_None;
Method = CXXMethodDecl::Create(SemaRef.Context, Record,
StartLoc, NameInfo, T, TInfo,
- D->getStorageClass(),
- D->isInlineSpecified(),
+ SC, D->isInlineSpecified(),
D->isConstexpr(), D->getLocEnd());
}
More information about the cfe-commits
mailing list