Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 1 | //===- ASTImportError.h - Define errors while importing AST -----*- 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 | // This file defines the ASTImportError class which basically defines the kind |
||
10 | // of error while importing AST . |
||
11 | // |
||
12 | //===----------------------------------------------------------------------===// |
||
13 | |||
14 | #ifndef LLVM_CLANG_AST_ASTIMPORTERROR_H |
||
15 | #define LLVM_CLANG_AST_ASTIMPORTERROR_H |
||
16 | |||
17 | #include "llvm/Support/Error.h" |
||
18 | |||
19 | namespace clang { |
||
20 | |||
21 | class ASTImportError : public llvm::ErrorInfo<ASTImportError> { |
||
22 | public: |
||
23 | /// \brief Kind of error when importing an AST component. |
||
24 | enum ErrorKind { |
||
25 | NameConflict, /// Naming ambiguity (likely ODR violation). |
||
26 | UnsupportedConstruct, /// Not supported node or case. |
||
27 | Unknown /// Other error. |
||
28 | }; |
||
29 | |||
30 | ErrorKind Error; |
||
31 | |||
32 | static char ID; |
||
33 | |||
34 | ASTImportError() : Error(Unknown) {} |
||
35 | ASTImportError(const ASTImportError &Other) : Error(Other.Error) {} |
||
36 | ASTImportError &operator=(const ASTImportError &Other) { |
||
37 | Error = Other.Error; |
||
38 | return *this; |
||
39 | } |
||
40 | ASTImportError(ErrorKind Error) : Error(Error) {} |
||
41 | |||
42 | std::string toString() const; |
||
43 | |||
44 | void log(llvm::raw_ostream &OS) const override; |
||
45 | std::error_code convertToErrorCode() const override; |
||
46 | }; |
||
47 | |||
48 | } // namespace clang |
||
49 | |||
50 | #endif // LLVM_CLANG_AST_ASTIMPORTERROR_H |