1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

[BPF] Some fixes after rL344366

* Move #include outside of namespaces
* Add missing #include
* Add out-of-line virtual destructor to BTFTypeEntry

designated initializers should also be fixed

llvm-svn: 344376
This commit is contained in:
Fangrui Song 2018-10-12 17:23:25 +00:00
parent 7c9ead5433
commit 2499fb5652
4 changed files with 21 additions and 16 deletions

View File

@ -13,22 +13,26 @@
#ifndef LLVM_MC_MCBTFCONTEXT_H
#define LLVM_MC_MCBTFCONTEXT_H
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/raw_ostream.h"
#include <linux/types.h>
#include <map>
#include <vector>
#define BTF_MAGIC 0xeB9F
#define BTF_VERSION 1
#define BTF_MAGIC 0xeB9F
#define BTF_VERSION 1
struct btf_header {
__u16 magic;
__u8 version;
__u8 flags;
__u32 hdr_len;
__u16 magic;
__u8 version;
__u8 flags;
__u32 hdr_len;
/* All offsets are in bytes relative to the end of this header */
__u32 type_off; /* offset of type section */
__u32 type_len; /* length of type section */
__u32 str_off; /* offset of string section */
__u32 str_len; /* length of string section */
/* All offsets are in bytes relative to the end of this header */
__u32 type_off; /* offset of type section */
__u32 type_len; /* length of type section */
__u32 str_off; /* offset of string section */
__u32 str_len; /* length of string section */
};
/* Max # of type identifier */
@ -178,9 +182,6 @@ const char *const btf_kind_str[NR_BTF_KINDS] = {
[BTF_KIND_FUNC_PROTO] = "FUNC_PROTO",
};
#include "llvm/ADT/SmallVector.h"
#include <map>
class MCBTFContext;
class MCObjectStreamer;
@ -196,6 +197,7 @@ protected:
public:
BTFTypeEntry(size_t id, struct btf_type &type) :
Id(id), BTFType(type) {}
virtual ~BTFTypeEntry();
unsigned char getKind() { return BTF_INFO_KIND(BTFType.info); }
void setId(size_t Id) { this->Id = Id; }
size_t getId() { return Id; }

View File

@ -15,6 +15,8 @@
namespace llvm {
Die2BTFEntry::~Die2BTFEntry() {}
unsigned char Die2BTFEntry::getDieKind(const DIE & Die) {
auto Tag = Die.getTag();

View File

@ -30,6 +30,7 @@ protected:
struct btf_type BTFType;
public:
virtual ~Die2BTFEntry();
// Return desired BTF_KIND for the Die, return BTF_KIND_UNKN for
// invalid/unsupported Die
static unsigned char getDieKind(const DIE &Die);

View File

@ -11,8 +11,6 @@
#include "llvm/MC/MCBTFContext.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCObjectStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/raw_ostream.h"
#include <cstdlib>
#include <tuple>
#include <utility>
@ -21,6 +19,8 @@ using namespace llvm;
#define DEBUG_TYPE "btf"
BTFTypeEntry::~BTFTypeEntry() {}
void MCBTFContext::addTypeEntry(std::unique_ptr<BTFTypeEntry> Entry) {
TypeEntries.push_back(std::move(Entry));
}