[cfe-commits] r54373 - /cfe/trunk/include/clang/AST/Attr.h
Ted Kremenek
kremenek at apple.com
Tue Aug 5 14:29:52 PDT 2008
Author: kremenek
Date: Tue Aug 5 16:29:52 2008
New Revision: 54373
URL: http://llvm.org/viewvc/llvm-project?rev=54373&view=rev
Log:
Add missing "classof" methods to NonNullAttr, fixing a heisencrash.
Modified:
cfe/trunk/include/clang/AST/Attr.h
Modified: cfe/trunk/include/clang/AST/Attr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Attr.h?rev=54373&r1=54372&r2=54373&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Attr.h (original)
+++ cfe/trunk/include/clang/AST/Attr.h Tue Aug 5 16:29:52 2008
@@ -231,17 +231,15 @@
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 @@
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 {
More information about the cfe-commits
mailing list