Author: Raphael Isemann
Date: 2020-02-12T11:22:56+01:00
New Revision: 320647c02ae9827cae0824c6aec2bcdfcf482e44

URL: 
https://github.com/llvm/llvm-project/commit/320647c02ae9827cae0824c6aec2bcdfcf482e44
DIFF: 
https://github.com/llvm/llvm-project/commit/320647c02ae9827cae0824c6aec2bcdfcf482e44.diff

LOG: [lldb] Pass a valid SourceLocation to Sema::RequireCompleteType in 
ASTResultSynthesizer

Sema::RequireCompleteTypeImpl is supposed to have an assert that checks that the
SourceLocation that is passed in is always valid. It's currently commented out, 
but
as soon as this assert goes active, nearly every LLDB expression will start 
crashing as
we always pass in an invalid SourceLocation from the ASTResultSynthesizer.

This patch just passes in the valid SourceLocation of the expression (which is
the SourceLocation where the complete type is required) to prevent that from 
happening.

Added: 
    

Modified: 
    lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp

Removed: 
    


################################################################################
diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
index f0e1b5dd1d02..bd705af0efcd 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
@@ -325,7 +325,8 @@ bool 
ASTResultSynthesizer::SynthesizeBodyResult(CompoundStmt *Body,
     else
       result_ptr_id = &Ctx.Idents.get("$__lldb_expr_result_ptr");
 
-    m_sema->RequireCompleteType(SourceLocation(), expr_qual_type,
+    m_sema->RequireCompleteType(last_expr->getSourceRange().getBegin(),
+                                expr_qual_type,
                                 clang::diag::err_incomplete_type);
 
     QualType ptr_qual_type;


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to