[PATCH] Defer codegen of dllexport/attribute(used) inline method definitions

Hans Wennborg hans at chromium.org
Thu Jun 5 16:16:31 PDT 2014


Hi rnk, rsmith,

We would previously fail to emit a definition of bar() for the following code:

  struct __declspec(dllexport) S {
    void foo() {
      t->bar();
    }
    struct T {
      void bar() {}
    };
    T *t;
  };

Note that foo() is an exported method, but bar() is not. However, foo() refers to bar() so we need to emit its definition. To make this work, we need to delay the codegen of foo() until the bodies of all the other inline methods have been parsed.

The same problem applies to inline methods that are marked used.

http://reviews.llvm.org/D4038

Files:
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  lib/CodeGen/ModuleBuilder.cpp
  test/CodeGenCXX/attr-used.cpp
  test/CodeGenCXX/dllexport-members.cpp
  test/CodeGenCXX/dllexport.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4038.10159.patch
Type: text/x-patch
Size: 5292 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140605/c40b36c8/attachment.bin>


More information about the cfe-commits mailing list