-
Notifications
You must be signed in to change notification settings - Fork 518
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
Generator.OutputMode.FilePerModule
mode not working?
#1863
Comments
Seems like we never considered this edge case, a PR with a fix is welcome, and preferably with a test. Btw I see that you are trying to bind Qt. Are you aware of https://gitlab.com/ddobrev/QtSharp? |
Yes, I'm aware of it but considering the last update date, I decided only to take influence. |
Unfortunately Dimitar passed away before fully completing the work on QtSharp, but a lot of it should still be applicable. |
I have been working on this. The trouble I have right now is that current unit tests can't find C++ test header files. They should be under a subdirectory of the Executing Assembly's folder. For my case they should be under "bin/Release_x64" but they aren't. Project files don't copy them to the bin folder because the project does not find them. What is your setup @tritao? Did I forget to do something? Test header files are in the repo but not in the folder the project tries to look for. |
If you check the We prefered that approach to copying the files since it should lead to less duplication and potential troubles. I wonder why it's not picking it up on your setup though, do you have a custom output folder setup that is outside the main CppSharp checkout? |
The problem was that I had a test folder in the release_x64 folder for some reason. Since the check only checks that folder structure exists not that files exist it selected it before going to the parent folder. Thanks @tritao I missed the loop part of the |
Had some work stuff not leading me to finish this but I'm on a side quest with this right now. One unit test gave an error which let to me having problems with
Haven't tested this on seperated file yet. Is the problem with parent of this class coming from the template? |
Hard to know, can you post a fully preprocessed version of that header that reproduces the issue? |
I think it is the parent coming from the template. I added this to NamespaceBase.h to test and it passes and complaints about xmemory one. class Foo {
;
};
template <class TBase, class TVal>
class _Compressed_pair : private Foo {
public:
TVal Myval;
using _Mybase = Foo;
template <class... _Other2>
constexpr explicit _Compressed_pair(TVal _val)
: Foo(), Myval(_val) {}
constexpr Foo& _Get_first() noexcept {
return *this;
}
constexpr const Foo& _Get_first() const noexcept {
return *this;
}
}; If I change |
It seems that |
Cool, nice find, we have an assert there but probably not being raised due to not being a debug build. I tried debugging your header yesterday night, but unfortunately could not get it parsing, it fails due to |
Currently my static clang::CXXRecordDecl* GetCXXRecordDeclFromBaseType(const clang::ASTContext& context, const clang::CXXBaseSpecifier& base, const clang::QualType& Ty)
{
using namespace clang;
if (auto RT = Ty->getAs<clang::RecordType>())
return dyn_cast<clang::CXXRecordDecl>(RT->getDecl());
else if (auto TST = Ty->getAs<clang::TemplateSpecializationType>())
return GetCXXRecordDeclFromTemplateName(TST->getTemplateName());
else if (auto Injected = Ty->getAs<clang::InjectedClassNameType>())
return Injected->getDecl();
else if (auto TTP = Ty->getAs<clang::TemplateTypeParmType>())
return TTP->getAsCXXRecordDecl();
// Error has occured so get the file name and line number for context.
// Build a error message.
const SourceManager& sourcemanager = context.getSourceManager();
auto loc = base.getBeginLoc();
std::ostringstream oss; // TODO: Add this to every where.
oss << "Could not get base CXX record from type. Unhandled type: " << Ty->getTypeClassName() << ". File " << sourcemanager.getFilename(loc).str() << ":" << sourcemanager.getSpellingLineNumber(loc);
assertm(0, oss.str().c_str());
return nullptr;
} New handling of I propose that the release version starts to complain more but does not abort and with debug the abort can be disabled. I don't really want to spend time right now figuring out how some obscure C++ code can be turned into C#. |
The current version of CppSharp generates only one file with
Generator.OutputMode.FilePerModule
mode if header files are in the same include directory. ILibrary Setup method:I think this is caused by
CleanUnitPass
associating unit passes with the first module with the same include path.In the
CleanUnitPass
module is determined by this method:Line
return Options.Modules.FirstOrDefault
seem to cause the issue. I would removeCleanUnitPass
class and move the module unit association to be done at the parser rather than later.The text was updated successfully, but these errors were encountered: