diff options
Diffstat (limited to 'llvm/include/llvm/IR/DebugInfo.h')
| -rw-r--r-- | llvm/include/llvm/IR/DebugInfo.h | 66 |
1 files changed, 19 insertions, 47 deletions
diff --git a/llvm/include/llvm/IR/DebugInfo.h b/llvm/include/llvm/IR/DebugInfo.h index cf7b5e0b8da..83fa3fbf228 100644 --- a/llvm/include/llvm/IR/DebugInfo.h +++ b/llvm/include/llvm/IR/DebugInfo.h @@ -374,59 +374,31 @@ public: MDTypeRefArray getTypeArray() const { return get()->getTypeArray(); } }; -/// \brief This is a wrapper for a file. -class DIFile : public DIScope { -public: - DIFile() = default; - DIFile(const MDFile *N) : DIScope(N) {} +class DIFile { + MDFile *N; - MDFile *get() const { return cast_or_null<MDFile>(DIDescriptor::get()); } - operator MDFile *() const { return get(); } - MDFile *operator->() const { return get(); } - MDFile &operator*() const { return *get(); } +public: + DIFile(const MDFile *N = nullptr) : N(const_cast<MDFile *>(N)) {} - /// \brief Retrieve the MDNode for the directory/file pair. - MDNode *getFileNode() const { return get(); } + operator DIDescriptor() const { return N; } + operator DIScope() const { return N; } + operator MDFile *() const { return N; } + MDFile *operator->() const { return N; } + MDFile &operator*() const { return *N; } }; -/// \brief A wrapper for a compile unit. -class DICompileUnit : public DIScope { -public: - DICompileUnit() = default; - DICompileUnit(const MDCompileUnit *N) : DIScope(N) {} - - MDCompileUnit *get() const { - return cast_or_null<MDCompileUnit>(DIDescriptor::get()); - } - operator MDCompileUnit *() const { return get(); } - MDCompileUnit *operator->() const { return get(); } - MDCompileUnit &operator*() const { return *get(); } +class DICompileUnit { + MDCompileUnit *N; - dwarf::SourceLanguage getLanguage() const { - return static_cast<dwarf::SourceLanguage>(get()->getSourceLanguage()); - } - StringRef getProducer() const { return get()->getProducer(); } - bool isOptimized() const { return get()->isOptimized(); } - StringRef getFlags() const { return get()->getFlags(); } - unsigned getRunTimeVersion() const { return get()->getRuntimeVersion(); } - - DIArray getEnumTypes() const { return get()->getEnumTypes(); } - DIArray getRetainedTypes() const { return get()->getRetainedTypes(); } - DIArray getSubprograms() const { return get()->getSubprograms(); } - DIArray getGlobalVariables() const { return get()->getGlobalVariables(); } - DIArray getImportedEntities() const { return get()->getImportedEntities(); } - - void replaceSubprograms(MDSubprogramArray Subprograms) const { - get()->replaceSubprograms(Subprograms); - } - void replaceGlobalVariables(MDGlobalVariableArray GlobalVariables) const { - get()->replaceGlobalVariables(GlobalVariables); - } +public: + DICompileUnit(const MDCompileUnit *N = nullptr) + : N(const_cast<MDCompileUnit *>(N)) {} - StringRef getSplitDebugFilename() const { - return get()->getSplitDebugFilename(); - } - unsigned getEmissionKind() const { return get()->getEmissionKind(); } + operator DIDescriptor() const { return N; } + operator DIScope() const { return N; } + operator MDCompileUnit *() const { return N; } + MDCompileUnit *operator->() const { return N; } + MDCompileUnit &operator*() const { return *N; } }; class DISubprogram { |

