[PATCH] D54667: [CodeView] Emit proper debug info for ref-qualified member functions
Andrew Kelley via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 26 17:55:34 PST 2018
andrewrk added a comment.
In D54667#1340985 <https://reviews.llvm.org/D54667#1340985>, @rnk wrote:
> We can change the code to avoid the crash, but what debug info did you want clang to emit? It seems like the best way to describe StructWithNoFields_add is as a static method of the class StructWithNoFields, since it doesn't appear to have a 'this' parameter.
Thanks for the fix!
I think that is a good way to emit debug info. Here's the code from the frontend:
const StructWithNoFields = struct {
fn add(a: i32, b: i32) i32 {
return a + b;
}
};
test "call struct static method" {
const result = StructWithNoFields.add(3, 4);
assert(result == 7);
}
In Zig, a struct acts as a namespace full of static functions, so what you said works perfectly.
I'm also open for suggestions if there was a better way to represent this in LLVM's debug info.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54667/new/
https://reviews.llvm.org/D54667
More information about the llvm-commits
mailing list