diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2014-05-28 09:56:42 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2014-05-28 09:56:42 +0000 |
commit | 9b46eb81127be4a7560952677294d3c376648c08 (patch) | |
tree | 99e4aa165636c60d4f0e903a00b1f41e7976a6ae /clang/lib/CodeGen/CGCall.cpp | |
parent | a09b70579a8cbddbd677250916e82cf43932bd99 (diff) | |
download | bcm5719-llvm-9b46eb81127be4a7560952677294d3c376648c08.tar.gz bcm5719-llvm-9b46eb81127be4a7560952677294d3c376648c08.zip |
Add 'nonnull' parameter or return attribute when producing an llvm pointer type in a function type where the C++ type is a reference. Update the tests.
llvm-svn: 209723
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index d0849d3263a..5ccb8bdf2c0 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -1200,6 +1200,9 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, llvm_unreachable("Invalid ABI kind for return argument"); } + if (RetTy->isReferenceType()) + RetAttrs.addAttribute(llvm::Attribute::NonNull); + if (RetAttrs.hasAttributes()) PAL.push_back(llvm:: AttributeSet::get(getLLVMContext(), @@ -1288,6 +1291,9 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, } } + if (ParamType->isReferenceType()) + Attrs.addAttribute(llvm::Attribute::NonNull); + if (Attrs.hasAttributes()) PAL.push_back(llvm::AttributeSet::get(getLLVMContext(), Index, Attrs)); ++Index; |