[clang] 8629343 - [clang] Extract function for generated part of clang::hasAttribute (NFC)
Anders Waldenborg via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 13 08:48:35 PDT 2023
Author: Anders Waldenborg
Date: 2023-03-13T16:47:51+01:00
New Revision: 8629343a8b6c26f15f02de2fdd8db440eba71937
URL: https://github.com/llvm/llvm-project/commit/8629343a8b6c26f15f02de2fdd8db440eba71937
DIFF: https://github.com/llvm/llvm-project/commit/8629343a8b6c26f15f02de2fdd8db440eba71937.diff
LOG: [clang] Extract function for generated part of clang::hasAttribute (NFC)
This makes it easier to add additional handling when the
tablegen-generated code does not find a match.
No functional change intended.
Differential Revision: https://reviews.llvm.org/D144404
Added:
Modified:
clang/lib/Basic/Attributes.cpp
Removed:
################################################################################
diff --git a/clang/lib/Basic/Attributes.cpp b/clang/lib/Basic/Attributes.cpp
index a961e68f4ac1..5c168ec67da1 100644
--- a/clang/lib/Basic/Attributes.cpp
+++ b/clang/lib/Basic/Attributes.cpp
@@ -4,6 +4,15 @@
#include "clang/Basic/IdentifierTable.h"
using namespace clang;
+static int hasAttributeImpl(AttributeCommonInfo::Syntax Syntax, StringRef Name,
+ StringRef ScopeName, const TargetInfo &Target,
+ const LangOptions &LangOpts) {
+
+#include "clang/Basic/AttrHasAttributeImpl.inc"
+
+ return 0;
+}
+
int clang::hasAttribute(AttributeCommonInfo::Syntax Syntax,
const IdentifierInfo *Scope, const IdentifierInfo *Attr,
const TargetInfo &Target, const LangOptions &LangOpts) {
@@ -27,7 +36,9 @@ int clang::hasAttribute(AttributeCommonInfo::Syntax Syntax,
ScopeName == "omp")
return (Name == "directive" || Name == "sequence") ? 1 : 0;
-#include "clang/Basic/AttrHasAttributeImpl.inc"
+ int res = hasAttributeImpl(Syntax, Name, ScopeName, Target, LangOpts);
+ if (res)
+ return res;
return 0;
}
More information about the cfe-commits
mailing list