[llvm] r344376 - [BPF] Some fixes after rL344366

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 12 10:23:25 PDT 2018


Author: maskray
Date: Fri Oct 12 10:23:25 2018
New Revision: 344376

URL: http://llvm.org/viewvc/llvm-project?rev=344376&view=rev
Log:
[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

Modified:
    llvm/trunk/include/llvm/MC/MCBTFContext.h
    llvm/trunk/lib/CodeGen/AsmPrinter/Dwarf2BTF.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/Dwarf2BTF.h
    llvm/trunk/lib/MC/MCBTFContext.cpp

Modified: llvm/trunk/include/llvm/MC/MCBTFContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCBTFContext.h?rev=344376&r1=344375&r2=344376&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCBTFContext.h (original)
+++ llvm/trunk/include/llvm/MC/MCBTFContext.h Fri Oct 12 10:23:25 2018
@@ -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;
-
-	/* 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	*/
+  __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	*/
 };
 
 /* Max # of type identifier */
@@ -178,9 +182,6 @@ const char *const btf_kind_str[NR_BTF_KI
 	[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; }

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/Dwarf2BTF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/Dwarf2BTF.cpp?rev=344376&r1=344375&r2=344376&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/Dwarf2BTF.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/Dwarf2BTF.cpp Fri Oct 12 10:23:25 2018
@@ -15,6 +15,8 @@
 
 namespace llvm {
 
+Die2BTFEntry::~Die2BTFEntry() {}
+
 unsigned char Die2BTFEntry::getDieKind(const DIE & Die) {
   auto Tag = Die.getTag();
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/Dwarf2BTF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/Dwarf2BTF.h?rev=344376&r1=344375&r2=344376&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/Dwarf2BTF.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/Dwarf2BTF.h Fri Oct 12 10:23:25 2018
@@ -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);

Modified: llvm/trunk/lib/MC/MCBTFContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCBTFContext.cpp?rev=344376&r1=344375&r2=344376&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCBTFContext.cpp (original)
+++ llvm/trunk/lib/MC/MCBTFContext.cpp Fri Oct 12 10:23:25 2018
@@ -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));
 }




More information about the llvm-commits mailing list