FrontendActions.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- FrontendActions.h - Useful Frontend Actions -------------*- 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. #ifndef LLVM_CLANG_STATICANALYZER_FRONTEND_FRONTENDACTIONS_H
  14. #define LLVM_CLANG_STATICANALYZER_FRONTEND_FRONTENDACTIONS_H
  15. #include "clang/Frontend/FrontendAction.h"
  16. #include "llvm/ADT/StringMap.h"
  17. #include "llvm/ADT/StringRef.h"
  18. namespace clang {
  19. class Stmt;
  20. namespace ento {
  21. //===----------------------------------------------------------------------===//
  22. // AST Consumer Actions
  23. //===----------------------------------------------------------------------===//
  24. class AnalysisAction : public ASTFrontendAction {
  25. protected:
  26. std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
  27. StringRef InFile) override;
  28. };
  29. /// Frontend action to parse model files.
  30. ///
  31. /// This frontend action is responsible for parsing model files. Model files can
  32. /// not be parsed on their own, they rely on type information that is available
  33. /// in another translation unit. The parsing of model files is done by a
  34. /// separate compiler instance that reuses the ASTContext and othen information
  35. /// from the main translation unit that is being compiled. After a model file is
  36. /// parsed, the function definitions will be collected into a StringMap.
  37. class ParseModelFileAction : public ASTFrontendAction {
  38. public:
  39. ParseModelFileAction(llvm::StringMap<Stmt *> &Bodies);
  40. bool isModelParsingAction() const override { return true; }
  41. protected:
  42. std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
  43. StringRef InFile) override;
  44. private:
  45. llvm::StringMap<Stmt *> &Bodies;
  46. };
  47. } // namespace ento
  48. } // end namespace clang
  49. #endif
  50. #ifdef __GNUC__
  51. #pragma GCC diagnostic pop
  52. #endif