diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h index 1caf0eceddb..9c026cc4f6c 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 STC *getSubtarget() const { + template const STC &getSubtarget() const { const TargetSubtarget *TST = getSubtargetImpl(); - assert(getSubtargetImpl() && dynamic_cast(TST) && + assert(TST && dynamic_cast(TST) && "Not the right kind of subtarget!"); - return (STC*)TST; + return *static_cast(TST); } /// getRegisterInfo - If register information is available, return it. If