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

Stephan Bergmann sbergman at redhat.com
Wed Jul 2 10:19:48 PDT 2014


 compilerplugins/clang/compat.hxx  |   20 ++++++++++++++++++++
 compilerplugins/clang/salbool.cxx |    6 ++++--
 2 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit 4da8281d5a93bb3d253be348cd6cc444546121b7
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Jul 2 19:19:17 2014 +0200

    compat for Clang 3.2
    
    Change-Id: I2746abd05edd00dadfe613c17b9874b1035c3be4

diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 7389f63..5533e8f 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -160,6 +160,26 @@ inline std::unique_ptr<llvm::raw_fd_ostream> create_raw_fd_ostream(
 #endif
 }
 
+inline clang::NamedDecl * const * begin(
+    clang::DeclContextLookupConstResult const & result)
+{
+#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3
+    return result.begin();
+#else
+    return result.first;
+#endif
+}
+
+inline clang::NamedDecl * const * end(
+    clang::DeclContextLookupConstResult const & result)
+{
+#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3
+    return result.end();
+#else
+    return result.second;
+#endif
+}
+
 }
 
 #endif
diff --git a/compilerplugins/clang/salbool.cxx b/compilerplugins/clang/salbool.cxx
index f8ae35e..5eddba6 100644
--- a/compilerplugins/clang/salbool.cxx
+++ b/compilerplugins/clang/salbool.cxx
@@ -72,8 +72,10 @@ OverrideKind getOverrideKind(FunctionDecl const * decl) {
 // encounter in practice:
 bool hasBoolOverload(FunctionDecl const * decl, bool mustBeDeleted) {
     unsigned n = decl->getNumParams();
-    for (auto d: decl->getDeclContext()->lookup(decl->getDeclName())) {
-        FunctionDecl const * f = dyn_cast<FunctionDecl>(d);
+    DeclContextLookupConstResult res
+        = decl->getDeclContext()->lookup(decl->getDeclName());
+    for (auto d = compat::begin(res); d != compat::end(res); ++d) {
+        FunctionDecl const * f = dyn_cast<FunctionDecl>(*d);
         if (f != nullptr && (!mustBeDeleted || f->isDeleted())) {
             if (f->getNumParams() == n) {
                 bool hasSB = false;


More information about the Libreoffice-commits mailing list