<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">//===----------------------------------------------------------------------===//<br>
// FalseParser<br>
//===----------------------------------------------------------------------===//<br>
class FalseParser : public parser<bool> {<br>
public:<br>
explicit FalseParser(Option &O) : parser<bool>(O) { }<br>
<br>
// parse - Return true on error.<br>
bool parse(cl::Option& O, StringRef ArgName, StringRef Arg,
bool& Val) {<br>
if (cl::parser<bool>::parse(O, ArgName, Arg, Val))<br>
return false;<br>
Val = false;<br>
return false;<br>
}<br>
};<br>
<br>
I don't know the history of this. I'm just starting to do some
mclinker work to add the new mips r6 relocations to it.<br>
<br>
On 03/18/2015 07:00 PM, David Blaikie wrote:<br>
</div>
<blockquote
cite="mid:CAENS6Ev41qQ01xF8Ux3DmvcRo6VL4xXcWkcNXiM6VyMMZapUiQ@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div dir="ltr"><br>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Mar 18, 2015 at 6:48 PM, reed
kotler <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:rkotler@mips.com" target="_blank">rkotler@mips.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi
David,<br>
<br>
Is there a reason that we need to have "final" for
parser<bool> ???<br>
</blockquote>
<div><br>
Clang has a (reasonable) warning for types with virtual
functions and a non-virtual dtor. This warning is
suppressed if the dtor is protected or the class is final
(since in the first case it's clear that the user intends
not to destroy objects via base pointers, only derived
ones - and in the second case there's no risk of derived
classes, so public access to the dtor is safe even without
virtual dispatch.<br>
<br>
Since the parser hierarchy never needed polymorphic
destruction (all instances are concrete instances of
derived classes owned and destroyed directly, not via base
pointers) this seemed like a fine way to structure the
API.<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">This
breaks the compilation of mclinker which derives a class
from this.<br>
<br>
In file included from /home/rkotler/workspace/mclinker/lib/Support/CommandLine.cpp:9:0:<br>
/home/rkotler/workspace/mclinker/include/mcld/Support/CommandLine.h:49:7:
error: cannot derive from ‘final’ base
‘llvm::cl::parser<bool>’ in derived type
‘llvm::cl::FalseParser’<br>
</blockquote>
<div><br>
Why is it being derived from? If it's just a typedef
that's required, it might be more appropriate to use a
typedef instead of derivation.<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
make[2]: *** [Support/CommandLine.o] Error 1<br>
make[2]: Leaving directory `/home/rkotler/mclinker_build/lib'<br>
make[1]: *** [all] Error 2<br>
make[1]: Leaving directory `/home/rkotler/mclinker_build/lib'<br>
make: *** [all-recursive] Error 1<span class="HOEnZb"><font
color="#888888"><br>
<br>
<br>
<br>
Reed<br>
</font></span></blockquote>
</div>
<br>
</div>
</div>
</blockquote>
<br>
</body>
</html>