-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang] Introduce target-specific
Sema
components (#93179)
This patch introduces `SemaAMDGPU`, `SemaARM`, `SemaBPF`, `SemaHexagon`, `SemaLoongArch`, `SemaMIPS`, `SemaNVPTX`, `SemaPPC`, `SemaSystemZ`, `SemaWasm`. This continues previous efforts to split Sema up. Additional context can be found in #84184 and #92682. I decided to bundle target-specific components together because of their low impact on `Sema`. That said, their impact on `SemaChecking.cpp` is far from low, and I consider it a success. Somewhat accidentally, I also moved Wasm- and AMDGPU-specific function from `SemaDeclAttr.cpp`, because they were exposed in `Sema`. That went well, and I consider it a success, too. I'd like to move the rest of static target-specific functions out of `SemaDeclAttr.cpp` like we're doing with built-ins in `SemaChecking.cpp` .
- Loading branch information
Showing
32 changed files
with
4,266 additions
and
3,516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 { | ||
|
||
/// isFuncOrMethodForAttrSubject - Return true if the given decl has function | ||
/// type (function or function-typed variable) or an Objective-C | ||
/// method. | ||
inline bool isFuncOrMethodForAttrSubject(const Decl *D) { | ||
return (D->getFunctionType() != nullptr) || llvm::isa<ObjCMethodDecl>(D); | ||
} | ||
|
||
/// Return true if the given decl has function type (function or | ||
/// function-typed variable) or an Objective-C method or a block. | ||
inline bool isFunctionOrMethodOrBlockForAttrSubject(const Decl *D) { | ||
return isFuncOrMethodForAttrSubject(D) || llvm::isa<BlockDecl>(D); | ||
} | ||
|
||
} // namespace clang | ||
#endif // LLVM_CLANG_SEMA_ATTR_H |
Oops, something went wrong.