Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-kast inserts implicit calls to conversion functions #501

Open
h0nzZik opened this issue Jun 26, 2019 · 1 comment
Open

clang-kast inserts implicit calls to conversion functions #501

h0nzZik opened this issue Jun 26, 2019 · 1 comment

Comments

@h0nzZik
Copy link
Contributor

h0nzZik commented Jun 26, 2019

The clang-kast tools inserts calls to conversion functions. As an example, take the following program:

int rv = 0;

struct A{};
struct B : A{};

struct C {
	A a; B b;
	operator A(){rv=1; return a;}
	operator B(){rv=2; return b;}
};

int main() {
	C c;
	A ra = c; // here calls `C::operator A()`
	return rv;
}

The inserted call:

`CallExpr`(`ExprLoc`(`UnknownCabsLoc_COMMON-SYNTAX`(.KList),`MemberExpr`(#token("false","Bool"),#token("false","Bool"),`Name`(`NoNNS`(.KList),`TypeId`(`Name`(`NoNNS`(.KList),`Identifier`(#token("\"A\"","String"))))),`ExprLoc`(`CabsLoc`(...),`Name`(`NoNNS`(.KList),`Identifier`(#token("\"c\"","String")))))),`list`(kSeqToList(.K)),`krlist`(`.List`(.KList)))

We may be able to get rid of the call using [anywhere] rules in the same way we eliminate ConstructorCalls (here) - but we would need to somehow mark those calls in clang-kast. Also, maybe we could have a separate semantics that would just strip the AST we get from clang?

@dwightguth
Copy link
Member

let's not have a separate semantics as that considerably increases build times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants