salbool: a rewriting plugin that flags most uses of sal_Bool
...that would not lead to silent changes of the code. That is, it does not warn about sal_Bool parameters of virtual functions, so that (not yet rewritten) overrides do not silently become overloads instead. The plugin is in store/ for now, because not all of the code has been cleaned up yet. Change-Id: I6e9b3847eb26c3090f375045188d38097052defe
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
#include <string>
|
||||
|
||||
#include "clang/AST/Decl.h"
|
||||
#include "clang/AST/DeclBase.h"
|
||||
#include "clang/AST/DeclCXX.h"
|
||||
#include "clang/AST/Expr.h"
|
||||
#include "clang/AST/Type.h"
|
||||
#include "clang/Basic/Diagnostic.h"
|
||||
@@ -25,6 +27,22 @@
|
||||
// Compatibility wrapper to abstract over (trivial) changes in the Clang API:
|
||||
namespace compat {
|
||||
|
||||
inline bool isExternCContext(clang::DeclContext const & ctxt) {
|
||||
#if (__clang_major__ == 3 && __clang_minor__ >= 4) || __clang_major__ > 3
|
||||
return ctxt.isExternCContext();
|
||||
#else
|
||||
for (clang::DeclContext const * c = &ctxt;
|
||||
c->getDeclKind() != clang::Decl::TranslationUnit; c = c->getParent())
|
||||
{
|
||||
if (c->getDeclKind() == clang::Decl::LinkageSpec) {
|
||||
return llvm::cast<clang::LinkageSpecDecl>(c)->getLanguage()
|
||||
== clang::LinkageSpecDecl::lang_c;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline clang::QualType getReturnType(clang::FunctionDecl const & decl) {
|
||||
#if (__clang_major__ == 3 && __clang_minor__ >= 5) || __clang_major__ > 3
|
||||
return decl.getReturnType();
|
||||
|
||||
Reference in New Issue
Block a user