forked from bartvdbraak/blender
Cycles: Improve OpenCL line information handling
Previously it was falling back to just a path after #include statement was finished. Now we fall back to a proper current file name after dealing with the preprocessor statement.
This commit is contained in:
parent
94c919349b
commit
31ebbe40a0
@ -778,7 +778,9 @@ static string line_directive(const string& path, int line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string path_source_replace_includes(const string& source, const string& path)
|
string path_source_replace_includes(const string& source,
|
||||||
|
const string& path,
|
||||||
|
const string& source_filename)
|
||||||
{
|
{
|
||||||
/* Our own little c preprocessor that replaces #includes with the file
|
/* Our own little c preprocessor that replaces #includes with the file
|
||||||
* contents, to work around issue of opencl drivers not supporting
|
* contents, to work around issue of opencl drivers not supporting
|
||||||
@ -807,12 +809,12 @@ string path_source_replace_includes(const string& source, const string& path)
|
|||||||
* and avoids having list of include directories.x
|
* and avoids having list of include directories.x
|
||||||
*/
|
*/
|
||||||
text = path_source_replace_includes(
|
text = path_source_replace_includes(
|
||||||
text, path_dirname(filepath));
|
text, path_dirname(filepath), filename);
|
||||||
text = path_source_replace_includes(text, path);
|
text = path_source_replace_includes(text, path, filename);
|
||||||
/* Use line directives for better error messages. */
|
/* Use line directives for better error messages. */
|
||||||
line = line_directive(filepath, 1)
|
line = line_directive(filepath, 1)
|
||||||
+ token.replace(0, n_end + 1, "\n" + text + "\n")
|
+ token.replace(0, n_end + 1, "\n" + text + "\n")
|
||||||
+ line_directive(path, i);
|
+ line_directive(path_join(path, source_filename), i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,9 @@ bool path_read_text(const string& path, string& text);
|
|||||||
bool path_remove(const string& path);
|
bool path_remove(const string& path);
|
||||||
|
|
||||||
/* source code utility */
|
/* source code utility */
|
||||||
string path_source_replace_includes(const string& source, const string& path);
|
string path_source_replace_includes(const string& source,
|
||||||
|
const string& path,
|
||||||
|
const string& source_filename="");
|
||||||
|
|
||||||
/* cache utility */
|
/* cache utility */
|
||||||
void path_cache_clear_except(const string& name, const set<string>& except);
|
void path_cache_clear_except(const string& name, const set<string>& except);
|
||||||
|
Loading…
Reference in New Issue
Block a user