summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
ff49ef7)
Add forwarding `getFilename()` and `getDirectory()` accessors to nodes
in the new hierarchy that define a `getFile()`. Use that to
re-implement existing functionality in the `DIDescriptor` hierarchy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234671
91177308-0d34-0410-b5e6-
96231b3b80d8
///
/// If the scope node has a name, return that, else return an empty string.
StringRef getName() const;
///
/// If the scope node has a name, return that, else return an empty string.
StringRef getName() const;
- StringRef getFilename() const;
- StringRef getDirectory() const;
+ StringRef getFilename() const { return get()->getFilename(); }
+ StringRef getDirectory() const { return get()->getDirectory(); }
/// \brief Generate a reference to this DIScope.
///
/// \brief Generate a reference to this DIScope.
///
unsigned isDefinition() const { return get()->isDefinition(); }
DIScope getContext() const { return DIScope(get()->getScope()); }
unsigned isDefinition() const { return get()->isDefinition(); }
DIScope getContext() const { return DIScope(get()->getScope()); }
- StringRef getFilename() const { return getFile().getFilename(); }
- StringRef getDirectory() const { return getFile().getDirectory(); }
+ StringRef getFilename() const { return get()->getFilename(); }
+ StringRef getDirectory() const { return get()->getDirectory(); }
DITypeRef getType() const { return get()->getType(); }
GlobalVariable *getGlobal() const;
DITypeRef getType() const { return get()->getType(); }
GlobalVariable *getGlobal() const;
DILocation getOrigLocation() const {
return DILocation(get()->getInlinedAt());
}
DILocation getOrigLocation() const {
return DILocation(get()->getInlinedAt());
}
- StringRef getFilename() const { return getScope().getFilename(); }
- StringRef getDirectory() const { return getScope().getDirectory(); }
+ StringRef getFilename() const { return get()->getFilename(); }
+ StringRef getDirectory() const { return get()->getDirectory(); }
bool atSameLineAs(const DILocation &Other) const {
return (getLineNumber() == Other.getLineNumber() &&
getFilename() == Other.getFilename());
bool atSameLineAs(const DILocation &Other) const {
return (getLineNumber() == Other.getLineNumber() &&
getFilename() == Other.getFilename());
public:
MDFile *getFile() const { return cast_or_null<MDFile>(getRawFile()); }
public:
MDFile *getFile() const { return cast_or_null<MDFile>(getRawFile()); }
+ inline StringRef getFilename() const;
+ inline StringRef getDirectory() const;
+
/// \brief Return the raw underlying file.
///
/// An \a MDFile is an \a MDScope, but it doesn't point at a separate file
/// \brief Return the raw underlying file.
///
/// An \a MDFile is an \a MDScope, but it doesn't point at a separate file
+StringRef MDScope::getFilename() const {
+ if (auto *F = getFile())
+ return F->getFilename();
+ return "";
+}
+
+StringRef MDScope::getDirectory() const {
+ if (auto *F = getFile())
+ return F->getDirectory();
+ return "";
+}
+
/// \brief Base class for types.
///
/// TODO: Remove the hardcoded name and context, since many types don't use
/// \brief Base class for types.
///
/// TODO: Remove the hardcoded name and context, since many types don't use
return cast_or_null<MDLocation>(getRawInlinedAt());
}
return cast_or_null<MDLocation>(getRawInlinedAt());
}
+ MDFile *getFile() const { return getScope()->getFile(); }
+ StringRef getFilename() const { return getScope()->getFilename(); }
+ StringRef getDirectory() const { return getScope()->getDirectory(); }
+
/// \brief Get the scope where this is inlined.
///
/// Walk through \a getInlinedAt() and return \a getScope() from the deepest
/// \brief Get the scope where this is inlined.
///
/// Walk through \a getInlinedAt() and return \a getScope() from the deepest
MDFile *getFile() const { return cast_or_null<MDFile>(getRawFile()); }
MDTypeRef getType() const { return MDTypeRef(getRawType()); }
MDFile *getFile() const { return cast_or_null<MDFile>(getRawFile()); }
MDTypeRef getType() const { return MDTypeRef(getRawType()); }
+ StringRef getFilename() const {
+ if (auto *F = getFile())
+ return F->getFilename();
+ return "";
+ }
+ StringRef getDirectory() const {
+ if (auto *F = getFile())
+ return F->getDirectory();
+ return "";
+ }
+
Metadata *getRawScope() const { return getOperand(0); }
MDString *getRawName() const { return getOperandAs<MDString>(1); }
Metadata *getRawFile() const { return getOperand(2); }
Metadata *getRawScope() const { return getOperand(0); }
MDString *getRawName() const { return getOperandAs<MDString>(1); }
Metadata *getRawFile() const { return getOperand(2); }
StringRef getSetterName() const { return getStringOperand(3); }
MDType *getType() const { return cast_or_null<MDType>(getRawType()); }
StringRef getSetterName() const { return getStringOperand(3); }
MDType *getType() const { return cast_or_null<MDType>(getRawType()); }
+ StringRef getFilename() const {
+ if (auto *F = getFile())
+ return F->getFilename();
+ return "";
+ }
+ StringRef getDirectory() const {
+ if (auto *F = getFile())
+ return F->getDirectory();
+ return "";
+ }
+
MDString *getRawName() const { return getOperandAs<MDString>(0); }
Metadata *getRawFile() const { return getOperand(1); }
MDString *getRawGetterName() const { return getOperandAs<MDString>(2); }
MDString *getRawName() const { return getOperandAs<MDString>(0); }
Metadata *getRawFile() const { return getOperand(1); }
MDString *getRawGetterName() const { return getOperandAs<MDString>(2); }
-StringRef DIScope::getFilename() const {
- if (auto *N = get())
- if (auto *F = N->getFile())
- return F->getFilename();
- return "";
-}
-
-StringRef DIScope::getDirectory() const {
- if (auto *N = get())
- if (auto *F = N->getFile())
- return F->getDirectory();
- return "";
-}
-
void DICompileUnit::replaceSubprograms(DIArray Subprograms) {
get()->replaceSubprograms(MDSubprogramArray(Subprograms));
}
void DICompileUnit::replaceSubprograms(DIArray Subprograms) {
get()->replaceSubprograms(MDSubprogramArray(Subprograms));
}