This is an archive of the discontinued LLVM Phabricator instance.

Start reifying error descriptions
ClosedPublic

Authored by filcab on Aug 18 2016, 9:07 AM.

Details

Summary

This commit sets up the infrastructure to use reified error
descriptions, and moves ReportStackOverflow to the new system.

After we convert all the errors, we'll be able to simplify ScopedInErrorReport
and remove the older debugging mechanism which had some errors partly reified
in some way. We'll be able to maintain the external API.

ScopedInErrorReport will be able to track one of the reified errors at a time.
The purpose of this is so we have its destructor actually print the error and
possibly interface with the debugger (will depend on the platform, of course).

Diff Detail

Repository
rL LLVM

Event Timeline

filcab updated this revision to Diff 68552.Aug 18 2016, 9:07 AM
filcab retitled this revision from to Start reifying error descriptions.
filcab updated this object.
filcab added reviewers: kcc, samsonov, timurrrr.
filcab added a subscriber: llvm-commits.
filcab updated this revision to Diff 68697.Aug 19 2016, 8:46 AM

Use member initializers;
Remove dead code per Timothy Wood's review (off-list).

kcc added inline comments.Aug 19 2016, 11:15 AM
lib/asan/asan_errors.h
51 ↗(On Diff #68697)

Errr. This looks like a part of change...
What's going to be next?
And why enum? Can we use C++ here (inheritance)?

filcab added inline comments.Aug 19 2016, 11:21 AM
lib/asan/asan_errors.h
51 ↗(On Diff #68697)

D23717 has an example of an addition to this. The next errors will add to that union, I tried minimizing the change, while keeping what we'll have later, like that union.

I'd rather avoid inheritance + virtual functions since that makes the type non-trivially copiable. I would like to have the same structures internally + externally. This way, the debugger can simply copy over the current_error_ on ScopedInErrorReport and not need to call any functions on the target. This also allows for easy embedding in core dumps.

We *can* have the virtual functions + etc internally, and then have ASan convert to an external representation, but I don't think it's worth it. It would be a lot more code than a tagged union like we have.

filcab updated this revision to Diff 68965.Aug 23 2016, 4:09 AM

Add NOLINT and clang-format

filcab updated this revision to Diff 69234.Aug 25 2016, 6:30 AM

Use a const ref

D23875 will help dealing with the tagged enum.

kcc added inline comments.Aug 25 2016, 5:35 PM
lib/asan/asan_errors.h
52 ↗(On Diff #69234)

At the very least -- move this paragraph into a comment.

lib/asan/asan_report.cc
311 ↗(On Diff #69234)

use CHECK_EQ

filcab updated this revision to Diff 69351.Aug 26 2016, 5:23 AM
filcab marked 2 inline comments as done.

Addressed review comments

kcc added inline comments.Aug 26 2016, 9:58 AM
lib/asan/asan_errors.h
50 ↗(On Diff #69351)

Sorry, I did not mean to literally copy the discussion into the comments.
The comment should not be in a form of discussion, but in a form of statement.

// We do X because Y and Z

filcab updated this revision to Diff 69398.Aug 26 2016, 10:27 AM
filcab marked an inline comment as done.

Rephrase comment.

lib/asan/asan_errors.h
50 ↗(On Diff #69351)

Wow, that was especially lazy. I've rewritten the comment now. I think it contains the main points.

kcc accepted this revision.Aug 26 2016, 10:56 AM
kcc edited edge metadata.

LGTM with a nit.
Please ping the next change that you want me to review

lib/asan/asan_errors.h
50 ↗(On Diff #69398)

don't include the user name here (that's not a TODO)

This revision is now accepted and ready to land.Aug 26 2016, 10:56 AM
This revision was automatically updated to reflect the committed changes.