Peter Collingbourne | 8b1265b | 2013-11-08 00:08:23 | [diff] [blame] | 1 | //===--- QuerySession.h - clang-query ---------------------------*- C++ -*-===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 | [diff] [blame] | 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 |
Peter Collingbourne | 8b1265b | 2013-11-08 00:08:23 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_QUERY_QUERY_SESSION_H |
| 10 | #define LLVM_CLANG_TOOLS_EXTRA_CLANG_QUERY_QUERY_SESSION_H |
| 11 | |
Stephen Kelly | 10f0f98 | 2019-12-29 19:26:11 | [diff] [blame] | 12 | #include "clang/AST/ASTTypeTraits.h" |
Samuel Benzaquen | 1f6066c | 2014-04-23 14:04:52 | [diff] [blame] | 13 | #include "clang/ASTMatchers/Dynamic/VariantValue.h" |
Chandler Carruth | 85e6e87 | 2014-01-07 20:05:01 | [diff] [blame] | 14 | #include "llvm/ADT/ArrayRef.h" |
Samuel Benzaquen | 1f6066c | 2014-04-23 14:04:52 | [diff] [blame] | 15 | #include "llvm/ADT/StringMap.h" |
Peter Collingbourne | 8b1265b | 2013-11-08 00:08:23 | [diff] [blame] | 16 | |
| 17 | namespace clang { |
| 18 | |
| 19 | class ASTUnit; |
| 20 | |
| 21 | namespace query { |
| 22 | |
| 23 | /// Represents the state for a particular clang-query session. |
| 24 | class QuerySession { |
| 25 | public: |
David Blaikie | 329be89 | 2014-04-25 15:06:18 | [diff] [blame] | 26 | QuerySession(llvm::ArrayRef<std::unique_ptr<ASTUnit>> ASTs) |
Stephen Kelly | 70d7717 | 2018-10-24 20:33:55 | [diff] [blame] | 27 | : ASTs(ASTs), PrintOutput(false), DiagOutput(true), |
Stephen Kelly | 8d018c7 | 2020-12-12 18:39:49 | [diff] [blame] | 28 | DetailedASTOutput(false), SrcLocOutput(false), BindRoot(true), |
| 29 | PrintMatcher(false), Terminate(false), TK(TK_AsIs) {} |
Peter Collingbourne | 8b1265b | 2013-11-08 00:08:23 | [diff] [blame] | 30 | |
David Blaikie | 329be89 | 2014-04-25 15:06:18 | [diff] [blame] | 31 | llvm::ArrayRef<std::unique_ptr<ASTUnit>> ASTs; |
Stephen Kelly | 70d7717 | 2018-10-24 20:33:55 | [diff] [blame] | 32 | |
| 33 | bool PrintOutput; |
| 34 | bool DiagOutput; |
| 35 | bool DetailedASTOutput; |
Stephen Kelly | 8d018c7 | 2020-12-12 18:39:49 | [diff] [blame] | 36 | bool SrcLocOutput; |
Stephen Kelly | 70d7717 | 2018-10-24 20:33:55 | [diff] [blame] | 37 | |
Peter Collingbourne | 8b1265b | 2013-11-08 00:08:23 | [diff] [blame] | 38 | bool BindRoot; |
Stephen Kelly | 4a5b01d | 2018-10-20 09:13:59 | [diff] [blame] | 39 | bool PrintMatcher; |
Aaron Ballman | 5890717 | 2015-08-06 11:56:57 | [diff] [blame] | 40 | bool Terminate; |
Stephen Kelly | 10f0f98 | 2019-12-29 19:26:11 | [diff] [blame] | 41 | |
Alexander Kornienko | 027899d | 2020-12-10 23:52:35 | [diff] [blame] | 42 | TraversalKind TK; |
Samuel Benzaquen | 1f6066c | 2014-04-23 14:04:52 | [diff] [blame] | 43 | llvm::StringMap<ast_matchers::dynamic::VariantValue> NamedValues; |
Peter Collingbourne | 8b1265b | 2013-11-08 00:08:23 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | } // namespace query |
| 47 | } // namespace clang |
| 48 | |
| 49 | #endif |