[PATCH] D55225: [AST] Assert that no type class is polymorphic

Bruno Ricci via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 3 10:40:44 PST 2018


riccibruno marked 2 inline comments as done.
riccibruno added inline comments.


================
Comment at: lib/AST/Type.cpp:299
+  static_assert(!std::is_polymorphic<CLASS##Type>::value, \
+                #CLASS "Type should not be polymorphic!");
+#include "clang/AST/TypeNodes.def"
----------------
aaron.ballman wrote:
> This will squish your class name and error text together. I think you need a whitespace before "Type" and make that lowercase.
This is on purpose, since what is substituted into
`CLASS` is the name of the type class, without the "Type",
eg: for `FunctionProtoType`, `CLASS` will be `FunctionProto`
and we want to stick the `Type` to it so that the error message will
be "FunctionProtoType should not ....".


================
Comment at: lib/AST/Type.cpp:301
+#include "clang/AST/TypeNodes.def"
+
 QualType Type::getLocallyUnqualifiedSingleStepDesugaredType() const {
----------------
aaron.ballman wrote:
> I'd feel more comfortable if there was a `#undef TYPE` here.
I can certainly add one but it is already done in `TypeNodes.def`.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55225/new/

https://reviews.llvm.org/D55225





More information about the cfe-commits mailing list