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

Andrey Bokhanko andreybokhanko at gmail.com
Mon Jun 8 07:31:29 PDT 2015

In http://reviews.llvm.org/D10187#184399, @rsmith wrote:

> I think the right way to handle this would be to filter out declarations that are neither `FunctionDecl`s nor `VarDecl`s after performing the lookup. (According to the specification, we should also filter out declarations with internal linkage.)

OK -- I did as you suggested. Please review updated patch.

> 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 said, I'm not sure why your testcase was failing -- `LookupSingleName` in `LookupOrdinaryName` mode in C should not find tag names, so we should have deferred adding the attribute already. Is a `typedef` missing from the testcase, perhaps?

You mean modifying it like this:

typedef struct {

  int f;

} statvfs64;


Then compiler issue an error: "redefine_extname.c:10:5: error: redefinition of 'statvfs64' as different kind of symbol". No errors are issued in the original test.



More information about the cfe-commits mailing list