[clang-tools-extra] [clang-tidy] Fix performance-trivially-destructible with C++20 modules (PR #178471)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 31 08:18:16 PST 2026


================
@@ -0,0 +1,27 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+// RUN: %clang -std=c++20 -x c++-module --precompile %t/mymodule.cppm -o %t/mymodule.pcm -I%t
+// RUN: %check_clang_tidy -std=c++20 %t/main.cpp performance-trivially-destructible %t/out \
+// RUN:     -- -- -I%t -fmodule-file=mymodule=%t/mymodule.pcm
+
+//--- header.h
+#pragma once
+
+struct A {
+    ~A() = default;
+};
+
+struct X {
+    A a;
+};
+
+//--- mymodule.cppm
+module;
+#include "header.h"
+export module mymodule;
+
+//--- main.cpp
+#include "header.h"
+import mymodule;
+int main() { X x; }
----------------
vbvictor wrote:

Can we add a positive test here to make sure check still works in cpp modules

https://github.com/llvm/llvm-project/pull/178471


More information about the cfe-commits mailing list