This is an archive of the discontinued LLVM Phabricator instance.

Safer casting in ClangExpressionParser code completion
ClosedPublic

Authored by teemperor on Mar 14 2019, 5:38 AM.

Details

Summary

Makes the code a bit safer in the unlikely situation that we don't get a ClangUserExpression
when doing code completion.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

teemperor created this revision.Mar 14 2019, 5:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 14 2019, 5:38 AM
labath added a subscriber: labath.Mar 14 2019, 6:10 AM
labath added inline comments.
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
860–861 ↗(On Diff #190603)

These two lines are equivalent to auto *llvm_expr = cast<ClangUserExpression>(&m_expr);

teemperor updated this revision to Diff 190612.Mar 14 2019, 6:38 AM
  • Changed to llvm::cast (even though the assert message is a bit generic now).
aprantl accepted this revision.Mar 14 2019, 9:31 AM
This revision is now accepted and ready to land.Mar 14 2019, 9:31 AM
This revision was automatically updated to reflect the committed changes.