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/dllexport.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/dllexport.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/dllexport.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/test/CodeGenCXX/dllexport.cpp b/clang/test/CodeGenCXX/dllexport.cpp index d7ac3ae4f22..5097abf0c09 100644 --- a/clang/test/CodeGenCXX/dllexport.cpp +++ b/clang/test/CodeGenCXX/dllexport.cpp @@ -489,7 +489,7 @@ struct S { struct __declspec(dllexport) T { // Copy assignment operator: - // M32-DAG: define weak_odr dllexport x86_thiscallcc nonnull %struct.T* @"\01??4T@@QAEAAU0@ABU0@@Z" + // M32-DAG: define weak_odr dllexport x86_thiscallcc dereferenceable({{[0-9]+}}) %struct.T* @"\01??4T@@QAEAAU0@ABU0@@Z" // Explicitly defaulted copy constructur: T(const T&) = default; @@ -511,7 +511,7 @@ int T::c; template <typename T> struct __declspec(dllexport) U { void foo() {} }; // The U<int> specialization below must cause the following to be emitted: // M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?foo@?$U@H@@QAEXXZ" -// M32-DAG: define weak_odr dllexport x86_thiscallcc nonnull %struct.U* @"\01??4?$U@H@@QAEAAU0@ABU0@@Z" +// M32-DAG: define weak_odr dllexport x86_thiscallcc dereferenceable({{[0-9]+}}) %struct.U* @"\01??4?$U@H@@QAEAAU0@ABU0@@Z" struct __declspec(dllexport) V : public U<int> { }; @@ -531,7 +531,7 @@ struct __declspec(dllexport) X : public virtual W {}; struct __declspec(dllexport) Y { // Move assignment operator: - // M32-DAG: define weak_odr dllexport x86_thiscallcc nonnull %struct.Y* @"\01??4Y@@QAEAAU0@$$QAU0@@Z" + // M32-DAG: define weak_odr dllexport x86_thiscallcc dereferenceable({{[0-9]+}}) %struct.Y* @"\01??4Y@@QAEAAU0@$$QAU0@@Z" int x; }; |