Open num3ric opened 6 years ago
What types of paths does this add support for? I don't think I understand why you'd walk up a folder structure to look for a file (the compiler doesn't do this), but maybe I'm missing something here.
@richardeakin with the current system, a full search of the include tree doesn't seem to be needed at this level. The factory-generated file produced the wrong include path for runtime-registered classes placed deeper than at a base level of one of the folders in the include paths, which is what this change fixes.
For instance if I take one of my classes located in the project include/panels/PanelCircle.h
, the generated factory class would incorrectly be:
#include <new>
#include "PanelCircle.h"
extern "C" __declspec(dllexport) void* __cdecl rt_PanelCircle_new_operator( const std::string &className )
{
void* ptr;
if( className == "aicp::PanelCircle" ) {
ptr = static_cast<void*>( ::new aicp::PanelCircle() );
}
return ptr;
}
extern "C" __declspec(dllexport) void* __cdecl rt_PanelCircle_placement_new_operator( const std::string &className, void* address )
{
void* ptr;
if( className == "aicp::PanelCircle" ) {
ptr = static_cast<void*>( ::new (address) aicp::PanelCircle() );
}
return ptr;
}
This change correctly finds the full path with the subfolder:
#include <new>
#include "panels/PanelCircle.h"
extern "C" __declspec(dllexport) void* __cdecl rt_PanelCircle_new_operator( const std::string &className )
{
void* ptr;
if( className == "aicp::PanelCircle" ) {
ptr = static_cast<void*>( ::new aicp::PanelCircle() );
}
return ptr;
}
extern "C" __declspec(dllexport) void* __cdecl rt_PanelCircle_placement_new_operator( const std::string &className, void* address )
{
void* ptr;
if( className == "aicp::PanelCircle" ) {
ptr = static_cast<void*>( ::new (address) aicp::PanelCircle() );
}
return ptr;
}
Knowing that this is executed for successfully included & compiled files, let me know if you can think of a failure case here?
Thanks for this @num3ric. Do you think the "cl process hang" issue could be link to this PR or did you had the same thing before?
@simongeilfus I had this issue many times before
Note that I'm still seeing this occasional
cl
process hangs, though I don't think it's related to this since I've been experiencing it many times before this change.