Hi Yang,
Why RemoveBaseClass ignores templates?
I have a test case (attached) which contains redundant base class A, which is
not eliminated by creduce because RemoveBaseClass skips template classes by
design.
After making the next patch it is eliminated:
diff --git a/clang_delta/RemoveBaseClass.cpp b/clang_delta/RemoveBaseClass.cpp
index 41bae82..219c5d8 100644
--- a/clang_delta/RemoveBaseClass.cpp
+++ b/clang_delta/RemoveBaseClass.cpp
@@ -147,8 +147,7 @@ bool RemoveBaseClass::isDirectlyDerivedFrom(const
CXXRecordDecl *SubC,
void RemoveBaseClass::handleOneCXXRecordDecl(const CXXRecordDecl *CXXRD)
{
- if (isSpecialRecordDecl(CXXRD) || CXXRD->getDescribedClassTemplate() ||
- !CXXRD->hasDefinition())
+ if (isSpecialRecordDecl(CXXRD) || !CXXRD->hasDefinition())
return;
--
Regards,
Konstantinclass A
{
};
template < bool > class B:A
{
public:
static bool isEqual (double);
};
double a;
template < bool isDouble > bool B < isDouble >::isEqual (double)
{
return 0 * a;
}
void
fn1 ()
{
B < 0 >::isEqual (0);
-0.5;
-0.0;
}