| 1 | //===-- ModelConsumer.h -----------------------------------------*- 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 | /// \file |
| 10 | /// This file implements clang::ento::ModelConsumer which is an |
| 11 | /// ASTConsumer for model files. |
| 12 | /// |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef LLVM_CLANG_GR_MODELCONSUMER_H |
| 16 | #define LLVM_CLANG_GR_MODELCONSUMER_H |
| 17 | |
| 18 | #include "clang/AST/ASTConsumer.h" |
| 19 | #include "llvm/ADT/StringMap.h" |
| 20 | |
| 21 | namespace clang { |
| 22 | |
| 23 | class Stmt; |
| 24 | |
| 25 | namespace ento { |
| 26 | |
| 27 | /// ASTConsumer to consume model files' AST. |
| 28 | /// |
| 29 | /// This consumer collects the bodies of function definitions into a StringMap |
| 30 | /// from a model file. |
| 31 | class ModelConsumer : public ASTConsumer { |
| 32 | public: |
| 33 | ModelConsumer(llvm::StringMap<Stmt *> &Bodies); |
| 34 | |
| 35 | bool HandleTopLevelDecl(DeclGroupRef D) override; |
| 36 | |
| 37 | private: |
| 38 | llvm::StringMap<Stmt *> &Bodies; |
| 39 | }; |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | #endif |
| 44 |