[clang] [NFCI][clang][analyzer] Make ProgramStatePartialTrait a template definition (PR #98150)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 9 05:34:35 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Endre Fülöp (gamesh411)

<details>
<summary>Changes</summary>

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.


---
Full diff: https://github.com/llvm/llvm-project/pull/98150.diff


1 Files Affected:

- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h (+2-1) 


``````````diff
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.

``````````

</details>


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


More information about the cfe-commits mailing list