[clang] [NFCI][clang][analyzer] Make ProgramStatePartialTrait a template definition (PR #98150)
Endre Fülöp via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 9 05:34:04 PDT 2024
https://github.com/gamesh411 created https://github.com/llvm/llvm-project/pull/98150
N4860 13 [class.derived]/2 mandates that base classes must be complete
types. Before this patch, ProgramStatePartialTrait is a forward
declaration of a class template, thus an incomplete type. Explicit
specializations of forward declared templates are also incomplete types,
until the body of the specialization is seen, thus should not appear as
a base class.
This patch makes ProgramStatePartialTrait a definition with an empty
body by default, enabling it to appear in a base-specifier list, and
practically eliminating a compiler warning given by GCC13.
>From 9097b6eee243280ef7e2d6212555b6d31b4d986e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Endre=20F=C3=BCl=C3=B6p?= <endre.fulop at sigmatechnology.com>
Date: Tue, 9 Jul 2024 11:13:53 +0200
Subject: [PATCH] [NFCI][clang][analyzer] Make ProgramStatePartialTrait a
template definition
N4860 13 [class.derived]/2 mandates that base classes must be complete
types. Before this patch, ProgramStatePartialTrait is a forward
declaration of a class template, thus an incomplete type. Explicit
specializations of forward declared templates are also incomplete types,
until the body of the specialization is seen, thus should not appear as
a base class.
This patch makes ProgramStatePartialTrait a definition with an empty
body by default, enabling it to appear in a base-specifier list, and
practically eliminating a compiler warning given by GCC13.
---
.../StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h
index 15bec97c5be8f..1e9e43d085503 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h
@@ -26,7 +26,8 @@
namespace clang {
namespace ento {
-template <typename T, typename Enable = void> struct ProgramStatePartialTrait;
+template <typename T, typename Enable = void>
+struct ProgramStatePartialTrait {};
/// Declares a program state trait for type \p Type called \p Name, and
/// introduce a type named \c NameTy.
More information about the cfe-commits
mailing list