[Lldb-commits] [lldb] r150861 - in /lldb/trunk: include/lldb/Expression/ClangExpressionDeclMap.h include/lldb/Symbol/ClangASTContext.h source/Expression/ClangExpressionDeclMap.cpp source/Symbol/ClangASTContext.cpp

Sean Callanan scallanan at apple.com
Fri Feb 17 18:01:03 PST 2012


Author: spyffe
Date: Fri Feb 17 20:01:03 2012
New Revision: 150861

URL: http://llvm.org/viewvc/llvm-project?rev=150861&view=rev
Log:
Ignore the constness of the object pointer when
fetching it.

Modified:
    lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h
    lldb/trunk/include/lldb/Symbol/ClangASTContext.h
    lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
    lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h?rev=150861&r1=150860&r2=150861&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h Fri Feb 17 20:01:03 2012
@@ -815,7 +815,8 @@
     lldb::VariableSP
     FindVariableInScope (StackFrame &frame,
                          const ConstString &name,
-                         TypeFromUser *type = NULL);
+                         TypeFromUser *type = NULL,
+                         bool ignore_const = false);
     
     //------------------------------------------------------------------
     /// Given a target, find a data symbol that has the given name.

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=150861&r1=150860&r2=150861&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Fri Feb 17 20:01:03 2012
@@ -217,13 +217,15 @@
     static bool
     AreTypesSame(clang::ASTContext *ast,
                  lldb::clang_type_t type1,
-                 lldb::clang_type_t type2);
+                 lldb::clang_type_t type2,
+                 bool ignore_qualifiers = false);
     
     bool
     AreTypesSame(lldb::clang_type_t type1,
-                 lldb::clang_type_t type2)
+                 lldb::clang_type_t type2,
+                 bool ignore_qualifiers = false)
     {
-        return ClangASTContext::AreTypesSame(getASTContext(), type1, type2);
+        return ClangASTContext::AreTypesSame(getASTContext(), type1, type2, ignore_qualifiers);
     }
     
     

Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=150861&r1=150860&r2=150861&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Feb 17 20:01:03 2012
@@ -1208,9 +1208,12 @@
         return false;
     }
     
+    const bool ignore_const = true;
+    
     VariableSP object_ptr_var = FindVariableInScope (*frame,
                                                      object_name, 
-                                                     (suppress_type_check ? NULL : &m_struct_vars->m_object_pointer_type));
+                                                     (suppress_type_check ? NULL : &m_struct_vars->m_object_pointer_type),
+                                                     ignore_const);
     
     if (!object_ptr_var)
     {
@@ -2158,7 +2161,8 @@
 (
     StackFrame &frame,
     const ConstString &name,
-    TypeFromUser *type
+    TypeFromUser *type,
+    bool ignore_const
 )
 {    
     lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
@@ -2183,7 +2187,10 @@
     {
         if (type->GetASTContext() == var_sp->GetType()->GetClangAST())
         {
-            if (!ClangASTContext::AreTypesSame(type->GetASTContext(), type->GetOpaqueQualType(), var_sp->GetType()->GetClangFullType()))
+            if (!ClangASTContext::AreTypesSame(type->GetASTContext(), 
+                                               type->GetOpaqueQualType(), 
+                                               var_sp->GetType()->GetClangFullType(), 
+                                               ignore_const))
                 return lldb::VariableSP();
         }
         else

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=150861&r1=150860&r2=150861&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Feb 17 20:01:03 2012
@@ -1031,10 +1031,20 @@
 bool
 ClangASTContext::AreTypesSame(ASTContext *ast,
              clang_type_t type1,
-             clang_type_t type2)
+             clang_type_t type2,
+             bool ignore_qualifiers)
 {
-    return ast->hasSameType (QualType::getFromOpaquePtr(type1),
-                             QualType::getFromOpaquePtr(type2));
+    QualType type1_qual = QualType::getFromOpaquePtr(type1);
+    QualType type2_qual = QualType::getFromOpaquePtr(type2);
+    
+    if (ignore_qualifiers)
+    {
+        type1_qual = type1_qual.getUnqualifiedType();
+        type2_qual = type2_qual.getUnqualifiedType();
+    }
+    
+    return ast->hasSameType (type1_qual,
+                             type2_qual);
 }
 
 #pragma mark CVR modifiers





More information about the lldb-commits mailing list