diff options
author | Yaron Keren <yaron.keren@gmail.com> | 2014-03-24 19:48:13 +0000 |
---|---|---|
committer | Yaron Keren <yaron.keren@gmail.com> | 2014-03-24 19:48:13 +0000 |
commit | 7b085a4799351b027b17893612aaac0699734795 (patch) | |
tree | 5223c518f8a43e8cee81a7990fd13af437f6f525 /llvm/lib/IR/User.cpp | |
parent | a7f1e0c44f627cd0a48ec0c30351532f3cec3ac9 (diff) | |
download | bcm5719-llvm-7b085a4799351b027b17893612aaac0699734795.tar.gz bcm5719-llvm-7b085a4799351b027b17893612aaac0699734795.zip |
In Release modes, Visual Studio complains that the Operator destructor in User.cpp
never returns, which is true by design.
Initially assumed that the reason is llvm_unreachable being dependent on NDEBUG.
However, even if llvm_unreachable is replaced by __assume(false), VC still warns in
Release modes but not in Debug modes...
The real reason turned out to be optimization flags.
With /Od in Debug modes the warning is not issued whereas with /O1 it is.
I could not find any documentation to this effect, but it is reproducable:
Try compiling http://msdn.microsoft.com/en-us/library/khwfyc5d(v=vs.90).aspx
with /O1 and then with /Od.
llvm-svn: 204659
Diffstat (limited to 'llvm/lib/IR/User.cpp')
-rw-r--r-- | llvm/lib/IR/User.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/IR/User.cpp b/llvm/lib/IR/User.cpp index 940682826ac..cd124df1e93 100644 --- a/llvm/lib/IR/User.cpp +++ b/llvm/lib/IR/User.cpp @@ -83,8 +83,28 @@ void User::operator delete(void *Usr) { // Operator Class //===----------------------------------------------------------------------===// +#if defined(_MSC_VER)
+// In Release modes, Visual Studio complains that the Operator destructor
+// never returns, which is true by design.
+// This does *not* depend on llvm_unreachable being dependent on NDEBUG:
+// even if llvm_unreachable is replaced by __assume(false), VC still warns in
+// Release modes but not in Debug modes. The real reason is optimization flags.
+// With /Od in Debug modes the warning is not issued whereas with /O1 it is.
+// I could not find any documentation to this effect, it is reproducable:
+// Try compiling http://msdn.microsoft.com/en-us/library/khwfyc5d(v=vs.90).aspx
+// with /O1 and then with /Od.
+// Anyhow, solution is same as lib/Support/Process.cpp:~self_process().
+
+#pragma warning(push)
+#pragma warning(disable:4722)
+#endif
+
Operator::~Operator() { llvm_unreachable("should never destroy an Operator"); } +#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+ } // End llvm namespace |