This is an archive of the discontinued LLVM Phabricator instance.

[MS ABI] Implement more of the Itanium mangling rules
ClosedPublic

Authored by majnemer on Nov 29 2016, 1:53 PM.

Details

Summary

We didn't implement one of the corner cases: a lambda which belongs to
an initializer for a field. In this case, we need to mangle the field
name into the lambda.

This fixes PR31197.

Diff Detail

Repository
rL LLVM

Event Timeline

majnemer updated this revision to Diff 79636.Nov 29 2016, 1:53 PM
majnemer retitled this revision from to [MS ABI] Implement more of the Itanium mangling rules.
majnemer updated this object.
majnemer added a reviewer: rnk.
majnemer added a subscriber: cfe-commits.
rnk added inline comments.Nov 29 2016, 4:50 PM
test/CodeGenCXX/mangle-ms-cxx11.cpp
337 ↗(On Diff #79636)

This machinery is also supposed to kick in for lambdas in default arguments, right? Can you add that test case?

majnemer updated this revision to Diff 79837.Nov 30 2016, 4:08 PM
  • Address review comments
rnk added inline comments.Nov 30 2016, 4:22 PM
lib/AST/MicrosoftMangle.cpp
838 ↗(On Diff #79837)

Isn't this no good if I have two lambdas in one default arg?

inline int f(int x = [] { return 1; }() + [] { return 2; }()) { return x; }
int main() { return f(); }

We probably need <lambda_${argno}_${id}>. =/

majnemer updated this revision to Diff 79848.Nov 30 2016, 5:49 PM
majnemer marked an inline comment as done.
  • Address review comments
majnemer updated this revision to Diff 80096.Dec 2 2016, 10:39 AM
  • Simplify the mangling a little bit
rnk accepted this revision.Dec 6 2016, 9:04 AM
rnk edited edge metadata.

lgtm Thanks, apologies for the scope creep.

This revision is now accepted and ready to land.Dec 6 2016, 9:04 AM
This revision was automatically updated to reflect the committed changes.