[PATCH] PR23923: "redefine_extname" pragma handled incorrectly in case of a local var with the same name

Andrey Bokhanko andreybokhanko at gmail.com
Wed Jun 24 03:47:40 PDT 2015


Aaron,

On Tue, Jun 23, 2015 at 7:32 PM, Aaron Ballman <aaron.ballman at gmail.com> wrote:
> I wasn't envisioning something like this. I was thinking something more like:
>
> bool Decl::isExternallyAvailable() const; // Probably a terrible name
>
> That then gets called from SemaDecl.cpp.
>
> If that API is too specific for a Decl, then it would make more sense
> as a helper function in SemaDecl.cpp.

OK, I moved checks to a static helper named
"isDeclTUScopedExternallyVisible". As its name suggests, it checks
that a declaration both externally visible *and* belongs to TU scope
-- and yes, this check indeed probably too specific for a Decl method.

> Also, no need for it to be a
> templated function if we go this route.

isExternC declared separately in FunctionDecl and VarDecl classes --
thus, I have either use templates or dynamic casts (as I do in updated
patch).

(Not sure why is isExternC can't be moved to Decl -- but being a
relative neophyte in Clang hacking, it feels a bit scary for me to
decide on what belongs where. If you think it would be reasonable, I
can move isExternC to Decl and get rid of casts.)

Patch updated; please re-review.

Andrey



More information about the cfe-commits mailing list