<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 21, 2016 at 6:49 AM, Vedran Miletić <span dir="ltr"><<a href="mailto:vedran@miletic.net" target="_blank">vedran@miletic.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Presently errors from frontend are handled only if they occur in<br>
clang::CompilerInvocation::<wbr>CreateFromArgs(). This patch uses<br>
clang::DiagnosticsEngine to detect errors such as invalid values for<br>
Clang frontend arguments.<br>
<br>
Fixes Piglit's cl/program/build/fail/<a href="http://invalid-version-declaration.cl" rel="noreferrer" target="_blank">invalid-<wbr>version-declaration.cl</a><br>
test.<br>
<br>
</span>v2: fix inconsistent code formatting<br>
<br>
Signed-off-by: Vedran Miletić <<a href="mailto:vedran@miletic.net">vedran@miletic.net</a>><br>
Reviewed-by: Francisco Jerez <<a href="mailto:currojerez@riseup.net">currojerez@riseup.net</a>><br></blockquote><div><br></div><div>Tested-by: Aaron Watry <<a href="mailto:awatry@gmail.com">awatry@gmail.com</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="">---<br>
 src/gallium/state_trackers/<wbr>clover/llvm/invocation.cpp | 7 ++++++-<br>
 1 file changed, 6 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/gallium/state_trackers/<wbr>clover/llvm/invocation.cpp b/src/gallium/state_trackers/<wbr>clover/llvm/invocation.cpp<br>
</span>index 675cf19..f63ff3d 100644<br>
<span class="im HOEnZb">--- a/src/gallium/state_trackers/<wbr>clover/llvm/invocation.cpp<br>
+++ b/src/gallium/state_trackers/<wbr>clover/llvm/invocation.cpp<br>
@@ -98,8 +98,9 @@ namespace {<br>
                             const std::vector<std::string> &opts,<br>
                             std::string &r_log) {<br>
       std::unique_ptr<clang::<wbr>CompilerInstance> c { new clang::CompilerInstance };<br>
+      clang::TextDiagnosticBuffer *diag_buffer = new clang::TextDiagnosticBuffer;<br>
</span><span class="im HOEnZb">       clang::DiagnosticsEngine diag { new clang::DiagnosticIDs,<br>
-            new clang::DiagnosticOptions, new clang::TextDiagnosticBuffer };<br>
+            new clang::DiagnosticOptions, diag_buffer };<br>
<br>
       // Parse the compiler options.  A file name should be present at the end<br>
       // and must have the .cl extension in order for the CompilerInvocation<br>
@@ -111,6 +112,10 @@ namespace {<br>
              c->getInvocation(), copts.data(), copts.data() + copts.size(), diag))<br>
          throw invalid_build_options_error();<br>
<br>
+      diag_buffer->FlushDiagnostics(<wbr>diag);<br>
+      if (diag.hasErrorOccurred())<br>
+         throw invalid_build_options_error();<br>
+<br>
       c->getTargetOpts().CPU = target.cpu;<br>
       c->getTargetOpts().Triple = target.triple;<br>
       c->getLangOpts().NoBuiltin = true;<br>
--<br>
2.7.4<br>
<br>
</span><div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br></div></div>