[cfe-commits] r158683 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExpr.cpp test/Sema/inline.c test/SemaCXX/inline.cpp

Chandler Carruth chandlerc at google.com
Wed Jun 20 02:23:02 PDT 2012


On Wed, Jun 20, 2012 at 12:51 AM, Chandler Carruth <chandlerc at google.com>wrote:

> On Mon, Jun 18, 2012 at 3:09 PM, Jordan Rose <jordan_rose at apple.com>wrote:
>
>> Author: jrose
>> Date: Mon Jun 18 17:09:19 2012
>> New Revision: 158683
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=158683&view=rev
>> Log:
>> Support -Winternal-linkage-in-inline in C++ code.
>>
>> This includes treating anonymous namespaces like internal linkage, and
>> allowing
>> const variables to be used even if internal. The whole thing's been
>> broken out
>> into a separate function to avoid nested ifs.
>>
>
I also think this warning may be firing erroneously on some code in Clang:

../tools/clang/lib/AST/Type.cpp:2020:50: warning: function 'getVisibility'
is in an anonymous namespace but is used in an inline method with external
linkage [-Winternal-linkage-in-inline]
           T->TypeBits.getVisibility() == Result.getVisibility());
                                                 ^
/usr/include/assert.h:89:5: note: expanded from macro 'assert'
  ((expr)                                                               \
    ^
../tools/clang/lib/AST/Type.cpp:1964:14: note: 'getVisibility' declared here
  Visibility getVisibility() const { return LV.visibility(); }
             ^
1 warning generated.


Here, 'getVisibility' is certainly in an anonymous namespace, and one might
expect the function on line 2020 to have external linkage, but in fact this
line is inside of a template, and that template is only ever instantiated
with type parameters which have internal linkage, so I would expect all of
that templates methods etc to also only have internal linkage in the final
binary?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120620/d453286e/attachment.html>


More information about the cfe-commits mailing list