2012-09-05 09:37:39 +00:00
//------------------------------------------------------------------------------
// CLING - the C++ LLVM-based InterpreterG :)
// author: Vassil Vassilev <vasil.georgiev.vasilev@cern.ch>
2014-01-07 11:08:37 +01:00
//
// This file is dual-licensed: you can choose to license it under the University
// of Illinois Open Source License or the GNU Lesser General Public License. See
// LICENSE.TXT for details.
2012-09-05 09:37:39 +00:00
//------------------------------------------------------------------------------
# ifndef CLING_VALUE_PRINTER_SYNTHESIZER_H
# define CLING_VALUE_PRINTER_SYNTHESIZER_H
2015-03-16 14:58:26 +01:00
# include "ASTTransformer.h"
2012-09-05 09:37:39 +00:00
2014-08-14 12:29:27 +02:00
# include <memory>
2012-09-18 13:13:22 +00:00
2012-09-05 09:37:39 +00:00
namespace clang {
class ASTContext ;
2015-03-16 14:49:28 +01:00
class Decl ;
2012-11-11 12:47:05 +00:00
class FunctionDecl ;
2012-09-05 09:37:39 +00:00
class Expr ;
class Sema ;
2015-12-07 15:11:01 +01:00
class LookupResult ;
2012-09-05 09:37:39 +00:00
}
2012-09-18 13:13:22 +00:00
namespace llvm {
class raw_ostream ;
}
2012-09-05 09:37:39 +00:00
namespace cling {
2015-03-16 14:49:28 +01:00
class ValuePrinterSynthesizer : public WrapperTransformer {
2012-09-05 09:37:39 +00:00
private :
2012-09-18 13:13:22 +00:00
///\brief Needed for the AST transformations, owned by Sema.
///
2012-09-05 09:37:39 +00:00
clang : : ASTContext * m_Context ;
2015-12-07 15:11:01 +01:00
///\brief cling runtime "Cannot find cling_PrintValue(...)" cache.
///
clang : : LookupResult * m_LookupResult ;
2012-09-05 09:37:39 +00:00
public :
2012-10-15 13:42:09 +00:00
///\ brief Constructs the value printer synthesizer.
2012-09-18 13:13:22 +00:00
///
///\param[in] S - The semantic analysis object
2016-09-10 14:06:04 -04:00
ValuePrinterSynthesizer ( clang : : Sema * S ) ;
2014-08-03 21:05:42 -05:00
2012-09-05 09:37:39 +00:00
virtual ~ ValuePrinterSynthesizer ( ) ;
2015-03-16 14:49:28 +01:00
Result Transform ( clang : : Decl * D ) override ;
2012-09-05 09:37:39 +00:00
private :
2012-10-15 13:42:09 +00:00
///\brief Tries to attach a value printing mechanism to the given decl group
/// ref.
///
2012-11-11 12:47:05 +00:00
///\param[in] FD - wrapper function that the value printer will attached to.
2012-10-15 13:42:09 +00:00
///
///\returns true if the attachment was considered as success. I.e. even if
2014-08-03 21:05:42 -05:00
/// even if the value printer wasn't attached because of the compilation
2012-10-15 13:42:09 +00:00
/// options disallowint it - it will return still true. Returns false on
/// critical error.
2012-11-11 12:47:05 +00:00
bool tryAttachVP ( clang : : FunctionDecl * FD ) ;
2012-09-05 09:37:39 +00:00
clang : : Expr * SynthesizeVP ( clang : : Expr * E ) ;
2021-03-12 10:01:12 +01:00
unsigned ClearNullStmts ( clang : : FunctionDecl * FD ) ;
2015-12-07 15:11:01 +01:00
// Find and cache cling::runtime on first request.
void FindAndCacheRuntimeLookupResult ( clang : : SourceLocation SourceLoc ) ;
2012-09-05 09:37:39 +00:00
} ;
} // namespace cling
# endif // CLING_DECL_EXTRACTOR_H