llvm/clang/lib/Sema/SemaDeclAttr.cpp

//===--- SemaDeclAttr.cpp - Declaration Attribute Handling ----------------===//
//
// 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 implements decl-related attribute processing.
//
//===----------------------------------------------------------------------===//

#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/Mangle.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/Type.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/Cuda.h"
#include "clang/Basic/DarwinSDKInfo.h"
#include "clang/Basic/HLSLRuntime.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetBuiltins.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/Attr.h"
#include "clang/Sema/DeclSpec.h"
#include "clang/Sema/DelayedDiagnostic.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/ParsedAttr.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/SemaAMDGPU.h"
#include "clang/Sema/SemaARM.h"
#include "clang/Sema/SemaAVR.h"
#include "clang/Sema/SemaBPF.h"
#include "clang/Sema/SemaCUDA.h"
#include "clang/Sema/SemaHLSL.h"
#include "clang/Sema/SemaInternal.h"
#include "clang/Sema/SemaM68k.h"
#include "clang/Sema/SemaMIPS.h"
#include "clang/Sema/SemaMSP430.h"
#include "clang/Sema/SemaObjC.h"
#include "clang/Sema/SemaOpenCL.h"
#include "clang/Sema/SemaOpenMP.h"
#include "clang/Sema/SemaRISCV.h"
#include "clang/Sema/SemaSYCL.h"
#include "clang/Sema/SemaSwift.h"
#include "clang/Sema/SemaWasm.h"
#include "clang/Sema/SemaX86.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Demangle/Demangle.h"
#include "llvm/IR/Assumptions.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Triple.h"
#include <optional>

usingnamespaceclang;
usingnamespacesema;

namespace AttributeLangSupport {
  enum LANG {};
} // end namespace AttributeLangSupport

static unsigned getNumAttributeArgs(const ParsedAttr &AL) {}

SourceLocation Sema::getAttrLoc(const ParsedAttr &AL) {}

/// Wrapper around checkUInt32Argument, with an extra check to be sure
/// that the result will fit into a regular (signed) int. All args have the same
/// purpose as they do in checkUInt32Argument.
template <typename AttrInfo>
static bool checkPositiveIntArgument(Sema &S, const AttrInfo &AI, const Expr *Expr,
                                     int &Val, unsigned Idx = UINT_MAX) {}

bool Sema::checkStringLiteralArgumentAttr(const AttributeCommonInfo &CI,
                                          const Expr *E, StringRef &Str,
                                          SourceLocation *ArgLocation) {}

bool Sema::checkStringLiteralArgumentAttr(const ParsedAttr &AL, unsigned ArgNum,
                                          StringRef &Str,
                                          SourceLocation *ArgLocation) {}

/// Check if the passed-in expression is of type int or bool.
static bool isIntOrBool(Expr *Exp) {}


// Check to see if the type is a smart pointer of some kind.  We assume
// it's a smart pointer if it defines both operator-> and operator*.
static bool threadSafetyCheckIsSmartPointer(Sema &S, const RecordType* RT) {}

/// Check if passed in Decl is a pointer type.
/// Note that this function may produce an error message.
/// \return true if the Decl is a pointer type; false otherwise
static bool threadSafetyCheckIsPointer(Sema &S, const Decl *D,
                                       const ParsedAttr &AL) {}

/// Checks that the passed in QualType either is of RecordType or points
/// to RecordType. Returns the relevant RecordType, null if it does not exit.
static const RecordType *getRecordType(QualType QT) {}

template <typename AttrType>
static bool checkRecordDeclForAttr(const RecordDecl *RD) {}

static bool checkRecordTypeForCapability(Sema &S, QualType Ty) {}

static bool checkTypedefTypeForCapability(QualType Ty) {}

static bool typeHasCapability(Sema &S, QualType Ty) {}

static bool isCapabilityExpr(Sema &S, const Expr *Ex) {}

/// Checks that all attribute arguments, starting from Sidx, resolve to
/// a capability object.
/// \param Sidx The attribute argument index to start checking with.
/// \param ParamIdxOk Whether an argument can be indexing into a function
/// parameter list.
static void checkAttrArgsAreCapabilityObjs(Sema &S, Decl *D,
                                           const ParsedAttr &AL,
                                           SmallVectorImpl<Expr *> &Args,
                                           unsigned Sidx = 0,
                                           bool ParamIdxOk = false) {}

//===----------------------------------------------------------------------===//
// Attribute Implementations
//===----------------------------------------------------------------------===//

static void handlePtGuardedVarAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static bool checkGuardedByAttrCommon(Sema &S, Decl *D, const ParsedAttr &AL,
                                     Expr *&Arg) {}

static void handleGuardedByAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handlePtGuardedByAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static bool checkAcquireOrderAttrCommon(Sema &S, Decl *D, const ParsedAttr &AL,
                                        SmallVectorImpl<Expr *> &Args) {}

static void handleAcquiredAfterAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleAcquiredBeforeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static bool checkLockFunAttrCommon(Sema &S, Decl *D, const ParsedAttr &AL,
                                   SmallVectorImpl<Expr *> &Args) {}

static void handleAssertSharedLockAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleAssertExclusiveLockAttr(Sema &S, Decl *D,
                                          const ParsedAttr &AL) {}

/// Checks to be sure that the given parameter number is in bounds, and
/// is an integral type. Will emit appropriate diagnostics if this returns
/// false.
///
/// AttrArgNo is used to actually retrieve the argument, so it's base-0.
template <typename AttrInfo>
static bool checkParamIsIntegerType(Sema &S, const Decl *D, const AttrInfo &AI,
                                    unsigned AttrArgNo) {}

static void handleAllocSizeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static bool checkTryLockFunAttrCommon(Sema &S, Decl *D, const ParsedAttr &AL,
                                      SmallVectorImpl<Expr *> &Args) {}

static void handleSharedTrylockFunctionAttr(Sema &S, Decl *D,
                                            const ParsedAttr &AL) {}

static void handleExclusiveTrylockFunctionAttr(Sema &S, Decl *D,
                                               const ParsedAttr &AL) {}

static void handleLockReturnedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleLocksExcludedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static bool checkFunctionConditionAttr(Sema &S, Decl *D, const ParsedAttr &AL,
                                       Expr *&Cond, StringRef &Msg) {}

static void handleEnableIfAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleErrorAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleExcludeFromExplicitInstantiationAttr(Sema &S, Decl *D,
                                                       const ParsedAttr &AL) {}

namespace {
/// Determines if a given Expr references any of the given function's
/// ParmVarDecls, or the function's implicit `this` parameter (if applicable).
class ArgumentDependenceChecker
    : public RecursiveASTVisitor<ArgumentDependenceChecker> {};
}

static void handleDiagnoseAsBuiltinAttr(Sema &S, Decl *D,
                                        const ParsedAttr &AL) {}

static void handleDiagnoseIfAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleNoBuiltinAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handlePassObjectSizeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleConsumableAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static bool checkForConsumableClass(Sema &S, const CXXMethodDecl *MD,
                                    const ParsedAttr &AL) {}

static void handleCallableWhenAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleParamTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleReturnTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleSetTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleTestTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleExtVectorTypeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handlePackedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handlePreferredName(Sema &S, Decl *D, const ParsedAttr &AL) {}

bool Sema::isValidPointerAttrType(QualType T, bool RefOkay) {}

static bool attrNonNullArgCheck(Sema &S, QualType T, const ParsedAttr &AL,
                                SourceRange AttrParmRange,
                                SourceRange TypeRange,
                                bool isReturnValue = false) {}

static void handleNonNullAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleNonNullAttrParameter(Sema &S, ParmVarDecl *D,
                                       const ParsedAttr &AL) {}

static void handleReturnsNonNullAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleNoEscapeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleAssumeAlignedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleAllocAlignAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

void Sema::AddAssumeAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E,
                                Expr *OE) {}

void Sema::AddAllocAlignAttr(Decl *D, const AttributeCommonInfo &CI,
                             Expr *ParamExpr) {}

/// Normalize the attribute, __foo__ becomes foo.
/// Returns true if normalization was applied.
static bool normalizeName(StringRef &AttrName) {}

static void handleOwnershipAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleWeakRefAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

// Mark alias/ifunc target as used. Due to name mangling, we look up the
// demangled name ignoring parameters (not supported by microsoftDemangle
// https://github.com/llvm/llvm-project/issues/88825). This should handle the
// majority of use cases while leaving namespace scope names unmarked.
static void markUsedForAliasOrIfunc(Sema &S, Decl *D, const ParsedAttr &AL,
                                    StringRef Str) {}

static void handleIFuncAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleAliasAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleTLSModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleRestrictAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleCPUSpecificAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleCommonAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleNakedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleNoReturnAttr(Sema &S, Decl *D, const ParsedAttr &Attrs) {}

static void handleStandardNoReturnAttr(Sema &S, Decl *D, const ParsedAttr &A) {}

static void handleNoCfCheckAttr(Sema &S, Decl *D, const ParsedAttr &Attrs) {}

bool Sema::CheckAttrNoArgs(const ParsedAttr &Attrs) {}

bool Sema::CheckAttrTarget(const ParsedAttr &AL) {}

static void handleAnalyzerNoReturnAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

// PS3 PPU-specific.
static void handleVecReturnAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleDependencyAttr(Sema &S, Scope *Scope, Decl *D,
                                 const ParsedAttr &AL) {}

static void handleUnusedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleConstructorAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleDestructorAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

template <typename AttrTy>
static void handleAttrWithMessage(Sema &S, Decl *D, const ParsedAttr &AL) {}

static bool checkAvailabilityAttr(Sema &S, SourceRange Range,
                                  IdentifierInfo *Platform,
                                  VersionTuple Introduced,
                                  VersionTuple Deprecated,
                                  VersionTuple Obsoleted) {}

/// Check whether the two versions match.
///
/// If either version tuple is empty, then they are assumed to match. If
/// \p BeforeIsOkay is true, then \p X can be less than or equal to \p Y.
static bool versionsMatch(const VersionTuple &X, const VersionTuple &Y,
                          bool BeforeIsOkay) {}

AvailabilityAttr *Sema::mergeAvailabilityAttr(
    NamedDecl *D, const AttributeCommonInfo &CI, IdentifierInfo *Platform,
    bool Implicit, VersionTuple Introduced, VersionTuple Deprecated,
    VersionTuple Obsoleted, bool IsUnavailable, StringRef Message,
    bool IsStrict, StringRef Replacement, AvailabilityMergeKind AMK,
    int Priority, IdentifierInfo *Environment) {}

static void handleAvailabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleExternalSourceSymbolAttr(Sema &S, Decl *D,
                                           const ParsedAttr &AL) {}

template <class T>
static T *mergeVisibilityAttr(Sema &S, Decl *D, const AttributeCommonInfo &CI,
                              typename T::VisibilityType value) {}

VisibilityAttr *Sema::mergeVisibilityAttr(Decl *D,
                                          const AttributeCommonInfo &CI,
                                          VisibilityAttr::VisibilityType Vis) {}

TypeVisibilityAttr *
Sema::mergeTypeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI,
                              TypeVisibilityAttr::VisibilityType Vis) {}

static void handleVisibilityAttr(Sema &S, Decl *D, const ParsedAttr &AL,
                                 bool isTypeVisibility) {}

static void handleSentinelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleWarnUnusedResult(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleWeakImportAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

// Handles reqd_work_group_size and work_group_size_hint.
template <typename WorkGroupAttr>
static void handleWorkGroupSize(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleVecTypeHint(Sema &S, Decl *D, const ParsedAttr &AL) {}

SectionAttr *Sema::mergeSectionAttr(Decl *D, const AttributeCommonInfo &CI,
                                    StringRef Name) {}

llvm::Error Sema::isValidSectionSpecifier(StringRef SecName) {}

bool Sema::checkSectionName(SourceLocation LiteralLoc, StringRef SecName) {}

static void handleSectionAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleCodeModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

// This is used for `__declspec(code_seg("segname"))` on a decl.
// `#pragma code_seg("segname")` uses checkSectionName() instead.
static bool checkCodeSegName(Sema &S, SourceLocation LiteralLoc,
                             StringRef CodeSegName) {}

CodeSegAttr *Sema::mergeCodeSegAttr(Decl *D, const AttributeCommonInfo &CI,
                                    StringRef Name) {}

static void handleCodeSegAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

bool Sema::checkTargetAttr(SourceLocation LiteralLoc, StringRef AttrStr) {}

bool Sema::checkTargetVersionAttr(SourceLocation LiteralLoc, Decl *D,
                                  StringRef AttrStr) {}

static void handleTargetVersionAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleTargetAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

bool Sema::checkTargetClonesAttrString(
    SourceLocation LiteralLoc, StringRef Str, const StringLiteral *Literal,
    Decl *D, bool &HasDefault, bool &HasCommas, bool &HasNotDefault,
    SmallVectorImpl<SmallString<64>> &StringsBuffer) {}

static void handleTargetClonesAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleMinVectorWidthAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleCleanupAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleEnumExtensibilityAttr(Sema &S, Decl *D,
                                        const ParsedAttr &AL) {}

/// Handle __attribute__((format_arg((idx)))) attribute based on
/// http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
static void handleFormatArgAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

enum FormatAttrKind {};

/// getFormatAttrKind - Map from format attribute names to supported format
/// types.
static FormatAttrKind getFormatAttrKind(StringRef Format) {}

/// Handle __attribute__((init_priority(priority))) attributes based on
/// http://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html
static void handleInitPriorityAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

ErrorAttr *Sema::mergeErrorAttr(Decl *D, const AttributeCommonInfo &CI,
                                StringRef NewUserDiagnostic) {}

FormatAttr *Sema::mergeFormatAttr(Decl *D, const AttributeCommonInfo &CI,
                                  IdentifierInfo *Format, int FormatIdx,
                                  int FirstArg) {}

/// Handle __attribute__((format(type,idx,firstarg))) attributes based on
/// http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
static void handleFormatAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

/// Handle __attribute__((callback(CalleeIdx, PayloadIdx0, ...))) attributes.
static void handleCallbackAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static bool isFunctionLike(const Type &T) {}

/// Handle 'called_once' attribute.
static void handleCalledOnceAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleTransparentUnionAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleAnnotateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleAlignValueAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

void Sema::AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E) {}

static void handleAlignedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

/// Perform checking of type validity
///
/// C++11 [dcl.align]p1:
///   An alignment-specifier may be applied to a variable or to a class
///   data member, but it shall not be applied to a bit-field, a function
///   parameter, the formal parameter of a catch clause, or a variable
///   declared with the register storage class specifier. An
///   alignment-specifier may also be applied to the declaration of a class
///   or enumeration type.
/// CWG 2354:
///   CWG agreed to remove permission for alignas to be applied to
///   enumerations.
/// C11 6.7.5/2:
///   An alignment attribute shall not be specified in a declaration of
///   a typedef, or a bit-field, or a function, or a parameter, or an
///   object declared with the register storage-class specifier.
static bool validateAlignasAppliedType(Sema &S, Decl *D,
                                       const AlignedAttr &Attr,
                                       SourceLocation AttrLoc) {}

void Sema::AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E,
                          bool IsPackExpansion) {}

void Sema::AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI,
                          TypeSourceInfo *TS, bool IsPackExpansion) {}

void Sema::CheckAlignasUnderalignment(Decl *D) {}

bool Sema::checkMSInheritanceAttrOnDefinition(
    CXXRecordDecl *RD, SourceRange Range, bool BestCase,
    MSInheritanceModel ExplicitModel) {}

/// parseModeAttrArg - Parses attribute mode string and returns parsed type
/// attribute.
static void parseModeAttrArg(Sema &S, StringRef Str, unsigned &DestWidth,
                             bool &IntegerMode, bool &ComplexMode,
                             FloatModeKind &ExplicitType) {}

/// handleModeAttr - This attribute modifies the width of a decl with primitive
/// type.
///
/// Despite what would be logical, the mode attribute is a decl attribute, not a
/// type attribute: 'int ** __attribute((mode(HI))) *G;' tries to make 'G' be
/// HImode, not an intermediate pointer.
static void handleModeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

void Sema::AddModeAttr(Decl *D, const AttributeCommonInfo &CI,
                       IdentifierInfo *Name, bool InInstantiation) {}

static void handleNoDebugAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

AlwaysInlineAttr *Sema::mergeAlwaysInlineAttr(Decl *D,
                                              const AttributeCommonInfo &CI,
                                              const IdentifierInfo *Ident) {}

InternalLinkageAttr *Sema::mergeInternalLinkageAttr(Decl *D,
                                                    const ParsedAttr &AL) {}
InternalLinkageAttr *
Sema::mergeInternalLinkageAttr(Decl *D, const InternalLinkageAttr &AL) {}

MinSizeAttr *Sema::mergeMinSizeAttr(Decl *D, const AttributeCommonInfo &CI) {}

OptimizeNoneAttr *Sema::mergeOptimizeNoneAttr(Decl *D,
                                              const AttributeCommonInfo &CI) {}

static void handleAlwaysInlineAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleMinSizeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleOptimizeNoneAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleConstantAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleSharedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleGlobalAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleDeviceAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleManagedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleGNUInlineAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleCallConvAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleSuppressAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleLifetimeCategoryAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleRandomizeLayoutAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleNoRandomizeLayoutAttr(Sema &S, Decl *D,
                                        const ParsedAttr &AL) {}

bool Sema::CheckCallingConvAttr(const ParsedAttr &Attrs, CallingConv &CC,
                                const FunctionDecl *FD,
                                CUDAFunctionTarget CFT) {}

bool Sema::CheckRegparmAttr(const ParsedAttr &AL, unsigned &numParams) {}

// Helper to get OffloadArch.
static OffloadArch getOffloadArch(const TargetInfo &TI) {}

// Checks whether an argument of launch_bounds attribute is
// acceptable, performs implicit conversion to Rvalue, and returns
// non-nullptr Expr result on success. Otherwise, it returns nullptr
// and may output an error.
static Expr *makeLaunchBoundsArgExpr(Sema &S, Expr *E,
                                     const CUDALaunchBoundsAttr &AL,
                                     const unsigned Idx) {}

CUDALaunchBoundsAttr *
Sema::CreateLaunchBoundsAttr(const AttributeCommonInfo &CI, Expr *MaxThreads,
                             Expr *MinBlocks, Expr *MaxBlocks) {}

void Sema::AddLaunchBoundsAttr(Decl *D, const AttributeCommonInfo &CI,
                               Expr *MaxThreads, Expr *MinBlocks,
                               Expr *MaxBlocks) {}

static void handleLaunchBoundsAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleArgumentWithTypeTagAttr(Sema &S, Decl *D,
                                          const ParsedAttr &AL) {}

static void handleTypeTagForDatatypeAttr(Sema &S, Decl *D,
                                         const ParsedAttr &AL) {}

static void handleXRayLogArgsAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handlePatchableFunctionEntryAttr(Sema &S, Decl *D,
                                             const ParsedAttr &AL) {}

static void handleBuiltinAliasAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleNullableTypeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handlePreferredTypeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

//===----------------------------------------------------------------------===//
// Microsoft specific attribute handlers.
//===----------------------------------------------------------------------===//

UuidAttr *Sema::mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI,
                              StringRef UuidAsWritten, MSGuidDecl *GuidDecl) {}

static void handleUuidAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleMSInheritanceAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleDeclspecThreadAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleMSConstexprAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleAbiTagAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static bool hasBTFDeclTagAttr(Decl *D, StringRef Tag) {}

static void handleBTFDeclTagAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

BTFDeclTagAttr *Sema::mergeBTFDeclTagAttr(Decl *D, const BTFDeclTagAttr &AL) {}

static void handleInterruptAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleLayoutVersion(Sema &S, Decl *D, const ParsedAttr &AL) {}

DLLImportAttr *Sema::mergeDLLImportAttr(Decl *D,
                                        const AttributeCommonInfo &CI) {}

DLLExportAttr *Sema::mergeDLLExportAttr(Decl *D,
                                        const AttributeCommonInfo &CI) {}

static void handleDLLAttr(Sema &S, Decl *D, const ParsedAttr &A) {}

MSInheritanceAttr *
Sema::mergeMSInheritanceAttr(Decl *D, const AttributeCommonInfo &CI,
                             bool BestCase,
                             MSInheritanceModel Model) {}

static void handleCapabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleAssertCapabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleAcquireCapabilityAttr(Sema &S, Decl *D,
                                        const ParsedAttr &AL) {}

static void handleTryAcquireCapabilityAttr(Sema &S, Decl *D,
                                           const ParsedAttr &AL) {}

static void handleReleaseCapabilityAttr(Sema &S, Decl *D,
                                        const ParsedAttr &AL) {}

static void handleRequiresCapabilityAttr(Sema &S, Decl *D,
                                         const ParsedAttr &AL) {}

static void handleDeprecatedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static bool isGlobalVar(const Decl *D) {}

static bool isSanitizerAttributeAllowedOnGlobals(StringRef Sanitizer) {}

static void handleNoSanitizeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleNoSanitizeSpecificAttr(Sema &S, Decl *D,
                                         const ParsedAttr &AL) {}

static void handleInternalLinkageAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleZeroCallUsedRegsAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleCountedByAttrField(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleFunctionReturnThunksAttr(Sema &S, Decl *D,
                                           const ParsedAttr &AL) {}

static void handleAvailableOnlyInDefaultEvalMethod(Sema &S, Decl *D,
                                                   const ParsedAttr &AL) {}

static void handleNoMergeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleNoUniqueAddressAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleDestroyAttr(Sema &S, Decl *D, const ParsedAttr &A) {}

static void handleUninitializedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleMIGServerRoutineAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleMSAllocatorAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleAcquireHandleAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

template<typename Attr>
static void handleHandleAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

template<typename Attr>
static void handleUnsafeBufferUsage(Sema &S, Decl *D, const ParsedAttr &AL) {}

static void handleCFGuardAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}


template <typename AttrTy>
static const AttrTy *findEnforceTCBAttrByName(Decl *D, StringRef Name) {}

template <typename AttrTy, typename ConflictingAttrTy>
static void handleEnforceTCBAttr(Sema &S, Decl *D, const ParsedAttr &AL) {}

template <typename AttrTy, typename ConflictingAttrTy>
static AttrTy *mergeEnforceTCBAttrImpl(Sema &S, Decl *D, const AttrTy &AL) {}

EnforceTCBAttr *Sema::mergeEnforceTCBAttr(Decl *D, const EnforceTCBAttr &AL) {}

EnforceTCBLeafAttr *Sema::mergeEnforceTCBLeafAttr(
    Decl *D, const EnforceTCBLeafAttr &AL) {}

static void handleVTablePointerAuthentication(Sema &S, Decl *D,
                                              const ParsedAttr &AL) {}

//===----------------------------------------------------------------------===//
// Top Level Sema Entry Points
//===----------------------------------------------------------------------===//

// Returns true if the attribute must delay setting its arguments until after
// template instantiation, and false otherwise.
static bool MustDelayAttributeArguments(const ParsedAttr &AL) {}

/// ProcessDeclAttribute - Apply the specific attribute to the specified decl if
/// the attribute applies to decls.  If the attribute is a type attribute, just
/// silently ignore it if a GNU attribute.
static void
ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL,
                     const Sema::ProcessDeclAttributeOptions &Options) {}

static bool isKernelDecl(Decl *D) {}

void Sema::ProcessDeclAttributeList(
    Scope *S, Decl *D, const ParsedAttributesView &AttrList,
    const ProcessDeclAttributeOptions &Options) {}

void Sema::ProcessDeclAttributeDelayed(Decl *D,
                                       const ParsedAttributesView &AttrList) {}

bool Sema::ProcessAccessDeclAttributeList(
    AccessSpecDecl *ASDecl, const ParsedAttributesView &AttrList) {}

/// checkUnusedDeclAttributes - Check a list of attributes to see if it
/// contains any decl attributes that we should warn about.
static void checkUnusedDeclAttributes(Sema &S, const ParsedAttributesView &A) {}

void Sema::checkUnusedDeclAttributes(Declarator &D) {}

NamedDecl *Sema::DeclClonePragmaWeak(NamedDecl *ND, const IdentifierInfo *II,
                                     SourceLocation Loc) {}

void Sema::DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, const WeakInfo &W) {}

void Sema::ProcessPragmaWeak(Scope *S, Decl *D) {}

/// ProcessDeclAttributes - Given a declarator (PD) with attributes indicated in
/// it, apply them to D.  This is a bit tricky because PD can have attributes
/// specified in many different places, and we need to find and apply them all.
void Sema::ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD) {}

/// Is the given declaration allowed to use a forbidden type?
/// If so, it'll still be annotated with an attribute that makes it
/// illegal to actually use.
static bool isForbiddenTypeAllowed(Sema &S, Decl *D,
                                   const DelayedDiagnostic &diag,
                                   UnavailableAttr::ImplicitReason &reason) {}

/// Handle a delayed forbidden-type diagnostic.
static void handleDelayedForbiddenType(Sema &S, DelayedDiagnostic &DD,
                                       Decl *D) {}


void Sema::PopParsingDeclaration(ParsingDeclState state, Decl *decl) {}

void Sema::redelayDiagnostics(DelayedDiagnosticPool &pool) {}