This is an archive of the discontinued LLVM Phabricator instance.

SanitizerCoverage: Use `createSanitizerCtor` to create ctor and call init
ClosedPublic

Authored by ismailp on Apr 1 2015, 9:53 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

ismailp updated this revision to Diff 23072.Apr 1 2015, 9:53 AM
ismailp retitled this revision from to SanitizerCoverage: Use `createSanitizerCtor` to create ctor and call init.
ismailp updated this object.
ismailp edited the test plan for this revision. (Show Details)
ismailp added reviewers: kcc, samsonov.
ismailp added a subscriber: Unknown Object (MLST).
samsonov added inline comments.May 1 2015, 12:30 PM
lib/Transforms/Instrumentation/SanitizerCoverage.cpp
163 ↗(On Diff #23072)

Isn't this function supposed to be created in createSanitizerCtor?

ismailp added inline comments.May 2 2015, 3:25 PM
lib/Transforms/Instrumentation/SanitizerCoverage.cpp
163 ↗(On Diff #23072)

Good catch, thanks! I will include it in the next revision. It needs a test to check init function is called from module ctor, as well as renaming createSanitizerCtor below.

ismailp updated this revision to Diff 25227.May 7 2015, 1:39 PM
  • createSanitizerCtor renamed to createSanitizerCtorAndInitFunctions to match with changes in D8777
  • SanCovModuleInit was initialized with checkInterfaceFunction by mistake; this is already done by createSanitizerCtorAndInitFunctions

Turns out, there is already a test checking module ctor, and call to init function, in test/Instrumentation/SanitizerCoverage/coverage.ll.

samsonov accepted this revision.May 7 2015, 2:31 PM
samsonov edited edge metadata.

LGTM

lib/Transforms/Instrumentation/SanitizerCoverage.cpp
271 ↗(On Diff #25227)

No need to initialize this variable, as it should be initialized by subsequent call.

272 ↗(On Diff #25227)

Note that SanCovModuleInit is not used anywhere, maybe you can also turn it into a local variable, and delete the class member?

This revision is now accepted and ready to land.May 7 2015, 2:31 PM
samsonov added inline comments.May 7 2015, 2:34 PM
lib/Transforms/Instrumentation/SanitizerCoverage.cpp
272 ↗(On Diff #25227)

(or just use std::ignore)

Thank you for your time, and feedback.

It seems like we can remove SanCovModuleInit.

This revision was automatically updated to reflect the committed changes.