[Lldb-commits] [lldb] r170396 - /lldb/trunk/source/Expression/ASTResultSynthesizer.cpp

Sean Callanan scallanan at apple.com
Mon Dec 17 16:50:18 PST 2012


Author: spyffe
Date: Mon Dec 17 18:50:17 2012
New Revision: 170396

URL: http://llvm.org/viewvc/llvm-project?rev=170396&view=rev
Log:
Removed a possible use of unchecked NULL from
the AST result synthesizer's logging.

<rdar://problem/12889053>

Modified:
    lldb/trunk/source/Expression/ASTResultSynthesizer.cpp

Modified: lldb/trunk/source/Expression/ASTResultSynthesizer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ASTResultSynthesizer.cpp?rev=170396&r1=170395&r2=170396&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ASTResultSynthesizer.cpp (original)
+++ lldb/trunk/source/Expression/ASTResultSynthesizer.cpp Mon Dec 17 18:50:17 2012
@@ -131,8 +131,6 @@
 {
     lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
-    ASTContext &Ctx(*m_ast_context);
-
     if (!m_sema)
         return false;
     
@@ -146,11 +144,11 @@
         std::string s;
         raw_string_ostream os(s);
         
-        Ctx.getTranslationUnitDecl()->print(os);
+        function_decl->print(os);
         
         os.flush();
         
-        log->Printf("AST context before transforming:\n%s", s.c_str());
+        log->Printf ("Untransformed function AST:\n%s", s.c_str());
     }
     
     Stmt *function_body = function_decl->getBody();
@@ -178,9 +176,7 @@
 ASTResultSynthesizer::SynthesizeObjCMethodResult (ObjCMethodDecl *MethodDecl)
 {
     lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-    
-    ASTContext &Ctx(*m_ast_context);
-    
+        
     if (!m_sema)
         return false;
         
@@ -192,11 +188,11 @@
         std::string s;
         raw_string_ostream os(s);
         
-        Ctx.getTranslationUnitDecl()->print(os);
+        MethodDecl->print(os);
         
         os.flush();
         
-        log->Printf("AST context before transforming:\n%s", s.c_str());
+        log->Printf ("Untransformed method AST:\n%s", s.c_str());
     }
     
     Stmt *method_body = MethodDecl->getBody();
@@ -209,7 +205,7 @@
     bool ret = SynthesizeBodyResult (compound_stmt,
                                      MethodDecl);
     
-    if (log)
+    if (log && log->GetVerbose())
     {
         std::string s;
         raw_string_ostream os(s);
@@ -218,7 +214,7 @@
         
         os.flush();
         
-        log->Printf("Transformed function AST:\n%s", s.c_str());
+        log->Printf("Transformed method AST:\n%s", s.c_str());
     }
     
     return ret;





More information about the lldb-commits mailing list