diff options
author | dim <dim@FreeBSD.org> | 2013-06-10 20:36:52 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-06-10 20:36:52 +0000 |
commit | aa45f148926e3461a1fd8b10c990f0a51a908cc9 (patch) | |
tree | 909310b2e05119d1d6efda049977042abbb58bb1 /unittests/DebugInfo | |
parent | 169d2bd06003c39970bc94c99669a34b61bb7e45 (diff) | |
download | FreeBSD-src-aa45f148926e3461a1fd8b10c990f0a51a908cc9.zip FreeBSD-src-aa45f148926e3461a1fd8b10c990f0a51a908cc9.tar.gz |
Vendor import of llvm tags/RELEASE_33/final r183502 (effectively, 3.3
release):
http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_33/final@183502
Diffstat (limited to 'unittests/DebugInfo')
-rw-r--r-- | unittests/DebugInfo/CMakeLists.txt | 13 | ||||
-rw-r--r-- | unittests/DebugInfo/DWARFFormValueTest.cpp | 31 | ||||
-rw-r--r-- | unittests/DebugInfo/Makefile | 16 |
3 files changed, 60 insertions, 0 deletions
diff --git a/unittests/DebugInfo/CMakeLists.txt b/unittests/DebugInfo/CMakeLists.txt new file mode 100644 index 0000000..ec580b7 --- /dev/null +++ b/unittests/DebugInfo/CMakeLists.txt @@ -0,0 +1,13 @@ +set(LLVM_LINK_COMPONENTS + debuginfo + object + support + ) + +set(DebugInfoSources + DWARFFormValueTest.cpp + ) + +add_llvm_unittest(DebugInfoTests + ${DebugInfoSources} + ) diff --git a/unittests/DebugInfo/DWARFFormValueTest.cpp b/unittests/DebugInfo/DWARFFormValueTest.cpp new file mode 100644 index 0000000..04b859b --- /dev/null +++ b/unittests/DebugInfo/DWARFFormValueTest.cpp @@ -0,0 +1,31 @@ +//===- llvm/unittest/DebugInfo/DWARFFormValueTest.cpp ---------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/DebugInfo/DWARFFormValue.h" +#include "llvm/Support/Dwarf.h" +#include "gtest/gtest.h" +using namespace llvm; +using namespace dwarf; + +namespace { + +TEST(DWARFFormValue, FixedFormSizes) { + // Size of DW_FORM_addr and DW_FORM_ref_addr are equal in DWARF2, + // DW_FORM_ref_addr is always 4 bytes in DWARF32 starting from DWARF3. + const uint8_t *sizes = DWARFFormValue::getFixedFormSizes(4, 2); + EXPECT_EQ(sizes[DW_FORM_addr], sizes[DW_FORM_ref_addr]); + sizes = DWARFFormValue::getFixedFormSizes(8, 2); + EXPECT_EQ(sizes[DW_FORM_addr], sizes[DW_FORM_ref_addr]); + sizes = DWARFFormValue::getFixedFormSizes(8, 3); + EXPECT_EQ(4, sizes[DW_FORM_ref_addr]); + // Check that we don't have fixed form sizes for weird address sizes. + EXPECT_EQ(0, DWARFFormValue::getFixedFormSizes(16, 2)); +} + +} // end anonymous namespace diff --git a/unittests/DebugInfo/Makefile b/unittests/DebugInfo/Makefile new file mode 100644 index 0000000..999ded9 --- /dev/null +++ b/unittests/DebugInfo/Makefile @@ -0,0 +1,16 @@ +##===- unittests/DebugInfo/Makefile ------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LEVEL = ../.. +TESTNAME = DebugInfo +LINK_COMPONENTS := debuginfo object support + +include $(LEVEL)/Makefile.config + +include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest |