This is an archive of the discontinued LLVM Phabricator instance.

Use the most recent previous decl to check if inline is added after a definition
ClosedPublic

Authored by rnk on Apr 7 2015, 9:30 AM.

Details

Summary

This affects this test case:

void foo();
template <typename T> class C {
  friend void foo();
};
inline void foo() {}
C<int> c;

Here, we instantiate the foo friend decl and add it to foo's redecl
chain. However, our previous decl pointer happens to reference the first
declaration of foo, which is not marked inline. When we check to see if
foo was already defined, we implicitly search all previous decls. We
should do the same for the inline check, instead of just checking this
particular previous decl.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk updated this revision to Diff 23344.Apr 7 2015, 9:30 AM
rnk retitled this revision from to Use the most recent previous decl to check if inline is added after a definition.
rnk updated this object.
rnk added a reviewer: rsmith.
rnk added a subscriber: Unknown Object (MLST).
rnk updated this revision to Diff 23367.Apr 7 2015, 1:58 PM
  • Add alternate test case not relying on r233817
rsmith accepted this revision.Apr 7 2015, 2:57 PM
rsmith edited edge metadata.

LGTM

This revision is now accepted and ready to land.Apr 7 2015, 2:57 PM
This revision was automatically updated to reflect the committed changes.