This revision was automatically updated to reflect the committed changes. Closed by commit rLLDB356174: Safer casting in ClangExpressionParser code completion (authored by teemperor, committed by ).
Changed prior to commit: https://reviews.llvm.org/D59359?vs=190612&id=190664#toc Repository: rLLDB LLDB CHANGES SINCE LAST ACTION https://reviews.llvm.org/D59359/new/ https://reviews.llvm.org/D59359 Files: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -857,8 +857,8 @@ // To actually get the raw user input here, we have to cast our expression to // the LLVMUserExpression which exposes the right API. This should never fail // as we always have a ClangUserExpression whenever we call this. - LLVMUserExpression &llvm_expr = *static_cast<LLVMUserExpression *>(&m_expr); - CodeComplete CC(request, m_compiler->getLangOpts(), llvm_expr.GetUserText(), + ClangUserExpression *llvm_expr = cast<ClangUserExpression>(&m_expr); + CodeComplete CC(request, m_compiler->getLangOpts(), llvm_expr->GetUserText(), typed_pos); // We don't need a code generator for parsing. m_code_generator.reset();
Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -857,8 +857,8 @@ // To actually get the raw user input here, we have to cast our expression to // the LLVMUserExpression which exposes the right API. This should never fail // as we always have a ClangUserExpression whenever we call this. - LLVMUserExpression &llvm_expr = *static_cast<LLVMUserExpression *>(&m_expr); - CodeComplete CC(request, m_compiler->getLangOpts(), llvm_expr.GetUserText(), + ClangUserExpression *llvm_expr = cast<ClangUserExpression>(&m_expr); + CodeComplete CC(request, m_compiler->getLangOpts(), llvm_expr->GetUserText(), typed_pos); // We don't need a code generator for parsing. m_code_generator.reset();
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits