[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann sbergman at redhat.com
Sat Dec 9 12:20:46 UTC 2017


 compilerplugins/clang/salcall.cxx |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 17a8a03aecfb249d6704b34400887a1b0a465c80
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 8 19:35:39 2017 +0100

    Add some debug checks to loplugin:salcall
    
    Change-Id: I27b7281723dd705e4304958458be3ea2fee7f3e6
    Reviewed-on: https://gerrit.libreoffice.org/46112
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

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;
 


More information about the Libreoffice-commits mailing list