From 17a8a03aecfb249d6704b34400887a1b0a465c80 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 8 Dec 2017 19:35:39 +0100 Subject: Add some debug checks to loplugin:salcall Change-Id: I27b7281723dd705e4304958458be3ea2fee7f3e6 Reviewed-on: https://gerrit.libreoffice.org/46112 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- compilerplugins/clang/salcall.cxx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'compilerplugins') diff --git a/compilerplugins/clang/salcall.cxx b/compilerplugins/clang/salcall.cxx index 6cfe7adc8cbd..dd4bea584a42 100644 --- a/compilerplugins/clang/salcall.cxx +++ b/compilerplugins/clang/salcall.cxx @@ -383,6 +383,12 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation auto const TSI = functionDecl->getTypeSourceInfo(); if (TSI == nullptr) { + if (isDebugMode()) + { + report(DiagnosticsEngine::Fatal, "TODO: unexpected failure #1, needs investigation", + functionDecl->getLocation()) + << functionDecl->getSourceRange(); + } return false; } auto TL = TSI->getTypeLoc().IgnoreParens(); @@ -488,8 +494,21 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation } if (startLoc.isInvalid() || endLoc.isInvalid()) - //TODO: should probably not happen + { + if (isDebugMode()) + { + report(DiagnosticsEngine::Fatal, "TODO: unexpected failure #2, needs investigation", + functionDecl->getLocation()) + << functionDecl->getSourceRange(); + } return false; + } + if (isDebugMode() && startLoc != endLoc && !SM.isBeforeInTranslationUnit(startLoc, endLoc)) + { + report(DiagnosticsEngine::Fatal, "TODO: unexpected failure #3, needs investigation", + functionDecl->getLocation()) + << functionDecl->getSourceRange(); + } SourceLocation found; -- cgit