<div dir="ltr">I think making the assumption proposed by kcc@ is fine.  This kind of pattern of declaring a "global" in main and passing it through an entire application is common enough that don't think it would confuse anyone.  That said, if you think a little extra documentation would be helpful, a comment in main where it's declared wouldn't hurt.</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Dec 12, 2016 at 8:24 AM Marcos Pividori via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">mpividori added inline comments.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
================<br class="gmail_msg">
Comment at: lib/Fuzzer/FuzzerUtilWindows.cpp:30<br class="gmail_msg">
<br class="gmail_msg">
-LONG WINAPI SEGVHandler(PEXCEPTION_POINTERS ExceptionInfo) {<br class="gmail_msg">
+static struct {<br class="gmail_msg">
+   bool HandleAbrt = false;<br class="gmail_msg">
----------------<br class="gmail_msg">
mpividori wrote:<br class="gmail_msg">
> kcc wrote:<br class="gmail_msg">
> > mpividori wrote:<br class="gmail_msg">
> > > kcc wrote:<br class="gmail_msg">
> > > > mpividori wrote:<br class="gmail_msg">
> > > > > kcc wrote:<br class="gmail_msg">
> > > > > > Why do you need a copy of the flags?<br class="gmail_msg">
> > > > > @kcc,<br class="gmail_msg">
> > > > > We can't save a reference to Options, because we don't know when it will be destroyed. The ExceptionHandler() function must access to Handler option the entire life of the program.<br class="gmail_msg">
> > > > you can rely on this FuzzingOptions object to be live throughout the process.<br class="gmail_msg">
> > > @kcc I wanted to avoid that kind of assumptions. But if you prefer I can do that.....<br class="gmail_msg">
> > the options is a global scope object. It's not an assumption, it's a contract, all of the rest of the code rely on it.<br class="gmail_msg">
> @kcc , it is not strictly global, it is defined inside `FuzzerDriver()`. It will work fine now because we don't do anything after returning from `FuzzerDriver()`. In the future, if we change the code and do something else after executing `FuzzerDriver()` which generates an exception, we are in troubles. We must remember this assumption ....<br class="gmail_msg">
> Thanks,<br class="gmail_msg">
@zturner What is your opinion on this?<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Repository:<br class="gmail_msg">
  rL LLVM<br class="gmail_msg">
<br class="gmail_msg">
<a href="https://reviews.llvm.org/D27238" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D27238</a><br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
</blockquote></div>