Page MenuHomePhabricator

Fix an invalid static cast in ClangExpressionParser.cpp
ClosedPublic

Authored by aprantl on Mar 13 2019, 11:33 AM.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

aprantl created this revision.Mar 13 2019, 11:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 13 2019, 11:33 AM
aprantl updated this revision to Diff 190460.Mar 13 2019, 11:34 AM

I think you have to protect against your dyn_cast failing.

lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
495 ↗(On Diff #190460)

Don't you need to check the result of the dyn_cast?

aprantl updated this revision to Diff 190470.Mar 13 2019, 12:20 PM

Excellent point!

aprantl marked an inline comment as done.Mar 13 2019, 12:20 PM

Also naming quibble...

lldb/include/lldb/Expression/Expression.h
38 ↗(On Diff #190460)

I don't think we use this naming for enum's anywhere. Since this is in the expression class, you don't need the EK. For the equivalent classof enum for ThreadPlans I use:

typedef enum {
  eKindGeneric,
  eKindNull,
  eKindBase,
  eKindCallFunction,
  eKindPython,
  eKindStepInstruction,
  etc...

This is inside a class so you don't need to namespace the enum name like we do with more general enums.

aprantl updated this revision to Diff 190476.Mar 13 2019, 12:36 PM

Renamed enumerators.

This revision was not accepted when it landed; it landed in state Needs Review.Mar 13 2019, 12:46 PM
Closed by commit rLLDB356090: Fix an invalid static cast in ClangExpressionParser.cpp (authored by adrian, committed by ). · Explain Why
This revision was automatically updated to reflect the committed changes.