diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-08-05 21:29:52 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-08-05 21:29:52 +0000 |
commit | 55b0c192e1ce00513a000f4c98bed7da5cf152b8 (patch) | |
tree | 3190943808274fcd4bf4c44285b06bca091aa4af | |
parent | 14f8b4ff660bcaa763974b8d0fae81857c594495 (diff) |
Add missing "classof" methods to NonNullAttr, fixing a heisencrash.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54373 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/Attr.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/include/clang/AST/Attr.h b/include/clang/AST/Attr.h index 71f981bd50..54f1714715 100644 --- a/include/clang/AST/Attr.h +++ b/include/clang/AST/Attr.h @@ -231,17 +231,15 @@ class NonNullAttr : public Attr { unsigned* ArgNums; unsigned Size; public: - NonNullAttr(unsigned* arg_nums = 0, unsigned size = 0) : Attr(NonNull) { + NonNullAttr(unsigned* arg_nums = 0, unsigned size = 0) : Attr(NonNull), + ArgNums(0), Size(0) { + if (size) { assert (arg_nums); ArgNums = new unsigned[size]; Size = size; memcpy(ArgNums, arg_nums, sizeof(*ArgNums)*size); } - else { - ArgNums = 0; - Size = 0; - } } virtual ~NonNullAttr() { @@ -251,6 +249,9 @@ public: bool isNonNull(unsigned arg) const { return ArgNums ? std::binary_search(ArgNums, ArgNums+Size, arg) : true; } + + static bool classof(const Attr *A) { return A->getKind() == NonNull; } + static bool classof(const NonNullAttr *A) { return true; } }; class FormatAttr : public Attr { |