<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 10/15/2013 12:57 AM, Richard Smith
wrote:<br>
</div>
<blockquote
cite="mid:CAOfiQq=GDDuX_TypBxmF8VxCzj7ajZ-KRMP2xYnN7rkvZ-XxUQ@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div dir="ltr">On Thu, Oct 10, 2013 at 8:03 AM, Vassil Vassilev <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:vasil.georgiev.vasilev@cern.ch" target="_blank">vasil.georgiev.vasilev@cern.ch</a>></span>
wrote:<br>
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
Is there any particular reason
DeclContext::addHiddenDecl to not call
NamedDecl::setHidden() on the added declaration?<br>
</blockquote>
<div><br>
</div>
<div>Yes. addHiddenDecl doesn't make a declaration hidden,
it adds it without making it visible. This can be part of
the process of making a declaration visible... or not. It
doesn't make any sense for this to mark the declaration as
hidden. (Also, declarations marked as hidden are still in
the name lookup structures, so these mean different
things.)</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
It feels like an inconsistency to me, because one can
add a 'hidden' NamedDecl and later on to call removeDecl.
In that case the DeclContext would assert because the name
wasn't found in the lookup table. Is there something I
missed?</blockquote>
</div>
</div>
</div>
</blockquote>
Thanks for the clarification.<br>
<blockquote
cite="mid:CAOfiQq=GDDuX_TypBxmF8VxCzj7ajZ-KRMP2xYnN7rkvZ-XxUQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div><br>
</div>
<div>removeDecl is only used in very restricted
circumstances, so this isn't a problem in practice. Nor
does it check whether the declaration is marked as
'hidden' -- that doesn't affect whether the name appears
in the lookup table anyway, so wouldn't be a sensible
check.</div>
</div>
</div>
</div>
</blockquote>
In our context we use removeDecl a lot. For example, we need to
'rollback' for example the last 'n' decls. Thus for us the
consistency of that interface is very important.<br>
<br>
Independent on that that part of removeDecl is not very clear to me,
<br>
(DeclBase.cpp)01091 StoredDeclsMap *Map =
getPrimaryContext()->LookupPtr.getPointer();<br>
(DeclBase.cpp)01092 if (!Map) return;<br>
<br>
how that is supposed to work with out-of-line definitions, where the
primary context of the lexical context != primary context of the
'semantic'/'lookup' context. Eg:<br>
class MyClass {<br>
void f();<br>
}<br>
MyClass::f() {} // we want to remove that out-of-line definition.<br>
<br>
Shouldn't like 01091 be smth like: StoredDeclsMap *Map =
D->getDeclContext()->getPrimaryContext()->LookupPtr.getPointer();<br>
<br>
Many thanks,<br>
Vassil<br>
<br>
</body>
</html>