diff options
author | Dan Gohman <gohman@apple.com> | 2010-07-21 23:38:33 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-07-21 23:38:33 +0000 |
commit | 17aa92c92a925b4a674440c7ef088c223990e854 (patch) | |
tree | bc129644ee9db39dc25a41c22ce01b14ede5728f /include/llvm/Module.h | |
parent | fcbd1a749f9db4bf144a3343c4d707e1de087a7e (diff) |
Make NamedMDNode not be a subclass of Value, and simplify the interface
for creating and populating NamedMDNodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109061 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Module.h')
-rw-r--r-- | include/llvm/Module.h | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/include/llvm/Module.h b/include/llvm/Module.h index 9b7cd4c88d..45247ec31c 100644 --- a/include/llvm/Module.h +++ b/include/llvm/Module.h @@ -28,7 +28,6 @@ namespace llvm { class FunctionType; class GVMaterializer; class LLVMContext; -class MDSymbolTable; template<> struct ilist_traits<Function> : public SymbolTableListTraits<Function, Module> { @@ -61,7 +60,7 @@ template<> struct ilist_traits<GlobalAlias> }; template<> struct ilist_traits<NamedMDNode> - : public SymbolTableListTraits<NamedMDNode, Module> { + : public ilist_default_traits<NamedMDNode> { // createSentinel is used to get hold of a node that marks the end of // the list... NamedMDNode *createSentinel() const { @@ -72,8 +71,8 @@ template<> struct ilist_traits<NamedMDNode> NamedMDNode *provideInitialHead() const { return createSentinel(); } NamedMDNode *ensureHead(NamedMDNode*) const { return createSentinel(); } static void noteHead(NamedMDNode*, NamedMDNode*) {} - void addNodeToList(NamedMDNode *N); - void removeNodeFromList(NamedMDNode *N); + void addNodeToList(NamedMDNode *N) {} + void removeNodeFromList(NamedMDNode *N) {} private: mutable ilist_node<NamedMDNode> Sentinel; }; @@ -100,7 +99,7 @@ public: /// The type for the list of aliases. typedef iplist<GlobalAlias> AliasListType; /// The type for the list of named metadata. - typedef iplist<NamedMDNode> NamedMDListType; + typedef ilist<NamedMDNode> NamedMDListType; /// The type for the list of dependent libraries. typedef std::vector<std::string> LibraryListType; @@ -151,7 +150,7 @@ private: std::string ModuleID; ///< Human readable identifier for the module std::string TargetTriple; ///< Platform target triple Module compiled on std::string DataLayout; ///< Target data description - MDSymbolTable *NamedMDSymTab; ///< NamedMDNode names. + void *NamedMDSymTab; ///< NamedMDNode names. friend class Constant; @@ -331,6 +330,10 @@ public: /// NamedMDNode with the specified name is not found. NamedMDNode *getOrInsertNamedMetadata(StringRef Name); + /// eraseNamedMetadata - Remove the given NamedMDNode from this module + /// and delete it. + void eraseNamedMetadata(NamedMDNode *NMD); + /// @} /// @name Type Accessors /// @{ @@ -417,13 +420,6 @@ public: static iplist<GlobalAlias> Module::*getSublistAccess(GlobalAlias*) { return &Module::AliasList; } - /// Get the Module's list of named metadata (constant). - const NamedMDListType &getNamedMDList() const { return NamedMDList; } - /// Get the Module's list of named metadata. - NamedMDListType &getNamedMDList() { return NamedMDList; } - static iplist<NamedMDNode> Module::*getSublistAccess(NamedMDNode *) { - return &Module::NamedMDList; - } /// Get the symbol table of global variable and function identifiers const ValueSymbolTable &getValueSymbolTable() const { return *ValSymTab; } /// Get the Module's symbol table of global variable and function identifiers. @@ -432,10 +428,6 @@ public: const TypeSymbolTable &getTypeSymbolTable() const { return *TypeSymTab; } /// Get the Module's symbol table of types TypeSymbolTable &getTypeSymbolTable() { return *TypeSymTab; } - /// Get the symbol table of named metadata - const MDSymbolTable &getMDSymbolTable() const { return *NamedMDSymTab; } - /// Get the Module's symbol table of named metadata - MDSymbolTable &getMDSymbolTable() { return *NamedMDSymTab; } /// @} /// @name Global Variable Iteration |