xref: /llvm-project/clang/include/clang/Sema/SemaWasm.h (revision 27d37ee4d067f42e9a46a0871d3cb961323e5c85)
1 //===----- SemaWasm.h ------ Wasm target-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 Wasm.
10 ///
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_SEMA_SEMAWASM_H
14 #define LLVM_CLANG_SEMA_SEMAWASM_H
15 
16 #include "clang/AST/ASTFwd.h"
17 #include "clang/Sema/SemaBase.h"
18 
19 namespace clang {
20 class ParsedAttr;
21 class TargetInfo;
22 
23 class SemaWasm : public SemaBase {
24 public:
25   SemaWasm(Sema &S);
26 
27   bool CheckWebAssemblyBuiltinFunctionCall(const TargetInfo &TI,
28                                            unsigned BuiltinID,
29                                            CallExpr *TheCall);
30 
31   bool BuiltinWasmRefNullExtern(CallExpr *TheCall);
32   bool BuiltinWasmRefNullFunc(CallExpr *TheCall);
33   bool BuiltinWasmTableGet(CallExpr *TheCall);
34   bool BuiltinWasmTableSet(CallExpr *TheCall);
35   bool BuiltinWasmTableSize(CallExpr *TheCall);
36   bool BuiltinWasmTableGrow(CallExpr *TheCall);
37   bool BuiltinWasmTableFill(CallExpr *TheCall);
38   bool BuiltinWasmTableCopy(CallExpr *TheCall);
39 
40   WebAssemblyImportNameAttr *
41   mergeImportNameAttr(Decl *D, const WebAssemblyImportNameAttr &AL);
42   WebAssemblyImportModuleAttr *
43   mergeImportModuleAttr(Decl *D, const WebAssemblyImportModuleAttr &AL);
44 
45   void handleWebAssemblyExportNameAttr(Decl *D, const ParsedAttr &AL);
46   void handleWebAssemblyImportModuleAttr(Decl *D, const ParsedAttr &AL);
47   void handleWebAssemblyImportNameAttr(Decl *D, const ParsedAttr &AL);
48 };
49 } // namespace clang
50 
51 #endif // LLVM_CLANG_SEMA_SEMAWASM_H
52