ASTImportError.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- ASTImportError.h - Define errors while importing AST -----*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This file defines the ASTImportError class which basically defines the kind
  15. // of error while importing AST .
  16. //
  17. //===----------------------------------------------------------------------===//
  18. #ifndef LLVM_CLANG_AST_ASTIMPORTERROR_H
  19. #define LLVM_CLANG_AST_ASTIMPORTERROR_H
  20. #include "llvm/Support/Error.h"
  21. namespace clang {
  22. class ASTImportError : public llvm::ErrorInfo<ASTImportError> {
  23. public:
  24. /// \brief Kind of error when importing an AST component.
  25. enum ErrorKind {
  26. NameConflict, /// Naming ambiguity (likely ODR violation).
  27. UnsupportedConstruct, /// Not supported node or case.
  28. Unknown /// Other error.
  29. };
  30. ErrorKind Error;
  31. static char ID;
  32. ASTImportError() : Error(Unknown) {}
  33. ASTImportError(const ASTImportError &Other) : Error(Other.Error) {}
  34. ASTImportError &operator=(const ASTImportError &Other) {
  35. Error = Other.Error;
  36. return *this;
  37. }
  38. ASTImportError(ErrorKind Error) : Error(Error) {}
  39. std::string toString() const;
  40. void log(llvm::raw_ostream &OS) const override;
  41. std::error_code convertToErrorCode() const override;
  42. };
  43. } // namespace clang
  44. #endif // LLVM_CLANG_AST_ASTIMPORTERROR_H
  45. #ifdef __GNUC__
  46. #pragma GCC diagnostic pop
  47. #endif