summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-08-05 21:29:52 +0000
committerTed Kremenek <kremenek@apple.com>2008-08-05 21:29:52 +0000
commit182ab758a383e55f7e2ecd8337e34bcde8d3edd8 (patch)
treeaa95b3d75978f54dbedd737af38de58a77ce4f81 /clang
parentee12a7aefffa3e79b65692367673da0b62339cfe (diff)
downloadbcm5719-llvm-182ab758a383e55f7e2ecd8337e34bcde8d3edd8.tar.gz
bcm5719-llvm-182ab758a383e55f7e2ecd8337e34bcde8d3edd8.zip
Add missing "classof" methods to NonNullAttr, fixing a heisencrash.
llvm-svn: 54373
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/AST/Attr.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/include/clang/AST/Attr.h b/clang/include/clang/AST/Attr.h
index 71f981bd50c..54f1714715c 100644
--- a/clang/include/clang/AST/Attr.h
+++ b/clang/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 {
OpenPOWER on IntegriCloud