aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/lib/AST/Comment.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-01-22 21:31:48 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-01-22 21:31:48 +0000
commita7dea1671b87c07d2d266f836bfa8b58efc7c134 (patch)
treeff67344b3b18fc14e0cec322849afb4e3b94ea56 /contrib/llvm-project/clang/lib/AST/Comment.cpp
parent5c713029ff7939f90b6f96df914953e758855a7f (diff)
parent519fc96c475680de2cc49e7811dbbfadb912cbcc (diff)
Notes
Diffstat (limited to 'contrib/llvm-project/clang/lib/AST/Comment.cpp')
-rw-r--r--contrib/llvm-project/clang/lib/AST/Comment.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/contrib/llvm-project/clang/lib/AST/Comment.cpp b/contrib/llvm-project/clang/lib/AST/Comment.cpp
index 25339c7901e3..23dc7ba93591 100644
--- a/contrib/llvm-project/clang/lib/AST/Comment.cpp
+++ b/contrib/llvm-project/clang/lib/AST/Comment.cpp
@@ -13,10 +13,25 @@
#include "clang/AST/DeclTemplate.h"
#include "clang/Basic/CharInfo.h"
#include "llvm/Support/ErrorHandling.h"
+#include <type_traits>
namespace clang {
namespace comments {
+// Check that no comment class has a non-trival destructor. They are allocated
+// with a BumpPtrAllocator and therefore their destructor is not executed.
+#define ABSTRACT_COMMENT(COMMENT)
+#define COMMENT(CLASS, PARENT) \
+ static_assert(std::is_trivially_destructible<CLASS>::value, \
+ #CLASS " should be trivially destructible!");
+#include "clang/AST/CommentNodes.inc"
+#undef COMMENT
+#undef ABSTRACT_COMMENT
+
+// DeclInfo is also allocated with a BumpPtrAllocator.
+static_assert(std::is_trivially_destructible<DeclInfo>::value,
+ "DeclInfo should be trivially destructible!");
+
const char *Comment::getCommentKindName() const {
switch (getCommentKind()) {
case NoCommentKind: return "NoCommentKind";