kamleshbhalui updated this revision to Diff 230569. kamleshbhalui added a comment.
Added a test. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D70537/new/ https://reviews.llvm.org/D70537 Files: clang/lib/CodeGen/CGDebugInfo.cpp clang/test/CodeGenCXX/pr42710.cpp Index: clang/test/CodeGenCXX/pr42710.cpp =================================================================== --- /dev/null +++ clang/test/CodeGenCXX/pr42710.cpp @@ -0,0 +1,18 @@ +// RUN: %clang %s -S -emit-llvm -g -o - -std=c++17 +// expected-no-diagnostics + +struct TypeId +{ + inline static int counter{}; + + template<typename...> + inline static const auto identifier = counter++; + + template<typename... Args> + inline static const auto value = identifier<Args...>; +}; + +int main() +{ + return TypeId::value<int>; +} Index: clang/lib/CodeGen/CGDebugInfo.cpp =================================================================== --- clang/lib/CodeGen/CGDebugInfo.cpp +++ clang/lib/CodeGen/CGDebugInfo.cpp @@ -1433,6 +1433,9 @@ if (isa<VarTemplatePartialSpecializationDecl>(V)) continue; + if (isa<VarTemplateSpecializationDecl>(V)) + continue; + // Reuse the existing static member declaration if one exists auto MI = StaticDataMemberCache.find(V->getCanonicalDecl()); if (MI != StaticDataMemberCache.end()) {
Index: clang/test/CodeGenCXX/pr42710.cpp =================================================================== --- /dev/null +++ clang/test/CodeGenCXX/pr42710.cpp @@ -0,0 +1,18 @@ +// RUN: %clang %s -S -emit-llvm -g -o - -std=c++17 +// expected-no-diagnostics + +struct TypeId +{ + inline static int counter{}; + + template<typename...> + inline static const auto identifier = counter++; + + template<typename... Args> + inline static const auto value = identifier<Args...>; +}; + +int main() +{ + return TypeId::value<int>; +} Index: clang/lib/CodeGen/CGDebugInfo.cpp =================================================================== --- clang/lib/CodeGen/CGDebugInfo.cpp +++ clang/lib/CodeGen/CGDebugInfo.cpp @@ -1433,6 +1433,9 @@ if (isa<VarTemplatePartialSpecializationDecl>(V)) continue; + if (isa<VarTemplateSpecializationDecl>(V)) + continue; + // Reuse the existing static member declaration if one exists auto MI = StaticDataMemberCache.find(V->getCanonicalDecl()); if (MI != StaticDataMemberCache.end()) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits