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 | f491fbd7155ea926c4d1bd0b45d1ec1cd9c0211b (patch) | |
| tree | 65a3e885af78d94d37bf3de823ce8ebfb93a0e30 /clang/lib/CodeGen | |
| parent | e9b0bdf80467029e99e94065463020df1f037202 (diff) | |
| download | bcm5719-llvm-f491fbd7155ea926c4d1bd0b45d1ec1cd9c0211b.tar.gz bcm5719-llvm-f491fbd7155ea926c4d1bd0b45d1ec1cd9c0211b.zip | |
fix codegen support for alloc_size attribute for static C++ methods
add test case for C++ codegen
llvm-svn: 157500
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 650fe8b6233..cd01fa251c0 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/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) { |

