mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-09 12:00:05 +00:00
HLSL: Fix #1655; use "" for nullptr file names. Needs test cases.
This commit is contained in:
parent
d72f488cc6
commit
b2395e9ddf
@ -250,7 +250,8 @@ struct TSourceLoc {
|
||||
return nullptr;
|
||||
return name->c_str();
|
||||
}
|
||||
TString* name; // descriptive name for this string
|
||||
const char* getFilenameStr() const { return name == nullptr ? "" : name->c_str(); }
|
||||
TString* name; // descriptive name for this string, when a textual name is available, otherwise nullptr
|
||||
int string;
|
||||
int line;
|
||||
int column;
|
||||
|
6
glslang/MachineIndependent/preprocessor/PpContext.h
Executable file → Normal file
6
glslang/MachineIndependent/preprocessor/PpContext.h
Executable file → Normal file
@ -549,9 +549,9 @@ protected:
|
||||
scanner.setLine(startLoc.line);
|
||||
scanner.setString(startLoc.string);
|
||||
|
||||
scanner.setFile(startLoc.name->c_str(), 0);
|
||||
scanner.setFile(startLoc.name->c_str(), 1);
|
||||
scanner.setFile(startLoc.name->c_str(), 2);
|
||||
scanner.setFile(startLoc.getFilenameStr(), 0);
|
||||
scanner.setFile(startLoc.getFilenameStr(), 1);
|
||||
scanner.setFile(startLoc.getFilenameStr(), 2);
|
||||
}
|
||||
|
||||
// tInput methods:
|
||||
|
2
hlsl/hlslParseHelper.cpp
Executable file → Normal file
2
hlsl/hlslParseHelper.cpp
Executable file → Normal file
@ -133,7 +133,7 @@ bool HlslParseContext::parseShaderStrings(TPpContext& ppContext, TInputScanner&
|
||||
// Print a message formated such that if you click on the message it will take you right to
|
||||
// the line through most UIs.
|
||||
const glslang::TSourceLoc& sourceLoc = input.getSourceLoc();
|
||||
infoSink.info << sourceLoc.name->c_str() << "(" << sourceLoc.line << "): error at column " << sourceLoc.column
|
||||
infoSink.info << sourceLoc.getFilenameStr() << "(" << sourceLoc.line << "): error at column " << sourceLoc.column
|
||||
<< ", HLSL parsing failed.\n";
|
||||
++numErrors;
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user