|
|
|
@ -60,6 +60,111 @@ static std::string GetClangBuiltinIncludeDir()
@@ -60,6 +60,111 @@ static std::string GetClangBuiltinIncludeDir()
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//-----------------------------------//
|
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
#include <string> |
|
|
|
|
#include <vector> |
|
|
|
|
#include <stdio.h> |
|
|
|
|
|
|
|
|
|
static std::string exec(const char* cmd) |
|
|
|
|
{ |
|
|
|
|
FILE* pipe = _popen(cmd, "r"); |
|
|
|
|
if (!pipe) return "ERROR"; |
|
|
|
|
char buffer[128]; |
|
|
|
|
std::string result = ""; |
|
|
|
|
while(!feof(pipe)) { |
|
|
|
|
if(fgets(buffer, 128, pipe) != NULL) |
|
|
|
|
result += buffer; |
|
|
|
|
} |
|
|
|
|
_pclose(pipe); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#pragma comment(lib, "shlwapi.lib") //_popen, _pclose
|
|
|
|
|
#include <shlwapi.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Returns true if got settings, false if not.
|
|
|
|
|
//
|
|
|
|
|
bool GetVisualStudioEnv( |
|
|
|
|
const char* envVar, // [in] "INCLUDE" / "LIBPATH"
|
|
|
|
|
std::vector<std::string>& vecPathes, |
|
|
|
|
int iProbeFrom = 0, int iProbeTo = 0 // 2005 - 8, 2008 - 9, 2010 - 10
|
|
|
|
|
) |
|
|
|
|
{ |
|
|
|
|
std::string s; |
|
|
|
|
|
|
|
|
|
if( iProbeFrom == 0 && iProbeTo == 0 ) |
|
|
|
|
{ |
|
|
|
|
// Environment variable specifies which VS to use.
|
|
|
|
|
if( getenv("VSENV") != NULL ) |
|
|
|
|
{ |
|
|
|
|
int iVer = atoi( getenv("VSENV") ); |
|
|
|
|
|
|
|
|
|
if( iVer == 0 ) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
return GetVisualStudioEnv(envVar, vecPathes, iVer, iVer ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
iProbeFrom = 20; |
|
|
|
|
iProbeTo = 9; |
|
|
|
|
} //if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for( int iProbeVer = iProbeFrom; iProbeVer >= iProbeTo; iProbeVer-- ) |
|
|
|
|
{ |
|
|
|
|
char envvar[64]; |
|
|
|
|
sprintf(envvar, "VS%d0COMNTOOLS", iProbeVer); |
|
|
|
|
|
|
|
|
|
// Not defined
|
|
|
|
|
if( getenv(envvar) == NULL ) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
std::string cmd = getenv(envvar); |
|
|
|
|
cmd += "\\..\\..\\vc\\vcvarsall.bat"; |
|
|
|
|
|
|
|
|
|
if( !PathFileExistsA( cmd.c_str() ) ) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
//printf("Located: %s", envvar);
|
|
|
|
|
|
|
|
|
|
cmd = "cmd /C \"" + cmd + "\" ^>nul ^& set"; |
|
|
|
|
s = exec(cmd.c_str()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if( s.length() == 0 ) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
char* envline; |
|
|
|
|
|
|
|
|
|
vecPathes.clear(); |
|
|
|
|
|
|
|
|
|
for (envline = strtok( &s[0], "\n" ); envline; envline = strtok( NULL, "\n" )) |
|
|
|
|
{ |
|
|
|
|
char* varend = strchr( envline, '='); |
|
|
|
|
if( !varend ) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
*varend = 0; |
|
|
|
|
|
|
|
|
|
if( strcmp(envline,envVar) == 0 ) |
|
|
|
|
{ |
|
|
|
|
char* val; |
|
|
|
|
for (val = strtok( varend + 1, ";" ); val; val = strtok( NULL, ";" )) |
|
|
|
|
{ |
|
|
|
|
vecPathes.push_back(val); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
*varend = '='; |
|
|
|
|
} //for
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} //GetVisualStudioEnv
|
|
|
|
|
|
|
|
|
|
#endif //_WIN32
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Parser::Setup(ParserOptions^ Opts) |
|
|
|
|
{ |
|
|
|
@ -121,6 +226,20 @@ void Parser::Setup(ParserOptions^ Opts)
@@ -121,6 +226,20 @@ void Parser::Setup(ParserOptions^ Opts)
|
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
std::vector<std::string> SystemDirs; |
|
|
|
|
|
|
|
|
|
if( GetVisualStudioEnv("INCLUDE", SystemDirs, Opts->toolSetToUse, Opts->toolSetToUse ) ) |
|
|
|
|
{ |
|
|
|
|
clang::HeaderSearchOptions& HSOpts = C->getHeaderSearchOpts(); |
|
|
|
|
|
|
|
|
|
for(size_t i = 0; i < SystemDirs.size(); ++i) |
|
|
|
|
{ |
|
|
|
|
HSOpts.AddPath(SystemDirs[i], frontend::System, false, false, true); |
|
|
|
|
} |
|
|
|
|
} //if
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
C->createPreprocessor(); |
|
|
|
|
C->createASTContext(); |
|
|
|
|
|
|
|
|
@ -796,7 +915,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
@@ -796,7 +915,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
|
|
|
|
|
} |
|
|
|
|
case Type::InjectedClassName: |
|
|
|
|
{ |
|
|
|
|
auto IN = Type->getAs<InjectedClassNameType>(); |
|
|
|
|
auto MYIN = Type->getAs<InjectedClassNameType>(); |
|
|
|
|
return nullptr; |
|
|
|
|
} |
|
|
|
|
case Type::DependentName: |
|
|
|
|