[llvm-commits] CVS: llvm/include/llvm/Target/TargetMachine.h

Chris Lattner lattner at cs.uiuc.edu
Fri Aug 5 14:53:32 PDT 2005



Changes in directory llvm/include/llvm/Target:

TargetMachine.h updated: 1.56 -> 1.57
---
Log message:

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.


---
Diffs of the changes:  (+3 -3)

 TargetMachine.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/include/llvm/Target/TargetMachine.h
diff -u llvm/include/llvm/Target/TargetMachine.h:1.56 llvm/include/llvm/Target/TargetMachine.h:1.57
--- llvm/include/llvm/Target/TargetMachine.h:1.56	Wed Jul 27 00:53:43 2005
+++ llvm/include/llvm/Target/TargetMachine.h	Fri Aug  5 16:53:21 2005
@@ -105,11 +105,11 @@
   /// 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






More information about the llvm-commits mailing list