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 | a2347baaec37ba81d64f9b455af3084cf183f127 (patch) | |
tree | 38de0cdf097468df1afb29d2abb642bf7bdab1f1 /clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp | |
parent | b0407ba0716d940d035f5da73f6d3bfbaffecb44 (diff) | |
download | bcm5719-llvm-a2347baaec37ba81d64f9b455af3084cf183f127.tar.gz bcm5719-llvm-a2347baaec37ba81d64f9b455af3084cf183f127.zip |
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.
llvm-svn: 213386
Diffstat (limited to 'clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp b/clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp index a3127c79372..5f74c54c1c4 100644 --- a/clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp +++ b/clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp @@ -119,7 +119,7 @@ inline S &UnreachableStatic() { return s; } -// CHECK-LABEL: define linkonce_odr nonnull %struct.S* @"\01?UnreachableStatic@@YAAAUS@@XZ"() +// CHECK-LABEL: define linkonce_odr dereferenceable({{[0-9]+}}) %struct.S* @"\01?UnreachableStatic@@YAAAUS@@XZ"() // CHECK: and i32 {{.*}}, 2 // CHECK: or i32 {{.*}}, 2 // CHECK: ret @@ -129,7 +129,7 @@ inline S &getS() { return TheS; } -// CHECK-LABEL: define linkonce_odr nonnull %struct.S* @"\01?getS@@YAAAUS@@XZ" +// CHECK-LABEL: define linkonce_odr dereferenceable({{[0-9]+}}) %struct.S* @"\01?getS@@YAAAUS@@XZ" // CHECK: load i32* @"\01??_B?1??getS@@YAAAUS@@XZ@51" // CHECK: and i32 {{.*}}, 1 // CHECK: icmp ne i32 {{.*}}, 0 |