clang  20.0.0git
SemaSwift.h
Go to the documentation of this file.
1 //===----- SemaSwift.h --- Swift language-specific routines ---*- C++ -*---===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 /// \file
9 /// This file declares semantic analysis functions specific to Swift.
10 ///
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_SEMA_SEMASWIFT_H
14 #define LLVM_CLANG_SEMA_SEMASWIFT_H
15 
16 #include "clang/AST/ASTFwd.h"
17 #include "clang/Basic/LLVM.h"
19 #include "clang/Sema/SemaBase.h"
20 
21 namespace clang {
22 class AttributeCommonInfo;
23 class Decl;
24 enum class ParameterABI;
25 class ParsedAttr;
26 class SwiftNameAttr;
27 
28 class SemaSwift : public SemaBase {
29 public:
30  SemaSwift(Sema &S);
31 
32  SwiftNameAttr *mergeNameAttr(Decl *D, const SwiftNameAttr &SNA,
33  StringRef Name);
34 
35  void handleAttrAttr(Decl *D, const ParsedAttr &AL);
36  void handleAsyncAttr(Decl *D, const ParsedAttr &AL);
37  void handleBridge(Decl *D, const ParsedAttr &AL);
38  void handleError(Decl *D, const ParsedAttr &AL);
39  void handleAsyncError(Decl *D, const ParsedAttr &AL);
40  void handleName(Decl *D, const ParsedAttr &AL);
41  void handleAsyncName(Decl *D, const ParsedAttr &AL);
42  void handleNewType(Decl *D, const ParsedAttr &AL);
43 
44  /// Do a check to make sure \p Name looks like a legal argument for the
45  /// swift_name attribute applied to decl \p D. Raise a diagnostic if the name
46  /// is invalid for the given declaration.
47  ///
48  /// \p AL is used to provide caret diagnostics in case of a malformed name.
49  ///
50  /// \returns true if the name is a valid swift name for \p D, false otherwise.
51  bool DiagnoseName(Decl *D, StringRef Name, SourceLocation Loc,
52  const ParsedAttr &AL, bool IsAsync);
54  ParameterABI abi);
55 };
56 
57 } // namespace clang
58 
59 #endif // LLVM_CLANG_SEMA_SEMASWIFT_H
Forward declaration of all AST node types.
const Decl * D
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
SourceLocation Loc
Definition: SemaObjC.cpp:759
Defines the clang::SourceLocation class and associated facilities.
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
ParsedAttr - Represents a syntactic attribute.
Definition: ParsedAttr.h:129
void handleBridge(Decl *D, const ParsedAttr &AL)
Definition: SemaSwift.cpp:85
void handleAsyncAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaSwift.cpp:657
bool DiagnoseName(Decl *D, StringRef Name, SourceLocation Loc, const ParsedAttr &AL, bool IsAsync)
Do a check to make sure Name looks like a legal argument for the swift_name attribute applied to decl...
Definition: SemaSwift.cpp:510
void handleAsyncName(Decl *D, const ParsedAttr &AL)
Definition: SemaSwift.cpp:616
SwiftNameAttr * mergeNameAttr(Decl *D, const SwiftNameAttr &SNA, StringRef Name)
Definition: SemaSwift.cpp:26
void handleNewType(Decl *D, const ParsedAttr &AL)
Definition: SemaSwift.cpp:629
SemaSwift(Sema &S)
Definition: SemaSwift.cpp:24
void handleError(Decl *D, const ParsedAttr &AL)
Definition: SemaSwift.cpp:125
void AddParameterABIAttr(Decl *D, const AttributeCommonInfo &CI, ParameterABI abi)
Definition: SemaSwift.cpp:710
void handleAsyncError(Decl *D, const ParsedAttr &AL)
Definition: SemaSwift.cpp:282
void handleName(Decl *D, const ParsedAttr &AL)
Definition: SemaSwift.cpp:604
void handleAttrAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaSwift.cpp:75
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:493
Encodes a location in the source.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
The JSON file list parser is used to communicate input to InstallAPI.
ParameterABI
Kinds of parameter ABI.
Definition: Specifiers.h:366