clang  10.0.0svn
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"
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
const SourceLocation & getLoc() const
Stmt - This represents one statement.
Definition: Stmt.h:66
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:88
void log(raw_ostream &OS) const override
ByteCodeGenError(SourceLocation Loc)
Encodes a location in the source.
Dataflow Directional Tag Classes.
Error thrown by the compiler.
Defines the clang::SourceLocation class and associated facilities.