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 | 9e97cc3391b446c8c4daefd0b955d7ae7dc67ed9 (patch) | |
| tree | 7aba362fe9f1f331c63748a175818079d90caa6a /lib/CodeGen/CGCall.cpp | |
| parent | d519dc975cf544718d9a46a63ec57cc7727cada2 (diff) | |
| download | clang-9e97cc3391b446c8c4daefd0b955d7ae7dc67ed9.tar.gz clang-9e97cc3391b446c8c4daefd0b955d7ae7dc67ed9.tar.bz2 clang-9e97cc3391b446c8c4daefd0b955d7ae7dc67ed9.tar.xz | |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209723 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCall.cpp')
| -rw-r--r-- | lib/CodeGen/CGCall.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index d0849d3263..5ccb8bdf2c 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/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; |
