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

Handle the CXXDependentScopeMemberExpr here. #7

Closed
wants to merge 2 commits into from

Conversation

wilsonk
Copy link

@wilsonk wilsonk commented Apr 11, 2015

This is quite similar to DependentDeclRefExpr. Compiles a couple of iterator uses for std::array now.

@Syniurge
Copy link
Owner

From the look of Sema::ActOnMemberAccessExpr which calls Sema::ActOnDependentMemberExpr which in turn calls CXXDependentScopeMemberExpr::Create:

/// The main callback when the parser finds something like
/// expression . [nested-name-specifier] identifier
/// expression -> [nested-name-specifier] identifier
/// where 'identifier' encompasses a fairly broad spectrum of
/// possibilities, including destructor and operator references.

The real expression seems to be:

CXXDependentScopeMemberExpr::getBase() | . or -> depending on isArrow() | getQualifier() (may be null) | getMember() | getExplicitTemplateArgs()

If the member has a NNS I think you can append it to the base expression with DotTypeExp (and you could add the member name to the NNS with TypeQualifed::addIdent)

BTW I just figured this out while checking occurrences of CXXDependentScopeMemberExpr in Sema so there so there may be other similar Expr which are being mapped incorrectly.

Could you fix it for CXXDependentScopeMemberExpr before the pull?

@wilsonk
Copy link
Author

wilsonk commented Apr 11, 2015

Hello Elie,

Yes, I’ll change things here and update the PR.

Thanks,

Kelly

From: Elie Morisse [mailto:[email protected]]
Sent: Saturday, April 11, 2015 9:22 AM
To: Syniurge/Calypso
Cc: wilsonk
Subject: Re: [Calypso] Handle the CXXDependentScopeMemberExpr here. (#7)

From the look of Sema::ActOnMemberAccessExpr which calls Sema::ActOnDependentMemberExpr which in turn calls CXXDependentScopeMemberExpr::Create:

/// The main callback when the parser finds something like
/// expression . [nested-name-specifier] identifier
/// expression -> [nested-name-specifier] identifier
/// where 'identifier' encompasses a fairly broad spectrum of
/// possibilities, including destructor and operator references.

The real expression seems to be:

CXXDependentScopeMemberExpr::getBase() | . or -> depending on isArrow() | getQualifier() (may be null) | getMember() | getExplicitTemplateArgs()

If the member has a NNS I think you can append it to the base expression with DotTypeExp (and you could add the member name to the NNS with TypeQualifed::addIdent)

BTW I just figured this out while checking occurrences of CXXDependentScopeMemberExpr in Sema so there so there may be other similar Expr which are being mapped incorrectly.

Could you fix it for CXXDependentScopeMemberExpr before the pull?


Reply to this email directly or view it on GitHub #7 (comment) .

@wilsonk
Copy link
Author

wilsonk commented Apr 14, 2015

Hello Elie,

I forgot to send an email when I pushed a fix for this yesterday. Not sure if it is correct, though. I pushed another small PR for type mapping VectorType and it reminded of this.

Thanks,

Kelly

From: Elie Morisse [mailto:[email protected]]
Sent: Saturday, April 11, 2015 9:22 AM
To: Syniurge/Calypso
Cc: wilsonk
Subject: Re: [Calypso] Handle the CXXDependentScopeMemberExpr here. (#7)

From the look of Sema::ActOnMemberAccessExpr which calls Sema::ActOnDependentMemberExpr which in turn calls CXXDependentScopeMemberExpr::Create:

/// The main callback when the parser finds something like
/// expression . [nested-name-specifier] identifier
/// expression -> [nested-name-specifier] identifier
/// where 'identifier' encompasses a fairly broad spectrum of
/// possibilities, including destructor and operator references.

The real expression seems to be:

CXXDependentScopeMemberExpr::getBase() | . or -> depending on isArrow() | getQualifier() (may be null) | getMember() | getExplicitTemplateArgs()

If the member has a NNS I think you can append it to the base expression with DotTypeExp (and you could add the member name to the NNS with TypeQualifed::addIdent)

BTW I just figured this out while checking occurrences of CXXDependentScopeMemberExpr in Sema so there so there may be other similar Expr which are being mapped incorrectly.

Could you fix it for CXXDependentScopeMemberExpr before the pull?


Reply to this email directly or view it on GitHub #7 (comment) .

@Syniurge
Copy link
Owner

My mistake Kelly, I thought that DotTypeExp was similar to TypeExp and could be used to append a TypeQualified to an expression, whereas it's not the purpose of DotTypeExp at all.

I can't think of a simple way to append TypeQualified's idents to the base expression. Seems like it's necessary to append them one by one with DotIdExp and DotTemplateInstanceExp.

Would you prefer me to merge this after fixing it or do you prefer to fix it yourself?

@wilsonk
Copy link
Author

wilsonk commented Apr 14, 2015

Hello Elie,

You can go ahead and fix it up, if you like. The funny thing is that I was thinking that DotTypeExp wasn’t the correct approach as I was hammering it into place… :)

One other expression that I keep running into, that isn’t implemented is the CXXPseudoDestructorExp. I just have it returning a new NullExpr for my tests here, as I don’t think there is a D equivalent. So if you wanted to add that also, then hopefully we have almost all of them covered.

I will reiterate here (since I mentioned it with the VectorType PR and I have tried using three other C++ libs today) that the main problem I am running into now is as follows:

`-CXXMethodDecl 0x75d12c8 <line:48:12, > col:12 implicit operator= 'struct zmq::i_pipe_events &(const struct zmq::i_pipe_events &)' inline noexcept-unevaluated 0x75d12c8

`-ParmVarDecl 0x75d1458 col:12 col:12 'const struct zmq::i_pipe_events &'

ldc2: /usr/local/include/llvm/Support/Casting.h:95: static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To = clang::TranslationUnitDecl; From = clang::Decl]: Assertion `Val && "isa<> used on a null pointer"' failed.

That is from a zeromq example. The last functions of the backtrace are ScopeChecker:: getScope and then the casting the ClassTemplateDecl is where the error occurs. The STL’s thread/random/etc. have the same type of error.

Thanks,

Kelly

From: Elie Morisse [mailto:[email protected]]
Sent: Tuesday, April 14, 2015 10:43 AM
To: Syniurge/Calypso
Cc: wilsonk
Subject: Re: [Calypso] Handle the CXXDependentScopeMemberExpr here. (#7)

My mistake Kelly, I thought that DotTypeExp was similar to TypeExp and could be used to append a TypeQualified to an expression, whereas it's not the purpose of DotTypeExp at all.

I can't think of a simple way to append TypeQualified's idents to the base expression. Seems like it's necessary to append them one by one with DotIdExp and DotTemplateInstanceExp.

Would you prefer me to merge this after fixing it or do you prefer to do it yourself?


Reply to this email directly or view it on GitHub #7 (comment) .

@Syniurge
Copy link
Owner

Could you give me an example I could debug? Or does just importing break? I'll have a look asap, but probably not tonight.

@wilsonk
Copy link
Author

wilsonk commented Apr 15, 2015

Hello Elie,

If you just run the ‘build.sh regex/’ example in the libstdc++ directory, it should give you the same error I am seeing elsewhere.

Thanks,

Kelly

From: Elie Morisse [mailto:[email protected]]
Sent: Tuesday, April 14, 2015 5:50 PM
To: Syniurge/Calypso
Cc: wilsonk
Subject: Re: [Calypso] Handle the CXXDependentScopeMemberExpr here. (#7)

Could you give me an example I could debug? Or does just importing break? I'll have a look asap, but probably not tonight.


Reply to this email directly or view it on GitHub #7 (comment) .

@wilsonk
Copy link
Author

wilsonk commented Apr 16, 2015

Hello Elie,

I just noticed that the error that I mentioned in regards to regex.d is partly triggered by –std=c++11. Even bitset.d will show the same error with c++11 specified but will compile and run fine without. So I guess c++11 is just compiling in some feature that is triggering this error that shows up rarely in regular compilations?

I tested zeromq without the c++11 flag and I still see the null pointer error starting at ScopeChecker, unfortunately.

Just wanted to let you know.

Thanks,

Kelly

From: Elie Morisse [mailto:[email protected]]
Sent: Tuesday, April 14, 2015 5:50 PM
To: Syniurge/Calypso
Cc: wilsonk
Subject: Re: [Calypso] Handle the CXXDependentScopeMemberExpr here. (#7)

Could you give me an example I could debug? Or does just importing break? I'll have a look asap, but probably not tonight.


Reply to this email directly or view it on GitHub #7 (comment) .

@Syniurge
Copy link
Owner

Merged yesterday, and just before closing Kelly do you still see errors with ScopeChecker?

@wilsonk
Copy link
Author

wilsonk commented Apr 19, 2015

Hello Elie,

I don’t see any more errors with ScopeChecker, so it should be fine.

Thanks,

Kelly

From: Elie Morisse [mailto:[email protected]]
Sent: Sunday, April 19, 2015 7:55 AM
To: Syniurge/Calypso
Cc: wilsonk
Subject: Re: [Calypso] Handle the CXXDependentScopeMemberExpr here. (#7)

Merged yesterday, and just before closing Kelly do you still see errors with ScopeChecker?


Reply to this email directly or view it on GitHub #7 (comment) .

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

Successfully merging this pull request may close these issues.

2 participants