cling/lib/Interpreter/AutoSynthesizer.h
Vassil Vassilev 43c2ba8d0c Let the implicit auto fixer generate a decl stmt.
Usually the decls and stmts are linked-in through a DeclStmt. In the case of the
implicit auto keyword we cannot make the parser/sema generate a DeclStmt,
because it already has taken the path of parsing an expression. Instead we add
a DeclRefExpr referring the implicit auto declaration.

This DeclRefExpr is very important because it gives information where to
initialize the variable, i.e in which order. The implicit autofixer objective is
to find the first DeclRefExpr (there might be many) referring to the implicit
auto declaration and replace it with a proper DeclStmt.
2013-10-14 09:11:40 +02:00

44 lines
989 B
C++

//--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id: cb7241880ebcbba87b2ae16476c2812afd7ff571 $
// author: Vassil Vassilev <vasil.georgiev.vasilev@cern.ch>
//------------------------------------------------------------------------------
#ifndef CLING_AUTO_SYNTHESIZER_H
#define CLING_AUTO_SYNTHESIZER_H
#include "TransactionTransformer.h"
#include "llvm/ADT/OwningPtr.h"
namespace clang {
class Sema;
}
namespace llvm {
class raw_ostream;
}
namespace cling {
class AutoFixer;
class AutoSynthesizer : public TransactionTransformer {
private:
llvm::OwningPtr<AutoFixer> m_AutoFixer;
public:
///\ brief Constructs the auto synthesizer.
///
///\param[in] S - The semantic analysis object.
///
AutoSynthesizer(clang::Sema* S);
virtual ~AutoSynthesizer();
virtual void Transform();
};
} // namespace cling
#endif // CLING_AUTO_SYNTHESIZER_H