Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package cvise for openSUSE:Factory checked in at 2022-12-14 14:11:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cvise (Old) and /work/SRC/openSUSE:Factory/.cvise.new.1835 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cvise" Wed Dec 14 14:11:19 2022 rev:63 rq:1042816 version:2.6.0+git.20221214.96f841e Changes: -------- --- /work/SRC/openSUSE:Factory/cvise/cvise.changes 2022-12-13 18:57:48.087950691 +0100 +++ /work/SRC/openSUSE:Factory/.cvise.new.1835/cvise.changes 2022-12-14 14:11:31.831657513 +0100 @@ -1,0 +2,6 @@ +Wed Dec 14 08:12:38 UTC 2022 - mli...@suse.cz + +- Update to version 2.6.0+git.20221214.96f841e: + * Pass instantiate-template-param learned to remove template arguments and parameters + +------------------------------------------------------------------- Old: ---- cvise-2.6.0+git.20221213.c01d287.tar.xz New: ---- cvise-2.6.0+git.20221214.96f841e.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cvise.spec ++++++ --- /var/tmp/diff_new_pack.B3omWT/_old 2022-12-14 14:11:32.927663150 +0100 +++ /var/tmp/diff_new_pack.B3omWT/_new 2022-12-14 14:11:32.979663418 +0100 @@ -17,7 +17,7 @@ Name: cvise -Version: 2.6.0+git.20221213.c01d287 +Version: 2.6.0+git.20221214.96f841e Release: 0 Summary: Super-parallel Python port of the C-Reduce License: BSD-3-Clause ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.B3omWT/_old 2022-12-14 14:11:33.383665496 +0100 +++ /var/tmp/diff_new_pack.B3omWT/_new 2022-12-14 14:11:33.415665660 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/marxin/cvise</param> - <param name="changesrevision">c01d287a694750859960e3c9834b4af2db15ef5b</param></service></servicedata> + <param name="changesrevision">96f841e316adad54bdce10cc2b045eaf4619e142</param></service></servicedata> (No newline at EOF) ++++++ cvise-2.6.0+git.20221213.c01d287.tar.xz -> cvise-2.6.0+git.20221214.96f841e.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.6.0+git.20221213.c01d287/clang_delta/CMakeLists.txt new/cvise-2.6.0+git.20221214.96f841e/clang_delta/CMakeLists.txt --- old/cvise-2.6.0+git.20221213.c01d287/clang_delta/CMakeLists.txt 2022-12-13 16:43:50.000000000 +0100 +++ new/cvise-2.6.0+git.20221214.96f841e/clang_delta/CMakeLists.txt 2022-12-14 08:57:16.000000000 +0100 @@ -98,6 +98,12 @@ "/tests/instantiate-template-param/test6.output" "/tests/instantiate-template-param/test7.cc" "/tests/instantiate-template-param/test7.output" + "/tests/instantiate-template-param/test8a.cc" + "/tests/instantiate-template-param/test8a.output" + "/tests/instantiate-template-param/test8b.cc" + "/tests/instantiate-template-param/test8b.output" + "/tests/instantiate-template-param/test8c.cc" + "/tests/instantiate-template-param/test8c.output" "/tests/local-to-global/macro.c" "/tests/local-to-global/macro.output" "/tests/local-to-global/unnamed_1.c" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.6.0+git.20221213.c01d287/clang_delta/InstantiateTemplateParam.cpp new/cvise-2.6.0+git.20221214.96f841e/clang_delta/InstantiateTemplateParam.cpp --- old/cvise-2.6.0+git.20221213.c01d287/clang_delta/InstantiateTemplateParam.cpp 2022-12-13 16:43:50.000000000 +0100 +++ new/cvise-2.6.0+git.20221214.96f841e/clang_delta/InstantiateTemplateParam.cpp 2022-12-14 08:57:16.000000000 +0100 @@ -105,7 +105,7 @@ bool InstantiateTemplateParamASTVisitor::VisitFunctionTemplateDecl( FunctionTemplateDecl *D) { - if (D->isThisDeclarationADefinition()) + if (D->isFirstDecl()) ConsumerInstance->handleOneFunctionTemplateDecl(D); return true; } @@ -121,6 +121,17 @@ bool VisitTemplateTypeParmTypeLoc(TemplateTypeParmTypeLoc Loc); + bool VisitDeclRefExpr(DeclRefExpr* DRE) { + if (DRE->getDecl() == ConsumerInstance->TheTemplateSpec) { + auto Idx = ConsumerInstance->TheParameterIdx; + if (DRE->getNumTemplateArgs() > Idx) { + return ConsumerInstance->RewriteHelper->removeTemplateArgument(DRE, Idx); + } + } + + return true; + } + private: InstantiateTemplateParam *ConsumerInstance; @@ -213,15 +224,11 @@ void InstantiateTemplateParam::removeTemplateKeyword() { - if (dyn_cast<ClassTemplateDecl>(TheTemplateDecl)) + if (isa<ClassTemplateDecl>(TheTemplateDecl)) return; TemplateParameterList *TPList = TheTemplateDecl->getTemplateParameters(); - if (TPList->size() != 1) - return; - const NamedDecl *ND = TPList->getParam(0); (void)ND; - TransAssert((ND == TheParameter) && "Invalid template parameter!"); - TheRewriter.RemoveText(SourceRange(TPList->getTemplateLoc(), - TPList->getRAngleLoc())); + if (TheParameterIdx < TPList->size()) + RewriteHelper->removeTemplateParameter(TPList, TheParameterIdx); } void InstantiateTemplateParam::addForwardDecl() @@ -314,7 +321,11 @@ { llvm::raw_string_ostream Strm(Str); QT.print(Strm, getPrintingPolicy(), ForwardStr); + if (Str == "nullptr_t") + Str = "decltype(nullptr)"; + FindForwardDeclVisitor(this, ForwardStr).TraverseType(QT); + return true; } @@ -332,18 +343,15 @@ } void InstantiateTemplateParam::handleOneTemplateSpecialization( - const TemplateDecl *D, const TemplateArgumentList & ArgList) + const TemplateDecl *D, const TemplateArgumentList & ArgList, const clang::Decl* Spec) { if (isInIncludedFile(D)) return; - NamedDecl *ND = D->getTemplatedDecl(); + NamedDecl *TD = D->getTemplatedDecl(); TemplateParameterSet ParamsSet; TemplateParameterVisitor ParameterVisitor(ParamsSet); - ParameterVisitor.TraverseDecl(ND); - - if (ParamsSet.size() == 0) - return; + ParameterVisitor.TraverseDecl(TD); unsigned NumArgs = ArgList.size(); (void)NumArgs; unsigned Idx = -1; @@ -354,7 +362,11 @@ // TemplateTemplateParmDecl for now const TemplateTypeParmDecl *TyParmDecl = dyn_cast<TemplateTypeParmDecl>(ND); - if (!TyParmDecl || TyParmDecl->isParameterPack() || !ParamsSet.count(ND)) + if (!TyParmDecl || TyParmDecl->isParameterPack()) + continue; + // For classes we are not removing the template parameter right now + // So we need to check that any replacement is performed + if (isa<ClassTemplateDecl>(D) && !ParamsSet.count(ND)) continue; TransAssert((Idx < NumArgs) && "Invalid Idx!"); @@ -370,6 +382,8 @@ if (ValidInstanceNum == TransformationCounter) { TheInstantiationString = ArgStr; TheParameter = ND; + TheParameterIdx = Idx; + TheTemplateSpec = Spec; TheTemplateDecl = D; TheForwardDeclString = ForwardStr; } @@ -388,7 +402,7 @@ ++I; if (I != D->spec_end()) return; - handleOneTemplateSpecialization(D, SpecD->getTemplateArgs()); + handleOneTemplateSpecialization(D, SpecD->getTemplateArgs(), SpecD); } void InstantiateTemplateParam::handleOneFunctionTemplateDecl( @@ -404,7 +418,7 @@ return; if (const FunctionTemplateSpecializationInfo *Info = FD->getTemplateSpecializationInfo()) { - handleOneTemplateSpecialization(D, *(Info->TemplateArguments)); + handleOneTemplateSpecialization(D, *(Info->TemplateArguments), FD); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.6.0+git.20221213.c01d287/clang_delta/InstantiateTemplateParam.h new/cvise-2.6.0+git.20221214.96f841e/clang_delta/InstantiateTemplateParam.h --- old/cvise-2.6.0+git.20221213.c01d287/clang_delta/InstantiateTemplateParam.h 2022-12-13 16:43:50.000000000 +0100 +++ new/cvise-2.6.0+git.20221214.96f841e/clang_delta/InstantiateTemplateParam.h 2022-12-14 08:57:16.000000000 +0100 @@ -66,7 +66,8 @@ void handleOneTemplateSpecialization( const clang::TemplateDecl *D, - const clang::TemplateArgumentList & ArgList); + const clang::TemplateArgumentList & ArgList, + const clang::Decl* Spec); bool getTemplateArgumentString(const clang::TemplateArgument &Arg, std::string &Str, @@ -102,8 +103,12 @@ const clang::NamedDecl *TheParameter; + unsigned TheParameterIdx = 0; + const clang::TemplateDecl *TheTemplateDecl; + const clang::Decl* TheTemplateSpec = nullptr; + std::string TheInstantiationString; std::string TheForwardDeclString; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.6.0+git.20221213.c01d287/clang_delta/RewriteUtils.cpp new/cvise-2.6.0+git.20221214.96f841e/clang_delta/RewriteUtils.cpp --- old/cvise-2.6.0+git.20221213.c01d287/clang_delta/RewriteUtils.cpp 2022-12-13 16:43:50.000000000 +0100 +++ new/cvise-2.6.0+git.20221214.96f841e/clang_delta/RewriteUtils.cpp 2022-12-14 08:57:16.000000000 +0100 @@ -1832,6 +1832,34 @@ } } +bool RewriteUtils::removeTemplateArgument(const clang::DeclRefExpr* DRE, unsigned Idx) +{ + assert(Idx < DRE->getNumTemplateArgs()); + + const TemplateArgumentLoc* Args = DRE->getTemplateArgs(); + if (DRE->getNumTemplateArgs() == 1) { + return !TheRewriter->RemoveText({ DRE->getLAngleLoc(), DRE->getRAngleLoc() }); + } else if (Idx == 0) { + return removeTextUntil(Args[Idx].getSourceRange(), ','); + } else { + return removeTextFromLeftAt(Args[Idx].getSourceRange(), ',', Args[Idx].getSourceRange().getEnd()); + } +} + +bool RewriteUtils::removeTemplateParameter(const clang::TemplateParameterList* TPL, unsigned Idx) +{ + assert(Idx < TPL->size()); + + const NamedDecl* Param = TPL->getParam(Idx); + if (TPL->size() == 1) { + return !TheRewriter->RemoveText({ TPL->getTemplateLoc(), TPL->getRAngleLoc() }); + } else if (Idx == 0) { + return removeTextUntil(Param->getSourceRange(), ','); + } else { + return removeTextFromLeftAt(Param->getSourceRange(), ',', Param->getEndLoc()); + } +} + bool RewriteUtils::removeClassDecls(const CXXRecordDecl *CXXRD) { for (CXXRecordDecl::redecl_iterator I = CXXRD->redecls_begin(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.6.0+git.20221213.c01d287/clang_delta/RewriteUtils.h new/cvise-2.6.0+git.20221214.96f841e/clang_delta/RewriteUtils.h --- old/cvise-2.6.0+git.20221213.c01d287/clang_delta/RewriteUtils.h 2022-12-13 16:43:50.000000000 +0100 +++ new/cvise-2.6.0+git.20221214.96f841e/clang_delta/RewriteUtils.h 2022-12-14 08:57:16.000000000 +0100 @@ -14,6 +14,7 @@ #include <string> #include "clang/Basic/SourceLocation.h" #include "clang/AST/NestedNameSpecifier.h" +#include "clang/AST/DeclTemplate.h" #ifndef ENABLE_TRANS_ASSERT #define TransAssert(x) {if (!(x)) exit(-1);} @@ -261,6 +262,10 @@ bool removeCXXCtorInitializer(const clang::CXXCtorInitializer *Init, unsigned Index, unsigned NumInits); + bool removeTemplateArgument(const clang::DeclRefExpr* DRE, unsigned Idx); + + bool removeTemplateParameter(const clang::TemplateParameterList* TPL, unsigned Idx); + bool removeClassDecls(const clang::CXXRecordDecl *CXXRD); bool removeClassTemplateDecls(const clang::ClassTemplateDecl *TmplD); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.6.0+git.20221213.c01d287/clang_delta/tests/instantiate-template-param/test6.output new/cvise-2.6.0+git.20221214.96f841e/clang_delta/tests/instantiate-template-param/test6.output --- old/cvise-2.6.0+git.20221213.c01d287/clang_delta/tests/instantiate-template-param/test6.output 2022-12-13 16:43:50.000000000 +0100 +++ new/cvise-2.6.0+git.20221214.96f841e/clang_delta/tests/instantiate-template-param/test6.output 2022-12-14 08:57:16.000000000 +0100 @@ -1,5 +1,5 @@ -template <class f, class g> void C(f, double) {} +template <class f> void C(f, double) {} void f() { - C<int, double>(10, 1.0); + C<int>(10, 1.0); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.6.0+git.20221213.c01d287/clang_delta/tests/instantiate-template-param/test8a.cc new/cvise-2.6.0+git.20221214.96f841e/clang_delta/tests/instantiate-template-param/test8a.cc --- old/cvise-2.6.0+git.20221213.c01d287/clang_delta/tests/instantiate-template-param/test8a.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/cvise-2.6.0+git.20221214.96f841e/clang_delta/tests/instantiate-template-param/test8a.cc 2022-12-14 08:57:16.000000000 +0100 @@ -0,0 +1,3 @@ +template <class a, class b, class c> a b(); + +int x = b<int, float, char>(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.6.0+git.20221213.c01d287/clang_delta/tests/instantiate-template-param/test8a.output new/cvise-2.6.0+git.20221214.96f841e/clang_delta/tests/instantiate-template-param/test8a.output --- old/cvise-2.6.0+git.20221213.c01d287/clang_delta/tests/instantiate-template-param/test8a.output 1970-01-01 01:00:00.000000000 +0100 +++ new/cvise-2.6.0+git.20221214.96f841e/clang_delta/tests/instantiate-template-param/test8a.output 2022-12-14 08:57:16.000000000 +0100 @@ -0,0 +1,3 @@ +template < class b, class c> int b(); + +int x = b< float, char>(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.6.0+git.20221213.c01d287/clang_delta/tests/instantiate-template-param/test8b.cc new/cvise-2.6.0+git.20221214.96f841e/clang_delta/tests/instantiate-template-param/test8b.cc --- old/cvise-2.6.0+git.20221213.c01d287/clang_delta/tests/instantiate-template-param/test8b.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/cvise-2.6.0+git.20221214.96f841e/clang_delta/tests/instantiate-template-param/test8b.cc 2022-12-14 08:57:16.000000000 +0100 @@ -0,0 +1,3 @@ +template <class a, class b, class c> a b(); + +int x = b<int, float, char>(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.6.0+git.20221213.c01d287/clang_delta/tests/instantiate-template-param/test8b.output new/cvise-2.6.0+git.20221214.96f841e/clang_delta/tests/instantiate-template-param/test8b.output --- old/cvise-2.6.0+git.20221213.c01d287/clang_delta/tests/instantiate-template-param/test8b.output 1970-01-01 01:00:00.000000000 +0100 +++ new/cvise-2.6.0+git.20221214.96f841e/clang_delta/tests/instantiate-template-param/test8b.output 2022-12-14 08:57:16.000000000 +0100 @@ -0,0 +1,3 @@ +template <class a, class c> a b(); + +int x = b<int, char>(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.6.0+git.20221213.c01d287/clang_delta/tests/instantiate-template-param/test8c.cc new/cvise-2.6.0+git.20221214.96f841e/clang_delta/tests/instantiate-template-param/test8c.cc --- old/cvise-2.6.0+git.20221213.c01d287/clang_delta/tests/instantiate-template-param/test8c.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/cvise-2.6.0+git.20221214.96f841e/clang_delta/tests/instantiate-template-param/test8c.cc 2022-12-14 08:57:16.000000000 +0100 @@ -0,0 +1,3 @@ +template <class a, class b, class c> a b(); + +int x = b<int, float, char>(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.6.0+git.20221213.c01d287/clang_delta/tests/instantiate-template-param/test8c.output new/cvise-2.6.0+git.20221214.96f841e/clang_delta/tests/instantiate-template-param/test8c.output --- old/cvise-2.6.0+git.20221213.c01d287/clang_delta/tests/instantiate-template-param/test8c.output 1970-01-01 01:00:00.000000000 +0100 +++ new/cvise-2.6.0+git.20221214.96f841e/clang_delta/tests/instantiate-template-param/test8c.output 2022-12-14 08:57:16.000000000 +0100 @@ -0,0 +1,3 @@ +template <class a, class b> a b(); + +int x = b<int, float>(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.6.0+git.20221213.c01d287/clang_delta/tests/test_clang_delta.py new/cvise-2.6.0+git.20221214.96f841e/clang_delta/tests/test_clang_delta.py --- old/cvise-2.6.0+git.20221213.c01d287/clang_delta/tests/test_clang_delta.py 2022-12-13 16:43:50.000000000 +0100 +++ new/cvise-2.6.0+git.20221214.96f841e/clang_delta/tests/test_clang_delta.py 2022-12-14 08:57:16.000000000 +0100 @@ -124,7 +124,7 @@ self.check_clang_delta('instantiate-template-param/test4.cc', '--transformation=instantiate-template-param --counter=1') def test_instantiate_template_param_default_test5(self): - self.check_clang_delta('instantiate-template-param/test5.cc', '--transformation=instantiate-template-param --counter=1') + self.check_clang_delta('instantiate-template-param/test5.cc', '--transformation=instantiate-template-param --counter=2') def test_instantiate_template_param_default_test6(self): self.check_clang_delta('instantiate-template-param/test6.cc', '--transformation=instantiate-template-param --counter=2') @@ -132,6 +132,15 @@ def test_instantiate_template_param_default_test7(self): self.check_clang_delta('instantiate-template-param/test7.cc', '--transformation=instantiate-template-param --counter=1') + def test_instantiate_template_param_default_test8a(self): + self.check_clang_delta('instantiate-template-param/test8a.cc', '--transformation=instantiate-template-param --counter=1') + + def test_instantiate_template_param_default_test8b(self): + self.check_clang_delta('instantiate-template-param/test8b.cc', '--transformation=instantiate-template-param --counter=2') + + def test_instantiate_template_param_default_test8c(self): + self.check_clang_delta('instantiate-template-param/test8c.cc', '--transformation=instantiate-template-param --counter=3') + def test_local_to_global_macro(self): self.check_clang_delta('local-to-global/macro.c', '--transformation=local-to-global --counter=1')