1
//===- llvm/CodeGen/DwarfStringPoolEntry.h - String pool entry --*- C++ -*-===//
3
// The LLVM Compiler Infrastructure
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
8
//===----------------------------------------------------------------------===//
10
#ifndef LLVM_CODEGEN_DWARFSTRINGPOOLENTRY_H
11
#define LLVM_CODEGEN_DWARFSTRINGPOOLENTRY_H
13
#include "llvm/ADT/StringMap.h"
19
/// Data for a string pool entry.
20
struct DwarfStringPoolEntry {
26
/// String pool entry reference.
27
struct DwarfStringPoolEntryRef {
28
const StringMapEntry<DwarfStringPoolEntry> *I = nullptr;
31
DwarfStringPoolEntryRef() = default;
32
explicit DwarfStringPoolEntryRef(
33
const StringMapEntry<DwarfStringPoolEntry> &I)
36
explicit operator bool() const { return I; }
37
MCSymbol *getSymbol() const {
38
assert(I->second.Symbol && "No symbol available!");
39
return I->second.Symbol;
41
unsigned getOffset() const { return I->second.Offset; }
42
unsigned getIndex() const { return I->second.Index; }
43
StringRef getString() const { return I->first(); }
45
bool operator==(const DwarfStringPoolEntryRef &X) const { return I == X.I; }
46
bool operator!=(const DwarfStringPoolEntryRef &X) const { return I != X.I; }
49
} // end namespace llvm