Пример #1
0
  Expr* EvaluateTSynthesizer::SubstituteUnknownSymbol(const QualType InstTy,
                                                      Expr* SubTree,
                                                      bool ValuePrinterReq) {
    assert(SubTree && "No subtree specified!");

    //Build the arguments for the call
    llvm::SmallVector<Expr*, 2> CallArgs;

    // Build Arg0
    Expr* Arg0 = BuildDynamicExprInfo(SubTree, ValuePrinterReq);
    CallArgs.push_back(Arg0);

    // Build Arg1
    QualType DCTy = m_Context->getTypeDeclType(m_DeclContextDecl);
    Expr* Arg1 = utils::Synthesize::CStyleCastPtrExpr(m_Sema, DCTy, 
                                                    (uint64_t)m_CurDeclContext);
    CallArgs.push_back(Arg1);

    // Build the call
    assert(Arg0 && Arg1 && "Arguments missing!");
    CallExpr* EvalCall = BuildEvalCallExpr(InstTy, SubTree, CallArgs);

    // Add substitution mapping
    getSubstSymbolMap()[EvalCall] = SubTree;

    return EvalCall;
  }
Пример #2
0
  Expr* EvaluateTSynthesizer::SubstituteUnknownSymbol(const QualType InstTy,
                                                      Expr* SubTree,
                                                      bool ValuePrinterReq) {
    assert(SubTree && "No subtree specified!");

    //Build the arguments for the call
    ASTOwningVector<Expr*> CallArgs(*m_Sema);

    // Build Arg0
    Expr* Arg0 = BuildDynamicExprInfo(SubTree, ValuePrinterReq);
    CallArgs.push_back(Arg0);

    // Build Arg1
    CXXRecordDecl* D = dyn_cast<CXXRecordDecl>(m_Interpreter->
                                               LookupDecl("clang").
                                               LookupDecl("DeclContext").
                                               getSingleDecl());
    assert(D && "DeclContext declaration not found!");
    QualType DCTy = m_Context->getTypeDeclType(D);
    Expr* Arg1 = ConstructCStyleCasePtrExpr(DCTy, (uint64_t)m_CurDeclContext);
    CallArgs.push_back(Arg1);

    // Build the call
    assert(Arg0 && Arg1 && "Arguments missing!");
    CallExpr* EvalCall = BuildEvalCallExpr(InstTy, SubTree, CallArgs);

    // Add substitution mapping
    getSubstSymbolMap()[EvalCall] = SubTree;

    return EvalCall;
  }