This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Fix a crash for raw-string-literal check.
ClosedPublic

Authored by hokein on May 19 2021, 6:37 AM.

Details

Summary

getSourceText could return an empty string for error cases (e.g. invalid
source locaiton), this patch makes the code more robust.

The crash did happen in our internal codebase, but unfortunately I
didn't manage to get a reproduce case. One thing I can confirm from
the core dump is that the crash is caused by calling isRawStringLiteral
on an empty Text.

Diff Detail

Event Timeline

hokein created this revision.May 19 2021, 6:37 AM
hokein requested review of this revision.May 19 2021, 6:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2021, 6:38 AM
gribozavr2 accepted this revision.May 19 2021, 7:24 AM
This revision is now accepted and ready to land.May 19 2021, 7:24 AM
This revision was automatically updated to reflect the committed changes.