[PATCH] D126172: [clang] Fix comparison of TemplateArgument when they are of template kind

Robert Esclapez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 2 13:22:43 PDT 2022


roberteg16 added a comment.

Hi again @mizvekov, I've been spending a bit of time on resuming this issue.

When applying (after reverting the changes) the first change related to the `Template` case of profiling the as-written one name this resulted in the following test failing:

Changes:

  -ID.AddPointer(Context.getCanonicalTemplateName(Template)
                                                      .getAsVoidPointer());
  +ID.AddPointer(Template.getAsVoidPointer());
    

Test failing:

  Clang :: CXX/basic/basic.lookup/basic.lookup.argdep/p2-associated-namespaces-classes.cpp
  Clang :: CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp
  Clang :: CodeGenCXX/mangle-variadic-templates.cpp
  Clang :: CodeGenCXX/mangle.cpp

The main reason of the failure is that now clang outputs errors. I'll only copy the CodeGenCXX/mangle.cpp output:

  /home/robert/Documents/llvm-project/clang/test/CodeGenCXX/mangle.cpp:516:17: error: explicit instantiation of 'foo' does not refer to a function template, variable template, member function, member class, or static data member
    template void foo(const A<B> &a);
                  ^
  /home/robert/Documents/llvm-project/clang/test/CodeGenCXX/mangle.cpp:513:43: note: candidate template ignored: failed template argument deduction
    template <template<class> class T> void foo(const A<T> &a) {}
                                            ^
  /home/robert/Documents/llvm-project/clang/test/CodeGenCXX/mangle.cpp:1146:10: warning: decomposition declarations are a C++17 extension [-Wc++17-extensions]
      auto [e] = g;
           ^~~
  /home/robert/Documents/llvm-project/clang/test/CodeGenCXX/mangle.cpp:1153:8: warning: decomposition declarations are a C++17 extension [-Wc++17-extensions]
    auto [a,b] = X{1,2};

I've been looking around trying to figure out what's the issue but I am feeling that I lack the required knowledge to diagnose properly the problem.

One question I want to ask is: On `StmtProfiler::VisitTemplateArgument` it states on a comment:

> // Mostly repetitive with TemplateArgument::Profile!

but as far as I could see it really does not mimic the behavior in some cases. Is this at purpose?

Thanks for your time.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126172/new/

https://reviews.llvm.org/D126172



More information about the cfe-commits mailing list