[PATCH] Emit used/dllexport inline method definitions in nested classes (PR19743, PR11170)

Hans Wennborg hans at chromium.org
Fri May 16 11:09:47 PDT 2014


Hi rsmith, rnk,

The previous code that was supposed to handle this didn't work since parsing of inline method definitions is delayed to the end of the outer class definition. Thus, when HandleTagDeclDefinition() got called for the inner class, the inline functions in that class had not been parsed yet.

Richard suggested that the way to do this is by handling inline method definitions through a new ASTConsumer callback.

I really wanted to call ASTContext::DeclMustBeEmitted() instead of checking for attributes, but doing that causes us to compute linkage, and then we fail with "error: unsupported: typedef changes linkage of anonymous type, but linkage was already computed" on tests like this: (from SemaCXX/undefined-internal.cpp) :-/

namespace test7 {
  typedef struct {
    void bar();
    void foo() {
      bar();
    }
  } A;
}

http://reviews.llvm.org/D3809

Files:
  include/clang/AST/ASTConsumer.h
  include/clang/Frontend/MultiplexConsumer.h
  include/clang/Sema/Sema.h
  lib/CodeGen/CodeGenAction.cpp
  lib/CodeGen/ModuleBuilder.cpp
  lib/Frontend/MultiplexConsumer.cpp
  lib/Parse/ParseCXXInlineMethods.cpp
  lib/Sema/SemaDecl.cpp
  test/CodeGenCXX/attr-used.cpp
  test/CodeGenCXX/dllexport.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3809.9492.patch
Type: text/x-patch
Size: 7500 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140516/52137e10/attachment.bin>


More information about the cfe-commits mailing list