This is an archive of the discontinued LLVM Phabricator instance.

Add support for __attribute__(trivial_abi)
ClosedPublic

Authored by jingham on Mar 22 2018, 6:06 PM.

Details

Reviewers
aprantl
labath
Summary

clang added support for the "trivial_abi" which allows structs that would usually be passed in memory in C++ to be passed in registers instead.

This patch reads in the DWARF attribute that specifies a data type is using this ABI, and marks the Clang type appropriately.

It also adds the decorator goo to skip the test if the compiler doesn't support this attribute.

It also adds a test that tests that we can handle the same struct with and without this attribute in the expression parser and can fetch the return value for it properly. Ironically, the lldb return value code for x86_64 only uses struct size & alignment to tell it how structs would be returned. By that computation this struct should have been returned in registers. So the part of the test handling the non-trivial return is xfailed.

Diff Detail

Repository
rL LLVM

Event Timeline

jingham created this revision.Mar 22 2018, 6:06 PM

Pavel, I added you mostly because I'm new to this decorator magic and I wanted to have another pair of eyes to make sure I did that right.

aprantl accepted this revision.Mar 22 2018, 6:54 PM
aprantl added inline comments.
packages/Python/lldbsuite/test/decorators.py
667

Neat!

source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
1011

That is reasonable.

This revision is now accepted and ready to land.Mar 22 2018, 6:54 PM
jingham added inline comments.Mar 23 2018, 12:40 PM
packages/Python/lldbsuite/test/decorators.py
667

Credit where it's due: that's an extension of Kuba's trick for checking for the presence of sanitizers.

jingham closed this revision.Mar 23 2018, 4:48 PM

Checked in as r328389.

Pavel, I added you mostly because I'm new to this decorator magic and I wanted to have another pair of eyes to make sure I did that right.

The decorator looks fine. I think most tests use the from lldbsuite.test.decorators import * + @myDecorator pattern because it's shorter, but I don't think that matters.

Pavel, I added you mostly because I'm new to this decorator magic and I wanted to have another pair of eyes to make sure I did that right.

The decorator looks fine.

Actually, I spoke too soon. The popen invocation was a bit too posix-y for windows to handle. r328489 should fix that.

Thanks for fixing that!

Jim