SemaConsumer.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===--- SemaConsumer.h - Abstract interface for AST semantics --*- 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 SemaConsumer class, a subclass of
  15. // ASTConsumer that is used by AST clients that also require
  16. // additional semantic analysis.
  17. //
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_CLANG_SEMA_SEMACONSUMER_H
  20. #define LLVM_CLANG_SEMA_SEMACONSUMER_H
  21. #include "clang/AST/ASTConsumer.h"
  22. namespace clang {
  23. class Sema;
  24. /// An abstract interface that should be implemented by
  25. /// clients that read ASTs and then require further semantic
  26. /// analysis of the entities in those ASTs.
  27. class SemaConsumer : public ASTConsumer {
  28. virtual void anchor();
  29. public:
  30. SemaConsumer() {
  31. ASTConsumer::SemaConsumer = true;
  32. }
  33. /// Initialize the semantic consumer with the Sema instance
  34. /// being used to perform semantic analysis on the abstract syntax
  35. /// tree.
  36. virtual void InitializeSema(Sema &S) {}
  37. /// Inform the semantic consumer that Sema is no longer available.
  38. virtual void ForgetSema() {}
  39. // isa/cast/dyn_cast support
  40. static bool classof(const ASTConsumer *Consumer) {
  41. return Consumer->SemaConsumer;
  42. }
  43. };
  44. }
  45. #endif
  46. #ifdef __GNUC__
  47. #pragma GCC diagnostic pop
  48. #endif