]> granicus.if.org Git - clang/commit
Defer codegen of inline method definitions to the end of current top level declaration
authorHans Wennborg <hans@hanshq.net>
Fri, 6 Jun 2014 17:36:17 +0000 (17:36 +0000)
committerHans Wennborg <hans@hanshq.net>
Fri, 6 Jun 2014 17:36:17 +0000 (17:36 +0000)
commit8cf6d63a853e8f59df80b97c941b2162752d0c68
tree96e45075c1268d5bb7e8750bc95d81ff890b5ff5
parent150a4989ecf988595f80809abf84835c9625b33c
Defer codegen of inline method definitions to the end of current top level declaration

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. We would previously fail to
realise that bar() is used.

By deferring the method definitions until the end of the top level declaration,
we can simply call EmitTopLevelDecl on them and rely on the usual mechanisms
to decide whether the method should be emitted or not.

Differential Revision: http://reviews.llvm.org/D4038

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210356 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/ModuleBuilder.cpp
test/CodeGenCXX/attr-used.cpp
test/CodeGenCXX/dllexport-members.cpp
test/CodeGenCXX/dllexport.cpp