This is an archive of the discontinued LLVM Phabricator instance.

use-after-dtor cmd option
ClosedPublic

Authored by nmusgrave on Jul 9 2015, 5:19 PM.

Details

Reviewers
kcc
eugenis
Summary

Initial commit: added new command line option for use-after-dtor.

Diff Detail

Event Timeline

nmusgrave updated this revision to Diff 29413.Jul 9 2015, 5:19 PM
nmusgrave retitled this revision from to use-after-dtor cmd option.
nmusgrave updated this object.
nmusgrave added a reviewer: eugenis.
nmusgrave added a subscriber: llvm-commits.
eugenis updated this object.Jul 9 2015, 5:37 PM
eugenis added a reviewer: kcc.
eugenis edited edge metadata.
eugenis edited subscribers, added: cfe-commits; removed: llvm-commits.

I suspect this does not do anything because you need to pass the flag from the driver to the compiler.
Compare with this change:
http://llvm.org/viewvc/llvm-project?view=revision&revision=219417

Please add a test, similar to r219417.

include/clang/Driver/Options.td
558

Move it below fno_sanitize_memory_track_origins

include/clang/Frontend/CodeGenOptions.def
115

"2" should be "1", this is just a bool flag

lib/CodeGen/CGClass.cpp
1461 ↗(On Diff #29413)

EmitDtorPoisoning
But better remove this for now and add a real implementation in another changelist.

nmusgrave updated this revision to Diff 29414.Jul 9 2015, 6:18 PM
nmusgrave edited edge metadata.
  • added in driver support for cmd-line use-after-dtor option
nmusgrave updated this revision to Diff 29415.Jul 9 2015, 6:31 PM
  • added in simple test case for use-after-dtor cmd line option
eugenis added inline comments.Jul 9 2015, 10:09 PM
lib/CodeGen/CGClass.cpp
1459 ↗(On Diff #29415)

Please remove this block completely. It does nothing.

lib/Driver/SanitizerArgs.cpp
420

It looks like this variable is only assigned but never read.

test/Driver/fsanitize.c
126

remove "-0"

nmusgrave updated this revision to Diff 29451.Jul 10 2015, 9:38 AM
nmusgrave marked 2 inline comments as done.

revising CL:

  • updated test, removed unnecessary block from code gen
eugenis added inline comments.Jul 10 2015, 11:55 AM
test/Driver/fsanitize.c
126

This test is passing because this CHECK matches the following output:
clang-3.7: warning: argument unused during compilation: '-fsanitize-memory-use-after-dtor'

The CHECK could be improved like this:
-cc1{{.*}}-fsanitize-memory-use-after-dtor

And then it will fail because you are not passing the option to the compiler (see SanitizerArgs.cpp:569).

nmusgrave updated this revision to Diff 29472.Jul 10 2015, 12:23 PM
nmusgrave marked an inline comment as done.
  • adjusted test to fail unused cmd notification, updated setting flag
eugenis accepted this revision.Jul 10 2015, 12:28 PM
eugenis edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jul 10 2015, 12:28 PM
nmusgrave updated this revision to Diff 29476.Jul 10 2015, 12:54 PM
nmusgrave marked 2 inline comments as done.
nmusgrave edited edge metadata.
  • rm linter
  • fixed test regex
eugenis closed this revision.Jul 10 2015, 1:07 PM

Committed as r241935.