[cfe-dev] Sema && redefinitions

Anton Korobeynikov asl at math.spbu.ru
Fri Dec 5 10:31:55 PST 2008


Hi, Douglas

> At #3, we merge the dllimport from #2 into #3, so #3 has the dllimport
> attribute. #3's getPreviousDeclaration() link back to #2.
The problem is that we need to separate two cases:

1.
void foo() __attribute__((dllimport));
void foo() {}

This is legal, we need just to ignore dllimport attribute and issue a warning

2. void foo() __attribute__((dllimport)) {}

This is hard error.

At the point, when attributes were merged, we cannot distinguish cases
1 and 2 and I feel pretty bad into adding something 'custom' inside
merging logic...

> So, from the point where you hit the definition, you can walk the
> getPreviousDeclaration() chain back until you find the declaration
> that either has no previous declaration or whose previous declaration
> does not have the attribute.
Right, but this won't give anything to us, see example above.

-- 
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University



More information about the cfe-dev mailing list