[Lldb-commits] [lldb] r115698 - in /lldb/trunk: include/lldb/Expression/IRForTarget.h source/Expression/IRForTarget.cpp

Sean Callanan scallanan at apple.com
Tue Oct 5 15:26:43 PDT 2010


Author: spyffe
Date: Tue Oct  5 17:26:43 2010
New Revision: 115698

URL: http://llvm.org/viewvc/llvm-project?rev=115698&view=rev
Log:
Added handling for external variables in function
arguments to the expression parser.  This means that
structs can be returned from the "expr" command.

Modified:
    lldb/trunk/include/lldb/Expression/IRForTarget.h
    lldb/trunk/source/Expression/IRForTarget.cpp

Modified: lldb/trunk/include/lldb/Expression/IRForTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRForTarget.h?rev=115698&r1=115697&r2=115698&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/IRForTarget.h (original)
+++ lldb/trunk/include/lldb/Expression/IRForTarget.h Tue Oct  5 17:26:43 2010
@@ -220,6 +220,21 @@
                              bool Store);
     
     //------------------------------------------------------------------
+    /// Handle all the arguments to a function call
+    ///
+    /// @param[in] M
+    ///     The module currently being processed.
+    ///
+    /// @param[in] C
+    ///     The call instruction.
+    ///
+    /// @return
+    ///     True on success; false otherwise
+    //------------------------------------------------------------------
+    bool MaybeHandleCallArguments(llvm::Module &M,
+                                  llvm::CallInst *C);
+    
+    //------------------------------------------------------------------
     /// Handle a single external function call
     ///
     /// @param[in] M

Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=115698&r1=115697&r2=115698&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Tue Oct  5 17:26:43 2010
@@ -629,6 +629,21 @@
 }
 
 bool
+IRForTarget::MaybeHandleCallArguments(Module &M,
+                                      CallInst *C)
+{
+    // lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    
+    for (unsigned op_index = 0, num_ops = C->getNumArgOperands();
+         op_index < num_ops;
+         ++op_index)
+        if (!MaybeHandleVariable(M, C->getArgOperand(op_index), true)) // conservatively believe that this is a store
+            return false;
+    
+    return true;
+}
+
+bool
 IRForTarget::MaybeHandleCall(Module &M,
                              CallInst *C)
 {
@@ -772,8 +787,13 @@
         }
         
         if (CallInst *call = dyn_cast<CallInst>(&inst))
+        {
+            if (!MaybeHandleCallArguments(M, call))
+                return false;
+            
             if (!MaybeHandleCall(M, call))
                 return false;
+        }
     }
     
     return true;





More information about the lldb-commits mailing list