summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-09-10 15:31:24 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-09-11 08:17:31 +0200
commit9a9d407977494b405479b138a33fc6f8f1e2911d (patch)
treea85bb9550ce8308b9b02c562c33a79cb9bd96dd4 /compilerplugins
parent8e4e0bf8e81694f80a72d241fe5c8cae64240436 (diff)
prevent crashes when running the global-analysis plugins
Change-Id: Ib50583289afd6212d5d5aedd3d6b7ede75902052 Reviewed-on: https://gerrit.libreoffice.org/60277 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/plugin.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx
index 1348c3f0f00f..84975c99107a 100644
--- a/compilerplugins/clang/plugin.cxx
+++ b/compilerplugins/clang/plugin.cxx
@@ -217,6 +217,10 @@ const FunctionDecl* Plugin::getParentFunctionDecl( const Stmt* stmt )
StringRef Plugin::getFileNameOfSpellingLoc(SourceLocation spellingLocation) const
{
+ // prevent crashes when running the global-analysis plugins
+ if (!spellingLocation.isValid())
+ return "";
+
static enum { NOINIT, STDIN, GOOD } s_Mode(NOINIT);
if (s_Mode == GOOD)
{