diff options
| author | Mehdi Amini <mehdi.amini@apple.com> | 2015-03-03 22:01:13 +0000 |
|---|---|---|
| committer | Mehdi Amini <mehdi.amini@apple.com> | 2015-03-03 22:01:13 +0000 |
| commit | 9a9738f6e5ecbd45bb2bc105d37570f045717152 (patch) | |
| tree | 607649fe7f2d6f54383c72f31b0b4648c7cca6e7 /llvm/include | |
| parent | 1dbe2e3dc4368a1985decfb180bd8e7290cd9f8e (diff) | |
| download | bcm5719-llvm-9a9738f6e5ecbd45bb2bc105d37570f045717152.tar.gz bcm5719-llvm-9a9738f6e5ecbd45bb2bc105d37570f045717152.zip | |
Remove getDataLayout() from Instruction/GlobalValue/BasicBlock/Function
Summary:
This does not conceptually belongs here. Instead provide a shortcut
getModule() that provides access to the DataLayout.
Reviewers: chandlerc, echristo
Reviewed By: echristo
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D8027
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 231147
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/IR/BasicBlock.h | 6 | ||||
| -rw-r--r-- | llvm/include/llvm/IR/GlobalValue.h | 2 | ||||
| -rw-r--r-- | llvm/include/llvm/IR/Instruction.h | 7 |
3 files changed, 11 insertions, 4 deletions
diff --git a/llvm/include/llvm/IR/BasicBlock.h b/llvm/include/llvm/IR/BasicBlock.h index 185fc2952ec..8f5cdebcd10 100644 --- a/llvm/include/llvm/IR/BasicBlock.h +++ b/llvm/include/llvm/IR/BasicBlock.h @@ -119,7 +119,11 @@ public: const Function *getParent() const { return Parent; } Function *getParent() { return Parent; } - const DataLayout *getDataLayout() const; + /// \brief Return the module owning the function this basic block belongs to, + /// or nullptr it the function does not have a module. + /// + /// Note: this is undefined behavior if the block does not have a parent. + const Module *getModule() const; /// \brief Returns the terminator instruction if the block is well formed or /// null if the block is not well formed. diff --git a/llvm/include/llvm/IR/GlobalValue.h b/llvm/include/llvm/IR/GlobalValue.h index aaecc1dcc3f..002e5e79fd4 100644 --- a/llvm/include/llvm/IR/GlobalValue.h +++ b/llvm/include/llvm/IR/GlobalValue.h @@ -346,8 +346,6 @@ public: inline Module *getParent() { return Parent; } inline const Module *getParent() const { return Parent; } - const DataLayout *getDataLayout() const; - // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const Value *V) { return V->getValueID() == Value::FunctionVal || diff --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h index dfece3e3f2f..dc96b57674c 100644 --- a/llvm/include/llvm/IR/Instruction.h +++ b/llvm/include/llvm/IR/Instruction.h @@ -54,7 +54,12 @@ public: inline const BasicBlock *getParent() const { return Parent; } inline BasicBlock *getParent() { return Parent; } - const DataLayout *getDataLayout() const; + /// \brief Return the module owning the function this instruction belongs to + /// or nullptr it the function does not have a module. + /// + /// Note: this is undefined behavior if the instruction does not have a + /// parent, or the parent basic block does not have a parent function. + const Module *getModule() const; /// removeFromParent - This method unlinks 'this' from the containing basic /// block, but does not delete it. |

