Keep LibreOfficeKit.hxx compatible with C++03

Change-Id: Ic2f123c9b341dbb421b766c3bba1fc56c1bfb41d
This commit is contained in:
Stephan Bergmann
2015-11-10 11:08:30 +01:00
parent b9042d2e46
commit 1cd6e2e08e
2 changed files with 19 additions and 10 deletions

View File

@@ -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(