diff options
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/store/nullptr.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compilerplugins/clang/store/nullptr.cxx b/compilerplugins/clang/store/nullptr.cxx index 528bb6aac9bc..83812d0ccd49 100644 --- a/compilerplugins/clang/store/nullptr.cxx +++ b/compilerplugins/clang/store/nullptr.cxx @@ -42,6 +42,8 @@ public: bool VisitImplicitCastExpr(CastExpr const * expr); private: + bool isInLokIncludeFile(SourceLocation spellingLocation) const; + bool isFromCIncludeFile(SourceLocation spellingLocation) const; bool isMacroBodyExpansion(SourceLocation location) const; @@ -134,6 +136,8 @@ bool Nullptr::VisitImplicitCastExpr(CastExpr const * expr) { ((!compiler.getLangOpts().CPlusPlus || isInUnoIncludeFile( compiler.getSourceManager().getSpellingLoc(loc)) + || isInLokIncludeFile( + compiler.getSourceManager().getSpellingLoc(loc)) || isFromCIncludeFile( compiler.getSourceManager().getSpellingLoc(loc))) ? "NULL" : "nullptr")); @@ -143,6 +147,11 @@ bool Nullptr::VisitImplicitCastExpr(CastExpr const * expr) { return true; } +bool Nullptr::isInLokIncludeFile(SourceLocation spellingLocation) const { + return compiler.getSourceManager().getFilename(spellingLocation) + .startswith(SRCDIR "/include/LibreOfficeKit/"); +} + bool Nullptr::isFromCIncludeFile(SourceLocation spellingLocation) const { return !compat::isInMainFile(compiler.getSourceManager(), spellingLocation) && (StringRef( |