[Lldb-commits] [lldb] r183022 - Fixed value evaluation to handle null constants.

Sean Callanan scallanan at apple.com
Fri May 31 10:29:03 PDT 2013


Author: spyffe
Date: Fri May 31 12:29:03 2013
New Revision: 183022

URL: http://llvm.org/viewvc/llvm-project?rev=183022&view=rev
Log:
Fixed value evaluation to handle null constants.

<rdar://problem/14005311>

Modified:
    lldb/trunk/source/Expression/IRInterpreter.cpp
    lldb/trunk/test/lang/c/strings/TestCStrings.py

Modified: lldb/trunk/source/Expression/IRInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=183022&r1=183021&r2=183022&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRInterpreter.cpp (original)
+++ lldb/trunk/source/Expression/IRInterpreter.cpp Fri May 31 12:29:03 2013
@@ -151,7 +151,11 @@ public:
         
         if (constant)
         {
-            if (const ConstantInt *constant_int = dyn_cast<ConstantInt>(constant))
+            if (isa<ConstantPointerNull>(constant))
+            {
+                return AssignToMatchType(scalar, 0, value->getType());
+            }
+            else if (const ConstantInt *constant_int = dyn_cast<ConstantInt>(constant))
             {                
                 return AssignToMatchType(scalar, constant_int->getLimitedValue(), value->getType());
             }

Modified: lldb/trunk/test/lang/c/strings/TestCStrings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/strings/TestCStrings.py?rev=183022&r1=183021&r2=183022&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/strings/TestCStrings.py (original)
+++ lldb/trunk/test/lang/c/strings/TestCStrings.py Fri May 31 12:29:03 2013
@@ -66,6 +66,9 @@ class CStringsTestCase(TestBase):
         self.expect("p (int)strlen(\"\")",
                     substrs = ['(int) $', ' = 0'])
 
+        self.expect("expression !z",
+                    substrs = ['false'])
+
 if __name__ == '__main__':
     import atexit
     lldb.SBDebugger.Initialize()





More information about the lldb-commits mailing list