[PATCH] D55222: [AST] Assert that no statement/expression class is polymorphic
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 4 08:07:23 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rC348278: [AST] Assert that no statement/expression class is polymorphic (authored by brunoricci, committed by ).
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55222/new/
https://reviews.llvm.org/D55222
Files:
lib/AST/Stmt.cpp
Index: lib/AST/Stmt.cpp
===================================================================
--- lib/AST/Stmt.cpp
+++ lib/AST/Stmt.cpp
@@ -76,6 +76,14 @@
return getStmtInfoTableEntry((StmtClass) StmtBits.sClass).Name;
}
+// Check that no statement / expression class is polymorphic. LLVM style RTTI
+// should be used instead. If absolutely needed an exception can still be added
+// here by defining the appropriate macro (but please don't do this).
+#define STMT(CLASS, PARENT) \
+ static_assert(!std::is_polymorphic<CLASS>::value, \
+ #CLASS " should not be polymorphic!");
+#include "clang/AST/StmtNodes.inc"
+
void Stmt::PrintStats() {
// Ensure the table is primed.
getStmtInfoTableEntry(Stmt::NullStmtClass);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55222.176643.patch
Type: text/x-patch
Size: 744 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181204/66eba157/attachment-0001.bin>
More information about the cfe-commits
mailing list