diff options
author | Chris Lattner <sabre@nondot.org> | 2005-08-05 21:53:21 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-08-05 21:53:21 +0000 |
commit | 5ab83632066071413841af43bc5d1edcced18076 (patch) | |
tree | 479f97e885b36c9a9b4b12836a1e4481bfdd3a38 | |
parent | ba253651402f5d12172b3feed8909e28d01b7e1d (diff) |
Since getSubtarget() always provides a const Subtarget, dont' require the user
to pass it in. Also, since it always returns a non-null pointer, make it
return a reference instead for easier use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22686 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Target/TargetMachine.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h index 1caf0ecedd..9c026cc4f6 100644 --- a/include/llvm/Target/TargetMachine.h +++ b/include/llvm/Target/TargetMachine.h @@ -105,11 +105,11 @@ public: /// getSubtarget - This method returns a pointer to the specified type of /// TargetSubtarget. In debug builds, it verifies that the object being /// returned is of the correct type. - template<typename STC> STC *getSubtarget() const { + template<typename STC> const STC &getSubtarget() const { const TargetSubtarget *TST = getSubtargetImpl(); - assert(getSubtargetImpl() && dynamic_cast<STC*>(TST) && + assert(TST && dynamic_cast<const STC*>(TST) && "Not the right kind of subtarget!"); - return (STC*)TST; + return *static_cast<const STC*>(TST); } /// getRegisterInfo - If register information is available, return it. If |