[PATCH] PR5172: Fix for a bug in pragma redefine_extname implementation.

Andrey Bokhanko andreybokhanko at gmail.com
Tue Jun 9 08:39:11 PDT 2015


On Mon, Jun 8, 2015 at 9:36 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> That looks fine (although perhaps keep the creation of the attribute outside
> the `if` so you don't need to duplicate it in both arms).

Fixed

>> > We should also filter out internal-linkage declarations and non-TU-scope
>> > declarations when we perform the deferred handling of
>> > `ExtnameUndeclaredIdentifiers` in `ActOnVariableDeclarator` and
>> > `ActOnFunctionDeclarator`.
>>
>>
>> This probably belongs to a separate patch (for starters, I don't have a
>> test demonstrating that compiler is currently acting incorrectly).
>
>
> That sounds fine. Here's a trivial testcase (it's easy to cook up more, the
> bug is quite blatant):
>
> #pragma redefine_extname foo bar
> int f() {
>   int foo = 0;
>   return foo;
> }
> int foo() { return 1; }

OK -- will look into it.

> Your current test passes for me without your patch, so you need to change it
> *somehow*.

Ouch... It fails in C++ mode only -- I copied my code to existing *.c
test and forget to check that it fails without the patch. :-(

Either way, this is fixed; please review updated patch:
http://reviews.llvm.org/D10187.

Yours,
Andrey



More information about the cfe-commits mailing list