clang 10.0.0git

ByteCodeGenError.h
Go to the documentation of this file.
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 ByteCodeGenError(SourceLocation Loc) : Loc(Loc) {}
24 ByteCodeGenError(const Stmt *S) : ByteCodeGenError(S->getBeginLoc()) {}
25 ByteCodeGenError(const Decl *D) : ByteCodeGenError(D->getBeginLoc()) {}
26
27 void log(raw_ostream &OS) const override { OS << "unimplemented feature"; }
28
29 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 std::error_code convertToErrorCode() const override {
39 return llvm::inconvertibleErrorCode();
40 }
41 };
42
43 } // namespace interp
44 } // namespace clang
45
46 #endif
clang::interp::ByteCodeGenError::getLoc
const SourceLocation & getLoc() const
Definition: ByteCodeGenError.h:29
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:66
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:88
clang::interp::ByteCodeGenError::log
void log(raw_ostream &OS) const override
Definition: ByteCodeGenError.h:27
clang::interp::ByteCodeGenError::ByteCodeGenError
ByteCodeGenError(const Stmt *S)
Definition: ByteCodeGenError.h:24
clang::interp::ByteCodeGenError::ID
static char ID
Definition: ByteCodeGenError.h:31
clang::interp::ByteCodeGenError::ByteCodeGenError
ByteCodeGenError(const Decl *D)
Definition: ByteCodeGenError.h:25
clang::interp::ByteCodeGenError::ByteCodeGenError
ByteCodeGenError(SourceLocation Loc)
Definition: ByteCodeGenError.h:23
Stmt.h
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
Decl.h
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
clang::interp::ByteCodeGenError
Error thrown by the compiler.
Definition: ByteCodeGenError.h:21
SourceLocation.h
Defines the clang::SourceLocation class and associated facilities.