diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2012-06-18 16:27:56 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2012-06-18 16:27:56 +0000 |
commit | 96c67d1c2aff532729c9edb297617094d1e77cc1 (patch) | |
tree | bd02aba33226058fdfd0452aebece24c07504801 /lib | |
parent | 93f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6 (diff) |
alloc_size attribute: there's nothing wrong with alloc_size(1,1). It just means the function allocates x^2 bytes. GCC also accepts this syntax
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158662 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index b8df752b38..561b624167 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -972,15 +972,6 @@ static void handleAllocSizeAttr(Sema &S, Decl *D, const AttributeList &Attr) { return; } - // check if the argument is a duplicate - SmallVectorImpl<unsigned>::iterator Pos; - Pos = std::find(SizeArgs.begin(), SizeArgs.end(), x); - if (Pos != SizeArgs.end()) { - S.Diag(Attr.getLoc(), diag::err_attribute_argument_duplicate) - << "alloc_size" << I.getArgNum() << Ex->getSourceRange(); - return; - } - SizeArgs.push_back(x); } @@ -990,11 +981,8 @@ static void handleAllocSizeAttr(Sema &S, Decl *D, const AttributeList &Attr) { << "alloc_size" << 0 /*function*/<< 1 /*pointer*/ << D->getSourceRange(); } - unsigned size = SizeArgs.size(); - unsigned* start = &SizeArgs[0]; - llvm::array_pod_sort(start, start + size); - D->addAttr(::new (S.Context) AllocSizeAttr(Attr.getRange(), S.Context, start, - size)); + D->addAttr(::new (S.Context) AllocSizeAttr(Attr.getRange(), S.Context, + SizeArgs.data(), SizeArgs.size())); } static void handleNonNullAttr(Sema &S, Decl *D, const AttributeList &Attr) { |