2018-09-18 16:03:33 +03:00
|
|
|
/* 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 CustomAttributes_h__
|
|
|
|
#define CustomAttributes_h__
|
|
|
|
|
|
|
|
#include "clang/AST/DeclBase.h"
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
|
|
|
|
|
|
enum CustomAttributes {
|
|
|
|
#define ATTR(a) a,
|
|
|
|
#include "CustomAttributes.inc"
|
2020-06-10 22:28:57 +03:00
|
|
|
#include "external/CustomAttributes.inc"
|
2018-09-18 16:03:33 +03:00
|
|
|
#undef ATTR
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CustomAttributesSet {
|
2020-02-17 21:30:50 +03:00
|
|
|
#define ATTR(a) bool has_##a : 1;
|
2018-09-18 16:03:33 +03:00
|
|
|
#include "CustomAttributes.inc"
|
2020-06-10 22:28:57 +03:00
|
|
|
#include "external/CustomAttributes.inc"
|
2018-09-18 16:03:33 +03:00
|
|
|
#undef ATTR
|
|
|
|
};
|
|
|
|
|
2020-02-17 21:30:50 +03:00
|
|
|
template <CustomAttributes A> bool hasCustomAttribute(const clang::Decl *D) {
|
2018-09-18 16:03:33 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-02-17 21:30:50 +03:00
|
|
|
extern CustomAttributesSet GetAttributes(const clang::Decl *D);
|
2018-09-18 16:03:33 +03:00
|
|
|
|
2020-02-17 21:30:50 +03:00
|
|
|
#define ATTR(name) \
|
|
|
|
template <> inline bool hasCustomAttribute<name>(const clang::Decl *D) { \
|
|
|
|
return GetAttributes(D).has_##name; \
|
2018-09-18 16:03:33 +03:00
|
|
|
}
|
|
|
|
#include "CustomAttributes.inc"
|
2020-06-10 22:28:57 +03:00
|
|
|
#include "external/CustomAttributes.inc"
|
2018-09-18 16:03:33 +03:00
|
|
|
#undef ATTR
|
|
|
|
|
2020-02-17 21:30:50 +03:00
|
|
|
extern bool hasCustomAttribute(const clang::Decl *D, CustomAttributes A);
|
2018-09-18 16:03:33 +03:00
|
|
|
|
|
|
|
#endif /* CustomAttributes_h__ */
|