[LoongArch][Clang] Make the parameters and return value of {x,}vorn.v builti ns ...
[llvm-project.git] / lldb / source / Plugins / SymbolFile / DWARF / DWARFDefines.cpp
blob2fb0c224bf8e8498e0a5614b077b28fffbd9b9c1
1 //===-- DWARFDefines.cpp --------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "DWARFDefines.h"
10 #include "lldb/Utility/ConstString.h"
11 #include <cstdio>
12 #include <cstring>
13 #include <string>
15 namespace lldb_private::plugin {
16 namespace dwarf {
18 llvm::StringRef DW_TAG_value_to_name(dw_tag_t tag) {
19 static constexpr llvm::StringLiteral s_unknown_tag_name("<unknown DW_TAG>");
20 if (llvm::StringRef tag_name = llvm::dwarf::TagString(tag); !tag_name.empty())
21 return tag_name;
23 return s_unknown_tag_name;
26 const char *DW_OP_value_to_name(uint32_t val) {
27 static char invalid[100];
28 llvm::StringRef llvmstr = llvm::dwarf::OperationEncodingString(val);
29 if (llvmstr.empty()) {
30 snprintf(invalid, sizeof(invalid), "Unknown DW_OP constant: 0x%x", val);
31 return invalid;
33 return llvmstr.data();
36 } // namespace dwarf
37 } // namespace lldb_private::plugin