diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2012-05-25 21:45:08 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2012-05-25 21:45:08 +0000 |
commit | 976f266b969e03ef08b37b5f4aaf013f48f1ba6e (patch) | |
tree | c22c49b6d6ef2c9746fd2265679de44a6a3de0b2 /lib/CodeGen/CGCall.cpp | |
parent | 6e5fa8c74ac4ed70475fcc0e48b897e2dbe9c8d4 (diff) |
fix codegen support for alloc_size attribute for static C++ methods
add test case for C++ codegen
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157500 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCall.cpp')
-rw-r--r-- | lib/CodeGen/CGCall.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index 650fe8b623..cd01fa251c 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -2090,9 +2090,11 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, // add metadata for __attribute__((alloc_size(foo))) if (TargetDecl) { if (const AllocSizeAttr* Attr = TargetDecl->getAttr<AllocSizeAttr>()) { - std::vector<llvm::Value*> Args; + SmallVector<llvm::Value*, 4> Args; llvm::IntegerType *Ty = llvm::IntegerType::getInt32Ty(getLLVMContext()); - bool isMethod = isa<CXXMethodDecl>(TargetDecl); + bool isMethod = false; + if (const CXXMethodDecl *MDecl = dyn_cast<CXXMethodDecl>(TargetDecl)) + isMethod = MDecl->isInstance(); for (AllocSizeAttr::args_iterator I = Attr->args_begin(), E = Attr->args_end(); I != E; ++I) { |