summaryrefslogtreecommitdiffstats
path: root/lldb/unittests/Core/ScalarTest.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2016-02-09 17:28:01 +0000
committerPavel Labath <labath@google.com>2016-02-09 17:28:01 +0000
commitb625a0e1bcb62ef6cd9187ce5d64729182548b39 (patch)
tree279d330e94d4dbbfd534119db3b802a4aed202d5 /lldb/unittests/Core/ScalarTest.cpp
parent470ee61e01c59ba2991238785dda37d56479ad8a (diff)
downloadbcm5719-llvm-b625a0e1bcb62ef6cd9187ce5d64729182548b39.tar.gz
bcm5719-llvm-b625a0e1bcb62ef6cd9187ce5d64729182548b39.zip
Fix invalid shift operator overload in Scalar
Summary: This also fixes an infinite recursion between lldb_private::operator>> () and Scalar::operator>>= (). Reviewers: sagar, tberghammer, labath Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D16868 Patch by Marianne Mailhot-Sarrasin llvm-svn: 260239
Diffstat (limited to 'lldb/unittests/Core/ScalarTest.cpp')
-rw-r--r--lldb/unittests/Core/ScalarTest.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/lldb/unittests/Core/ScalarTest.cpp b/lldb/unittests/Core/ScalarTest.cpp
new file mode 100644
index 00000000000..63c0daa424e
--- /dev/null
+++ b/lldb/unittests/Core/ScalarTest.cpp
@@ -0,0 +1,32 @@
+//===-- ScalarTest.cpp ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#if defined(_MSC_VER) && (_HAS_EXCEPTIONS == 0)
+// Workaround for MSVC standard library bug, which fails to include <thread> when
+// exceptions are disabled.
+#include <eh.h>
+#endif
+
+#include "gtest/gtest.h"
+
+#include "lldb/Core/Scalar.h"
+
+using namespace lldb_private;
+
+TEST(ScalarTest, RightShiftOperator)
+{
+ int a = 0x00001000;
+ int b = 0xFFFFFFFF;
+ int c = 4;
+ Scalar a_scalar(a);
+ Scalar b_scalar(b);
+ Scalar c_scalar(c);
+ ASSERT_EQ(a >> c, a_scalar >> c_scalar);
+ ASSERT_EQ(b >> c, b_scalar >> c_scalar);
+}
OpenPOWER on IntegriCloud