[Lldb-commits] [PATCH] D16868: [lldb] Fix invalid shift operator overload in Scalar
Marianne Mailhot-Sarrasin via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 8 10:20:07 PST 2016
mamai updated this revision to Diff 47218.
mamai added a comment.
Added a small unit test for scalar right shift operator, which invokes the >>= operator.
Repository:
rL LLVM
http://reviews.llvm.org/D16868
Files:
source/Core/Scalar.cpp
unittests/CMakeLists.txt
unittests/Core/CMakeLists.txt
unittests/Core/ScalarTest.cpp
Index: unittests/Core/ScalarTest.cpp
===================================================================
--- /dev/null
+++ 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);
+}
Index: unittests/Core/CMakeLists.txt
===================================================================
--- /dev/null
+++ unittests/Core/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_lldb_unittest(CoreTests
+ ScalarTest.cpp
+ )
Index: unittests/CMakeLists.txt
===================================================================
--- unittests/CMakeLists.txt
+++ unittests/CMakeLists.txt
@@ -23,6 +23,7 @@
llvm_config(${test_name} ${LLVM_LINK_COMPONENTS})
endfunction()
+add_subdirectory(Core)
add_subdirectory(Editline)
add_subdirectory(Expression)
add_subdirectory(Host)
Index: source/Core/Scalar.cpp
===================================================================
--- source/Core/Scalar.cpp
+++ source/Core/Scalar.cpp
@@ -1875,7 +1875,7 @@
case e_sint128:
case e_uint128:
{
- m_integer >> *rhs.m_integer.getRawData();
+ m_integer = m_integer.ashr(*(const uint_t *)rhs.m_integer.getRawData());
break;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16868.47218.patch
Type: text/x-patch
Size: 2106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160208/369d6865/attachment-0001.bin>
More information about the lldb-commits
mailing list