* Make TargetLowering not crash when TargetMachine::getTargetAsmInfo() returns
authorMatthijs Kooijman <matthijs@stdin.nl>
Mon, 13 Oct 2008 12:41:46 +0000 (12:41 +0000)
committerMatthijs Kooijman <matthijs@stdin.nl>
Mon, 13 Oct 2008 12:41:46 +0000 (12:41 +0000)
   null. This assumes that any target that does not have AsmInfo, does not
   support "LocAndDot".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57438 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/TargetLowering.cpp

index 7e17daaa0f606bac106f5578832fa8c31184c76e..05edb6348d653d6eec94fbc9fccd0c21b79974db 100644 (file)
@@ -473,7 +473,8 @@ TargetLowering::TargetLowering(TargetMachine &tm)
   InitCmpLibcallCCs(CmpLibcallCCs);
 
   // Tell Legalize whether the assembler supports DEBUG_LOC.
-  if (!TM.getTargetAsmInfo()->hasDotLocAndDotFile())
+  const TargetAsmInfo *TASM = TM.getTargetAsmInfo();
+  if (!TASM || !TASM->hasDotLocAndDotFile())
     setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand);
 }