summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-12-08 19:35:39 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-12-09 13:17:24 +0100
commit17a8a03aecfb249d6704b34400887a1b0a465c80 (patch)
treefb2eff52b3d4b19b1ee6ef46d27767700f4d66fb /compilerplugins
parent959ecc99634d9e52db33d0032744547fead3bdec (diff)
Add some debug checks to loplugin:salcall
Change-Id: I27b7281723dd705e4304958458be3ea2fee7f3e6 Reviewed-on: https://gerrit.libreoffice.org/46112 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/salcall.cxx21
1 files changed, 20 insertions, 1 deletions
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;