Fixed/added namespace ending comments using clang-tidy. NFC
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DwarfUnit.h
index 1cbf3489b1b6d2cb8e09c9a5c653765bfbf47f25..200ddf0f3cbe49938f9464e7993db54038ce6873 100644 (file)
@@ -71,7 +71,7 @@ protected:
   unsigned UniqueID;
 
   /// MDNode for the compile unit.
-  const MDCompileUnit *CUNode;
+  const DICompileUnit *CUNode;
 
   /// Unit debug information entry.
   DIE UnitDie;
@@ -93,10 +93,6 @@ protected:
   /// information entries.
   DenseMap<const MDNode *, DIE *> MDNodeToDieMap;
 
-  /// Tracks the mapping of unit level debug information descriptors to debug
-  /// information entries using a DIEEntry proxy.
-  DenseMap<const MDNode *, DIEEntry *> MDNodeToDIEEntryMap;
-
   /// A list of all the DIEBlocks in use.
   std::vector<DIEBlock *> DIEBlocks;
 
@@ -106,18 +102,15 @@ protected:
   /// This map is used to keep track of subprogram DIEs that need
   /// DW_AT_containing_type attribute. This attribute points to a DIE that
   /// corresponds to the MDNode mapped with the subprogram DIE.
-  DenseMap<DIE *, const DebugNode *> ContainingTypeMap;
+  DenseMap<DIE *, const DINode *> ContainingTypeMap;
 
   // All DIEValues are allocated through this allocator.
   BumpPtrAllocator DIEValueAllocator;
 
-  // A preallocated DIEValue because 1 is used frequently.
-  DIEInteger *DIEIntegerOne;
-
   /// The section this unit will be emitted in.
-  const MCSection *Section;
+  MCSection *Section;
 
-  DwarfUnit(unsigned UID, dwarf::Tag, const MDCompileUnit *CU, AsmPrinter *A,
+  DwarfUnit(unsigned UID, dwarf::Tag, const DICompileUnit *CU, AsmPrinter *A,
             DwarfDebug *DW, DwarfFile *DWU);
 
   /// \brief Add a string attribute data and value.
@@ -127,14 +120,14 @@ protected:
 
   void addIndexedString(DIE &Die, dwarf::Attribute Attribute, StringRef Str);
 
-  bool applySubprogramDefinitionAttributes(const MDSubprogram *SP, DIE &SPDie);
+  bool applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie);
 
 public:
   virtual ~DwarfUnit();
 
-  void initSection(const MCSection *Section);
+  void initSection(MCSection *Section);
 
-  const MCSection *getSection() const {
+  MCSection *getSection() const {
     assert(Section);
     return Section;
   }
@@ -143,14 +136,14 @@ public:
   AsmPrinter* getAsmPrinter() const { return Asm; }
   unsigned getUniqueID() const { return UniqueID; }
   uint16_t getLanguage() const { return CUNode->getSourceLanguage(); }
-  const MDCompileUnit *getCUNode() const { return CUNode; }
+  const DICompileUnit *getCUNode() const { return CUNode; }
   DIE &getUnitDie() { return UnitDie; }
 
   unsigned getDebugInfoOffset() const { return DebugInfoOffset; }
   void setDebugInfoOffset(unsigned DbgInfoOff) { DebugInfoOffset = DbgInfoOff; }
 
   /// \brief Return true if this compile unit has something to write out.
-  bool hasContent() const { return !UnitDie.getChildren().empty(); }
+  bool hasContent() const { return UnitDie.hasChildren(); }
 
   /// \brief Get string containing language specific context for a global name.
   ///
@@ -159,15 +152,15 @@ public:
   /// metadata level because DIEs may not currently have been added to the
   /// parent context and walking the DIEs looking for names is more expensive
   /// than walking the metadata.
-  std::string getParentContextString(const MDScope *Context) const;
+  std::string getParentContextString(const DIScope *Context) const;
 
   /// Add a new global name to the compile unit.
-  virtual void addGlobalName(StringRef Name, DIE &Die, const MDScope *Context) {
+  virtual void addGlobalName(StringRef Name, DIE &Die, const DIScope *Context) {
   }
 
   /// Add a new global type to the compile unit.
-  virtual void addGlobalType(const MDType *Ty, const DIE &Die,
-                             const MDScope *Context) {}
+  virtual void addGlobalType(const DIType *Ty, const DIE &Die,
+                             const DIScope *Context) {}
 
   /// \brief Add a new name to the namespace accelerator table.
   void addAccelNamespace(StringRef Name, const DIE &Die);
@@ -177,17 +170,17 @@ public:
   /// We delegate the request to DwarfDebug when the MDNode can be part of the
   /// type system, since DIEs for the type system can be shared across CUs and
   /// the mappings are kept in DwarfDebug.
-  DIE *getDIE(const DebugNode *D) const;
+  DIE *getDIE(const DINode *D) const;
 
   /// \brief Returns a fresh newly allocated DIELoc.
-  DIELoc *getDIELoc() { return new (DIEValueAllocator) DIELoc(); }
+  DIELoc *getDIELoc() { return new (DIEValueAllocator) DIELoc; }
 
   /// \brief Insert DIE into the map.
   ///
   /// We delegate the request to DwarfDebug when the MDNode can be part of the
   /// type system, since DIEs for the type system can be shared across CUs and
   /// the mappings are kept in DwarfDebug.
-  void insertDIE(const DebugNode *Desc, DIE *D);
+  void insertDIE(const DINode *Desc, DIE *D);
 
   /// \brief Add a flag that is true to the DIE.
   void addFlag(DIE &Die, dwarf::Attribute Attribute);
@@ -233,7 +226,7 @@ public:
   void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry);
 
   /// \brief Add a DIE attribute data and value.
-  void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIEEntry *Entry);
+  void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIEEntry Entry);
 
   void addDIETypeSignature(DIE &Die, const DwarfTypeUnit &Type);
 
@@ -246,17 +239,17 @@ public:
   /// \brief Add location information to specified debug information entry.
   void addSourceLine(DIE &Die, unsigned Line, StringRef File,
                      StringRef Directory);
-  void addSourceLine(DIE &Die, const MDLocalVariable *V);
-  void addSourceLine(DIE &Die, const MDGlobalVariable *G);
-  void addSourceLine(DIE &Die, const MDSubprogram *SP);
-  void addSourceLine(DIE &Die, const MDType *Ty);
-  void addSourceLine(DIE &Die, const MDNamespace *NS);
-  void addSourceLine(DIE &Die, const MDObjCProperty *Ty);
+  void addSourceLine(DIE &Die, const DILocalVariable *V);
+  void addSourceLine(DIE &Die, const DIGlobalVariable *G);
+  void addSourceLine(DIE &Die, const DISubprogram *SP);
+  void addSourceLine(DIE &Die, const DIType *Ty);
+  void addSourceLine(DIE &Die, const DINamespace *NS);
+  void addSourceLine(DIE &Die, const DIObjCProperty *Ty);
 
   /// \brief Add constant value entry in variable DIE.
-  void addConstantValue(DIE &Die, const MachineOperand &MO, const MDType *Ty);
-  void addConstantValue(DIE &Die, const ConstantInt *CI, const MDType *Ty);
-  void addConstantValue(DIE &Die, const APInt &Val, const MDType *Ty);
+  void addConstantValue(DIE &Die, const MachineOperand &MO, const DIType *Ty);
+  void addConstantValue(DIE &Die, const ConstantInt *CI, const DIType *Ty);
+  void addConstantValue(DIE &Die, const APInt &Val, const DIType *Ty);
   void addConstantValue(DIE &Die, const APInt &Val, bool Unsigned);
   void addConstantValue(DIE &Die, bool Unsigned, uint64_t Val);
 
@@ -268,7 +261,7 @@ public:
   void addLinkageName(DIE &Die, StringRef LinkageName);
 
   /// \brief Add template parameters in buffer.
-  void addTemplateParams(DIE &Buffer, DebugNodeArray TParams);
+  void addTemplateParams(DIE &Buffer, DINodeArray TParams);
 
   /// \brief Add register operand.
   /// \returns false if the register does not exist, e.g., because it was never
@@ -294,33 +287,33 @@ public:
   ///
   /// This takes and attribute parameter because DW_AT_friend attributes are
   /// also type references.
-  void addType(DIE &Entity, const MDType *Ty,
+  void addType(DIE &Entity, const DIType *Ty,
                dwarf::Attribute Attribute = dwarf::DW_AT_type);
 
-  DIE *getOrCreateNameSpace(const MDNamespace *NS);
-  DIE *getOrCreateSubprogramDIE(const MDSubprogram *SP, bool Minimal = false);
+  DIE *getOrCreateNameSpace(const DINamespace *NS);
+  DIE *getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal = false);
 
-  void applySubprogramAttributes(const MDSubprogram *SP, DIE &SPDie,
+  void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie,
                                  bool Minimal = false);
 
   /// \brief Find existing DIE or create new DIE for the given type.
   DIE *getOrCreateTypeDIE(const MDNode *N);
 
   /// \brief Get context owner's DIE.
-  DIE *createTypeDIE(const MDCompositeType *Ty);
+  DIE *createTypeDIE(const DICompositeType *Ty);
 
   /// \brief Get context owner's DIE.
-  DIE *getOrCreateContextDIE(const MDScope *Context);
+  DIE *getOrCreateContextDIE(const DIScope *Context);
 
   /// \brief Construct DIEs for types that contain vtables.
   void constructContainingTypeDIEs();
 
   /// \brief Construct function argument DIEs.
-  void constructSubprogramArguments(DIE &Buffer, MDTypeRefArray Args);
+  void constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args);
 
   /// Create a DIE with the given Tag, add the DIE to its parent, and
   /// call insertDIE if MD is not null.
-  DIE &createAndAddDIE(unsigned Tag, DIE &Parent, const DebugNode *N = nullptr);
+  DIE &createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N = nullptr);
 
   /// Compute the size of a header for this unit, not including the initial
   /// length field.
@@ -335,11 +328,11 @@ public:
 
   virtual DwarfCompileUnit &getCU() = 0;
 
-  void constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy);
+  void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy);
 
 protected:
   /// \brief Create new static data member DIE.
-  DIE *getOrCreateStaticMemberDIE(const MDDerivedType *DT);
+  DIE *getOrCreateStaticMemberDIE(const DIDerivedType *DT);
 
   /// Look up the source ID with the given directory and source file names. If
   /// none currently exists, create a new ID and insert it in the line table.
@@ -347,51 +340,37 @@ protected:
 
   /// \brief Look in the DwarfDebug map for the MDNode that corresponds to the
   /// reference.
-  template <typename T> T *resolve(TypedDebugNodeRef<T> Ref) const {
+  template <typename T> T *resolve(TypedDINodeRef<T> Ref) const {
     return DD->resolve(Ref);
   }
 
 private:
-  void constructTypeDIE(DIE &Buffer, const MDBasicType *BTy);
-  void constructTypeDIE(DIE &Buffer, const MDDerivedType *DTy);
-  void constructTypeDIE(DIE &Buffer, const MDSubroutineType *DTy);
-  void constructSubrangeDIE(DIE &Buffer, const MDSubrange *SR, DIE *IndexTy);
-  void constructArrayTypeDIE(DIE &Buffer, const MDCompositeType *CTy);
-  void constructEnumTypeDIE(DIE &Buffer, const MDCompositeType *CTy);
-  void constructMemberDIE(DIE &Buffer, const MDDerivedType *DT);
+  void constructTypeDIE(DIE &Buffer, const DIBasicType *BTy);
+  void constructTypeDIE(DIE &Buffer, const DIDerivedType *DTy);
+  void constructTypeDIE(DIE &Buffer, const DISubroutineType *DTy);
+  void constructSubrangeDIE(DIE &Buffer, const DISubrange *SR, DIE *IndexTy);
+  void constructArrayTypeDIE(DIE &Buffer, const DICompositeType *CTy);
+  void constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy);
+  void constructMemberDIE(DIE &Buffer, const DIDerivedType *DT);
   void constructTemplateTypeParameterDIE(DIE &Buffer,
-                                         const MDTemplateTypeParameter *TP);
+                                         const DITemplateTypeParameter *TP);
   void constructTemplateValueParameterDIE(DIE &Buffer,
-                                          const MDTemplateValueParameter *TVP);
+                                          const DITemplateValueParameter *TVP);
 
   /// \brief Return the default lower bound for an array.
   ///
   /// If the DWARF version doesn't handle the language, return -1.
   int64_t getDefaultLowerBound() const;
 
-  /// \brief Returns the DIE entry for the specified debug variable.
-  DIEEntry *getDIEEntry(const MDNode *N) const {
-    return MDNodeToDIEEntryMap.lookup(N);
-  }
-
-  /// \brief Insert debug information entry into the map.
-  void insertDIEEntry(const MDNode *N, DIEEntry *E) {
-    MDNodeToDIEEntryMap.insert(std::make_pair(N, E));
-  }
-
   /// \brief Get an anonymous type for index type.
   DIE *getIndexTyDie();
 
   /// \brief Set D as anonymous type for index which can be reused later.
   void setIndexTyDie(DIE *D) { IndexTyDie = D; }
 
-  /// \brief Creates a new DIEEntry to be a proxy for a debug information
-  /// entry.
-  DIEEntry *createDIEEntry(DIE &Entry);
-
   /// If this is a named finished type then include it in the list of types for
   /// the accelerator tables.
-  void updateAcceleratorTables(const MDScope *Context, const MDType *Ty,
+  void updateAcceleratorTables(const DIScope *Context, const DIType *Ty,
                                const DIE &TyDIE);
 
   virtual bool isDwoUnit() const = 0;
@@ -423,5 +402,5 @@ public:
   }
   DwarfCompileUnit &getCU() override { return CU; }
 };
-} // end llvm namespace
+} // namespace llvm
 #endif