This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] DynamicTypeInfo: Simplify the API
AcceptedPublic

Authored by Charusso on Sep 30 2019, 1:35 AM.

Details

Reviewers
NoQ
Summary

DynamicTypeInfo -> Optional<DynamicTypeInfo>,
which removes the method bool isValid().

Diff Detail

Event Timeline

Charusso created this revision.Sep 30 2019, 1:35 AM
Charusso retitled this revision from [analyzer] DynamicTypeInfo: Simplify the API. to [analyzer] DynamicTypeInfo: Simplify the API.Sep 30 2019, 1:37 AM
NoQ added a comment.Sep 30 2019, 12:58 PM

I actually like the idea, it makes it consistent with other maps. But you'll need to clean up memory management here. Given that you can't modify the state in getDynamicTypeInfo(), i guess you'll have to resort to smart pointers.

clang/lib/StaticAnalyzer/Core/DynamicType.cpp
53–57

Do i have to do a delete manually every time i call this function?

96

Who is responsible for deallocating this memory?

Charusso updated this revision to Diff 222927.Oct 2 2019, 4:08 PM
Charusso edited the summary of this revision. (Show Details)
  • No comment.
Charusso marked 3 inline comments as done.Oct 2 2019, 4:10 PM

Sorry, I was sure it is working as expected.

clang/lib/StaticAnalyzer/Core/DynamicType.cpp
53–57

Well, from now you do not.

NoQ accepted this revision.Oct 2 2019, 4:13 PM

Yup, optional sounds perfect.

This revision is now accepted and ready to land.Oct 2 2019, 4:13 PM