Line | Count | Source (jump to first uncovered line) |
1 | //===--- ByteCodeGenError.h - Byte code generation error ----------*- 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 | ||
9 | #ifndef LLVM_CLANG_AST_INTERP_BYTECODEGENERROR_H | |
10 | #define LLVM_CLANG_AST_INTERP_BYTECODEGENERROR_H | |
11 | ||
12 | #include "clang/AST/Decl.h" | |
13 | #include "clang/AST/Stmt.h" | |
14 | #include "clang/Basic/SourceLocation.h" | |
15 | #include "llvm/Support/Error.h" | |
16 | ||
17 | namespace clang { | |
18 | namespace interp { | |
19 | ||
20 | /// Error thrown by the compiler. | |
21 | struct ByteCodeGenError : public llvm::ErrorInfo<ByteCodeGenError> { | |
22 | public: | |
23 | 0 | ByteCodeGenError(SourceLocation Loc) : Loc(Loc) {} |
24 | 0 | ByteCodeGenError(const Stmt *S) : ByteCodeGenError(S->getBeginLoc()) {} |
25 | 0 | ByteCodeGenError(const Decl *D) : ByteCodeGenError(D->getBeginLoc()) {} |
26 | ||
27 | 0 | void log(raw_ostream &OS) const override { OS << "unimplemented feature"; } |
28 | ||
29 | 0 | const SourceLocation &getLoc() const { return Loc; } |
30 | ||
31 | static char ID; | |
32 | ||
33 | private: | |
34 | // Start of the item where the error occurred. | |
35 | SourceLocation Loc; | |
36 | ||
37 | // Users are not expected to use error_code. | |
38 | 0 | std::error_code convertToErrorCode() const override { |
39 | 0 | return llvm::inconvertibleErrorCode(); |
40 | 0 | } |
41 | }; | |
42 | ||
43 | } // namespace interp | |
44 | } // namespace clang | |
45 | ||
46 | #endif |