This is an archive of the discontinued LLVM Phabricator instance.

Emit used/dllexport inline method definitions in nested classes (PR19743, PR11170)
ClosedPublic

Authored by hans on May 16 2014, 11:09 AM.

Details

Summary

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;

}

Diff Detail

Repository
rL LLVM

Event Timeline

hans updated this revision to Diff 9492.May 16 2014, 11:09 AM
hans retitled this revision from to Emit used/dllexport inline method definitions in nested classes (PR19743, PR11170).
hans updated this object.
hans edited the test plan for this revision. (Show Details)
hans added reviewers: rsmith, rnk.
hans added subscribers: Unknown Object (MLST), hansw.
rnk accepted this revision.May 22 2014, 4:52 PM
rnk edited edge metadata.

lgtm

This seems exactly in line with Richard's suggested direction.

This revision is now accepted and ready to land.May 22 2014, 4:52 PM
hans closed this revision.May 23 2014, 1:45 PM
hans updated this revision to Diff 9777.

Closed by commit rL209549 (authored by @hans).