1 /** 2 Copyright: Copyright (c) 2016, Joakim Brännström. All rights reserved. 3 License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) 4 Author: Joakim Brännström (joakim.brannstrom@gmx.com) 5 6 Most code in this file is from dstep/unit_tests/Common.d 7 */ 8 module test.clang_util; 9 10 import std.typecons : Flag, Yes, No; 11 12 public import cpptooling.analyzer.clang.context : ClangContext; 13 14 static import clang.TranslationUnit; 15 16 Flag!"hasError" checkForCompilerErrors(ref clang.TranslationUnit.TranslationUnit ctx) { 17 import cpptooling.analyzer.clang.check_parse_result : hasParseErrors, 18 logDiagnostic; 19 20 if (ctx.hasParseErrors) { 21 logDiagnostic(ctx); 22 23 return Yes.hasError; 24 } 25 26 return No.hasError; 27 }