[Beignet] [PATCH] GBE: show correct line number in build log
Guo Yejun
yejun.guo at intel.com
Thu Feb 27 09:58:20 PST 2014
Sometimes, we insert some code into the kernel,
it makes the line number reported in build log
mismatch with the line number in the kernel from
programer's view, use #line to correct it.
Signed-off-by: Guo Yejun <yejun.guo at intel.com>
---
backend/src/backend/program.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
index c2ac83d..f656299 100644
--- a/backend/src/backend/program.cpp
+++ b/backend/src/backend/program.cpp
@@ -558,6 +558,7 @@ namespace gbe {
llvm::raw_string_ostream ErrorInfo(ErrorString);
llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions> DiagOpts = new clang::DiagnosticOptions();
DiagOpts->ShowCarets = false;
+ DiagOpts->ShowPresumedLoc = true;
#if LLVM_VERSION_MINOR <= 1
args.push_back("-triple");
args.push_back("ptx32");
@@ -797,6 +798,10 @@ namespace gbe {
fwrite(ocl_mathfunc_fastpath_str.c_str(), strlen(ocl_mathfunc_fastpath_str.c_str()), 1, clFile);
}
+ // reset the file number in case we have inserted something into the kernel
+ std::string resetFileNum = "#line 1\n";
+ fwrite(resetFileNum.c_str(), strlen(resetFileNum.c_str()), 1, clFile);
+
// Write the source to the cl file
fwrite(source, strlen(source), 1, clFile);
fclose(clFile);
--
1.7.9.5
More information about the Beignet
mailing list