diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-01-31 09:37:27 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-01-31 09:44:46 +0100 |
commit | b21e3d16aa21992d6370c4b57a83039c433ef070 (patch) | |
tree | a7053721587dae86df2b355e120267259a7e15af /compilerplugins/clang/compat.hxx | |
parent | 29b322ea0c40423a39efe2f6c2c85a7d2108c512 (diff) |
Clang API function terminology got changed
...at least in trunk 200400 towards Clang 3.5.
Change-Id: I6e295e3a4cf721fbda9df8e7c5bed3993ee78216
Diffstat (limited to 'compilerplugins/clang/compat.hxx')
-rw-r--r-- | compilerplugins/clang/compat.hxx | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx new file mode 100644 index 000000000000..9e35049e5f75 --- /dev/null +++ b/compilerplugins/clang/compat.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_COMPILERPLUGINS_CLANG_COMPAT_HXX +#define INCLUDED_COMPILERPLUGINS_CLANG_COMPAT_HXX + +#include "clang/AST/Decl.h" +#include "clang/AST/Type.h" + +// Compatibility wrapper to abstract over (trivial) chanes in the Clang API: +namespace compat { + +inline clang::QualType getReturnType(clang::FunctionDecl const & decl) { +#if (__clang_major__ == 3 && __clang_minor__ >= 5) || __clang_major__ > 3 + return decl.getReturnType(); +#else + return decl.getResultType(); +#endif +} + +inline unsigned getNumParams(clang::FunctionProtoType const & type) { +#if (__clang_major__ == 3 && __clang_minor__ >= 5) || __clang_major__ > 3 + return type.getNumParams(); +#else + return type.getNumArgs(); +#endif +} + +inline clang::QualType getParamType( + clang::FunctionProtoType const & type, unsigned i) +{ +#if (__clang_major__ == 3 && __clang_minor__ >= 5) || __clang_major__ > 3 + return type.getParamType(i); +#else + return type.getArgType(i); +#endif +} + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |