Use single interface, using twine, to get named metadata.

getNamedMetadata().

llvm-svn: 106518
This commit is contained in:
Devang Patel 2010-06-22 01:19:38 +00:00
parent a1ebf91a39
commit f50b6147ad
4 changed files with 5 additions and 11 deletions

View File

@ -325,8 +325,7 @@ public:
/// 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(StringRef Name) const;
NamedMDNode *getNamedMetadataUsingTwine(Twine Name) const;
NamedMDNode *getNamedMetadata(const Twine &Name) const;
/// getOrInsertNamedMetadata - Return the first named MDNode in the module
/// with the specified name. This method returns a new NamedMDNode if a

View File

@ -1062,8 +1062,7 @@ DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context,
char One = '\1';
if (FName.startswith(StringRef(&One, 1)))
FName = FName.substr(1);
NamedMDNode *FnLocals =
M.getNamedMetadataUsingTwine(Twine("llvm.dbg.lv.", FName));
NamedMDNode *FnLocals = M.getNamedMetadata(Twine("llvm.dbg.lv.", FName));
if (!FnLocals)
FnLocals = NamedMDNode::Create(VMContext, Twine("llvm.dbg.lv.", FName),
NULL, 0, &M);

View File

@ -2260,8 +2260,8 @@ void DwarfDebug::collectVariableInfo(const MachineFunction *MF) {
const Function *F = MF->getFunction();
const Module *M = F->getParent();
if (NamedMDNode *NMD =
M->getNamedMetadataUsingTwine(Twine("llvm.dbg.lv.",
getRealLinkageName(F->getName())))) {
M->getNamedMetadata(Twine("llvm.dbg.lv.",
getRealLinkageName(F->getName())))) {
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
DIVariable DV(cast_or_null<MDNode>(NMD->getOperand(i)));
if (!DV || !Processed.insert(DV))

View File

@ -313,11 +313,7 @@ GlobalAlias *Module::getNamedAlias(StringRef Name) const {
/// 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(StringRef Name) const {
return NamedMDSymTab->lookup(Name);
}
NamedMDNode *Module::getNamedMetadataUsingTwine(Twine Name) const {
NamedMDNode *Module::getNamedMetadata(const Twine &Name) const {
SmallString<256> NameData;
StringRef NameRef = Name.toStringRef(NameData);
return NamedMDSymTab->lookup(NameRef);