mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-03 10:54:42 +00:00
Add getOrInsertNamedMetadata().
llvm-svn: 77646
This commit is contained in:
parent
5fb5ef77e3
commit
343bc16228
@ -303,11 +303,16 @@ public:
|
||||
/// @name Named Metadata Accessors
|
||||
/// @{
|
||||
public:
|
||||
/// getNamedMetadata - Return the first named MDNode in the module with the
|
||||
/// specified name. This method returns null if a MDNode with the specified
|
||||
/// name is not found.
|
||||
/// getNamedMetadata - Return the first NamedMDNode in the module with the
|
||||
/// specified name. This method returns null if a NamedMDNode with the
|
||||
/// specified name is not found.
|
||||
NamedMDNode *getNamedMetadata(const StringRef &Name) const;
|
||||
|
||||
/// getOrInsertNamedMetadata - Return the first named MDNode in the module
|
||||
/// with the specified name. This method returns a new NamedMDNode if a
|
||||
/// NamedMDNode with the specified name is not found.
|
||||
NamedMDNode *getOrInsertNamedMetadata(const StringRef &Name);
|
||||
|
||||
/// @}
|
||||
/// @name Type Accessors
|
||||
/// @{
|
||||
|
@ -289,13 +289,24 @@ GlobalAlias *Module::getNamedAlias(const StringRef &Name) const {
|
||||
return dyn_cast_or_null<GlobalAlias>(getNamedValue(Name));
|
||||
}
|
||||
|
||||
/// getNamedMetadata - Return the first named MDNode in the module with the
|
||||
/// specified name. This method returns null if a MDNode with the specified
|
||||
/// name is not found.
|
||||
/// getNamedMetadata - Return the first NamedMDNode in the module with the
|
||||
/// specified name. This method returns null if a NamedMDNode with the
|
||||
//// specified name is not found.
|
||||
NamedMDNode *Module::getNamedMetadata(const StringRef &Name) const {
|
||||
return dyn_cast_or_null<NamedMDNode>(getValueSymbolTable().lookup(Name));
|
||||
}
|
||||
|
||||
/// getOrInsertNamedMetadata - Return the first named MDNode in the module
|
||||
/// with the specified name. This method returns a new NamedMDNode if a
|
||||
/// NamedMDNode with the specified name is not found.
|
||||
NamedMDNode *Module::getOrInsertNamedMetadata(const StringRef &Name) {
|
||||
NamedMDNode *NMD =
|
||||
dyn_cast_or_null<NamedMDNode>(getValueSymbolTable().lookup(Name));
|
||||
if (!NMD)
|
||||
NMD = NamedMDNode::Create(Name, NULL, 0, this);
|
||||
return NMD;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Methods for easy access to the types in the module.
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user