This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Make sure RegularExpression constructors always initialize member variables
ClosedPublic

Authored by jgorbe on May 23 2019, 11:36 AM.

Details

Summary

The copy constructor of RegularExpression doesn't initialize m_comp_err. This causes an use-of-initialized-value error when a RegularExpression is copied: the copy constructor calls Compile, which calls Free to free the existing regex if needed, which in turn reads m_comp_err to check if there's any regex to be freed.

This change calls the default constructor from the other constructors to make sure members are always initialized with sensible values. This also avoids duplicating init logic, like the RegularExpression(llvm:StringRef) constructor does, which is error prone.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

jgorbe created this revision.May 23 2019, 11:36 AM
jgorbe updated this revision to Diff 201029.May 23 2019, 11:38 AM

Fixed indentation.

clayborg accepted this revision.May 23 2019, 12:49 PM
This revision is now accepted and ready to land.May 23 2019, 12:49 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 23 2019, 1:11 PM