[clang] [llvm] [clang] Introduce target-specific `Sema` components (PR #93179)

Aaron Ballman via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 10:05:19 PDT 2024


================
@@ -0,0 +1,36 @@
+//===----- Attr.h --- Helper functions for attribute handling in Sema -----===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+//  This file provides helpers for Sema functions that handle attributes.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_SEMA_ATTR_H
+#define LLVM_CLANG_SEMA_ATTR_H
+
+#include "clang/AST/Decl.h"
+#include "clang/AST/DeclBase.h"
+#include "llvm/Support/Casting.h"
+
+namespace clang {
+
+/// isFunctionOrMethod - Return true if the given decl has function
+/// type (function or function-typed variable) or an Objective-C
+/// method.
+inline bool isFunctionOrMethod(const Decl *D) {
----------------
AaronBallman wrote:

We could go with `isFuncOrMethodForAttrSubject()` since it seems that we have to expose the interface... I don't love it, but I could live with it?

https://github.com/llvm/llvm-project/pull/93179


More information about the llvm-commits mailing list