From: Guo Yejun Date: Thu, 27 Feb 2014 17:58:20 +0000 (+0800) Subject: GBE: show correct line number in build log X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6aff966a826314b74157b8b43882bae65732a3c9;p=contrib%2Fbeignet.git GBE: show correct line number in build log 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 Reviewed-by: Zhigang Gong --- 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 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);