//===-- ASTResultSynthesizer.h ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_ASTRESULTSYNTHESIZER_H #define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_ASTRESULTSYNTHESIZER_H #include "lldb/Target/Target.h" #include "clang/Sema/SemaConsumer.h" namespace clang { class CompoundStmt; class DeclContext; class NamedDecl; class ObjCMethodDecl; class TypeDecl; } // namespace clang namespace lldb_private { /// \class ASTResultSynthesizer ASTResultSynthesizer.h /// "lldb/Expression/ASTResultSynthesizer.h" Adds a result variable /// declaration to the ASTs for an expression. /// /// Users expect the expression "i + 3" to return a result, even if a result /// variable wasn't specifically declared. To fulfil this requirement, LLDB /// adds a result variable to the expression, transforming it to "int /// $__lldb_expr_result = i + 3." The IR transformers ensure that the /// resulting variable is mapped to the right piece of memory. /// ASTResultSynthesizer's job is to add the variable and its initialization /// to the ASTs for the expression, and it does so by acting as a SemaConsumer /// for Clang. class ASTResultSynthesizer : public clang::SemaConsumer { … }; } // namespace lldb_private #endif // LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_ASTRESULTSYNTHESIZER_H