SPV: Fix #1575, fix #1593: Support HLSL #line

SPIR-V OpLines now contain filenames from HLSL-style #lines.
This commit is contained in:
greg-lunarg 2018-12-07 17:36:33 -07:00 committed by John Kessenich
parent 127cea5c9a
commit 5d43c4aac7
18 changed files with 754 additions and 39 deletions

View file

@ -229,16 +229,28 @@ inline const TString String(const int i, const int /*base*/ = 10)
#endif
struct TSourceLoc {
void init() { name = nullptr; string = 0; line = 0; column = 0; }
void init()
{
name = nullptr; string = 0; line = 0; column = 0;
}
void init(int stringNum) { init(); string = stringNum; }
// Returns the name if it exists. Otherwise, returns the string number.
std::string getStringNameOrNum(bool quoteStringName = true) const
{
if (name != nullptr)
return quoteStringName ? ("\"" + std::string(name) + "\"") : name;
if (name != nullptr) {
TString qstr = quoteStringName ? ("\"" + *name + "\"") : *name;
std::string ret_str(qstr.c_str());
return ret_str;
}
return std::to_string((long long)string);
}
const char* name; // descriptive name for this string
const char* getFilename() const
{
if (name == nullptr)
return nullptr;
return name->c_str();
}
TString* name; // descriptive name for this string
int string;
int line;
int column;