diff options
author | Hal Finkel <hfinkel@anl.gov> | 2014-07-18 15:52:10 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2014-07-18 15:52:10 +0000 |
commit | 4cdf252c1243bc19662ca522657a583b060df913 (patch) | |
tree | 0e28d43e32d8a30012a4ca53cb503e3b40128365 /test/CodeGenCXX/derived-to-base-conv.cpp | |
parent | d100f97758f2a65e6ffdaaa7154753f5f15d09e6 (diff) | |
download | clang-4cdf252c1243bc19662ca522657a583b060df913.tar.gz |
Mark C++ reference parameters as dereferenceable
Because references must be initialized using some evaluated expression, they
must point to something, and a callee can assume the reference parameter is
dereferenceable. Taking advantage of a new attribute just added to LLVM, mark
them as such.
Because dereferenceability in addrspace(0) implies nonnull in the backend, we
don't need both attributes. However, we need to know the size of the object to
use the dereferenceable attribute, so for incomplete types we still emit only
nonnull.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213386 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/derived-to-base-conv.cpp')
-rw-r--r-- | test/CodeGenCXX/derived-to-base-conv.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/CodeGenCXX/derived-to-base-conv.cpp b/test/CodeGenCXX/derived-to-base-conv.cpp index 7589cf6128..f4ef0e5277 100644 --- a/test/CodeGenCXX/derived-to-base-conv.cpp +++ b/test/CodeGenCXX/derived-to-base-conv.cpp @@ -33,9 +33,9 @@ void test0(X x) { test0_helper(x); // CHECK-LABEL: define void @_Z5test01X( // CHECK: [[TMP:%.*]] = alloca [[A:%.*]], align - // CHECK-NEXT: [[T0:%.*]] = call nonnull [[B:%.*]]* @_ZN1XcvR1BEv( + // CHECK-NEXT: [[T0:%.*]] = call dereferenceable({{[0-9]+}}) [[B:%.*]]* @_ZN1XcvR1BEv( // CHECK-NEXT: [[T1:%.*]] = bitcast [[B]]* [[T0]] to [[A]]* - // CHECK-NEXT: call void @_ZN1AC1ERKS_([[A]]* [[TMP]], [[A]]* nonnull [[T1]]) + // CHECK-NEXT: call void @_ZN1AC1ERKS_([[A]]* [[TMP]], [[A]]* dereferenceable({{[0-9]+}}) [[T1]]) // CHECK-NEXT: call void @_Z12test0_helper1A([[A]]* [[TMP]]) // CHECK-NEXT: call void @_ZN1AD1Ev([[A]]* [[TMP]]) // CHECK-NEXT: ret void |