summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-11-19 09:55:17 +0100
committerPavel Labath <pavel@labath.sk>2019-11-19 10:34:30 +0100
commit39285a0f02c7bc5e4bad8a684a900123b097511d (patch)
tree6b14401600399599c216ead35018b2bd1c20d1dc /llvm/lib/DebugInfo
parentc0fc29c4684a997d282bfed71eb4d903ad16ee25 (diff)
downloadbcm5719-llvm-39285a0f02c7bc5e4bad8a684a900123b097511d.tar.gz
bcm5719-llvm-39285a0f02c7bc5e4bad8a684a900123b097511d.zip
Add streaming/equality operators to DWARFAddressRange/DWARFLocationExpression
The main motivation for this is being able to write simpler assertions and get better error messages in unit tests. Split off from D70394.
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/DWARF/CMakeLists.txt1
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp19
2 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/CMakeLists.txt b/llvm/lib/DebugInfo/DWARF/CMakeLists.txt
index b4770e561f7..fcfb00e8e5f 100644
--- a/llvm/lib/DebugInfo/DWARF/CMakeLists.txt
+++ b/llvm/lib/DebugInfo/DWARF/CMakeLists.txt
@@ -22,6 +22,7 @@ add_llvm_library(LLVMDebugInfoDWARF
DWARFFormValue.cpp
DWARFGdbIndex.cpp
DWARFListTable.cpp
+ DWARFLocationExpression.cpp
DWARFTypeUnit.cpp
DWARFUnitIndex.cpp
DWARFUnit.cpp
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp b/llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp
new file mode 100644
index 00000000000..1cf73a66677
--- /dev/null
+++ b/llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp
@@ -0,0 +1,19 @@
+//===- DWARFLocationExpression.cpp ----------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/DWARF/DWARFLocationExpression.h"
+#include "llvm/ADT/iterator_range.h"
+#include "llvm/Support/FormatVariadic.h"
+
+using namespace llvm;
+
+raw_ostream &llvm::operator<<(raw_ostream &OS,
+ const DWARFLocationExpression &Loc) {
+ return OS << Loc.Range << ": "
+ << formatv("{0}", make_range(Loc.Expr.begin(), Loc.Expr.end()));
+}
OpenPOWER on IntegriCloud