[PATCH] D120397: [C++20] [Modules] Make the linkage consistent for template and its specialization
David Blaikie via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 22 11:45:17 PDT 2022
dblaikie added inline comments.
================
Comment at: clang/test/CodeGenCXX/inconsistent-export-template.cpp:1-11
+// RUN: %clang_cc1 -std=c++20 %s -S -emit-llvm -triple %itanium_abi_triple -disable-llvm-passes -o - | FileCheck %s
+
+export module m;
+export template <class T>
+void f() {
+}
+
----------------
Is this test worth keeping now that we've got the unit test? It's not testing the linkage, by the looks of it & @aaron.ballman made a fair point that this code change doesn't touch codegen, so the AST unit test is probably more suitable.
================
Comment at: clang/unittests/AST/DeclTest.cpp:194-195
+ const FunctionDecl *SpecializedF = Funcs[1].getNodeAs<FunctionDecl>("f");
+ EXPECT_TRUE(TemplateF->getLinkageInternal() ==
+ SpecializedF->getLinkageInternal());
+}
----------------
Maybe use EXPECT_EQ to get better error messages if this fails (that way the error message can include the values - whereas written with TRUE+== the error message can only include "false") - similarly with the size() == 2, prefer EXPECT_EQ(size(), 2)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120397/new/
https://reviews.llvm.org/D120397
More information about the cfe-commits
mailing list