MCPcopy Create free account
hub / github.com/andreasfertig/cppinsights / CallConstructor

Function CallConstructor

ASTHelpers.cpp:588–618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

586//-----------------------------------------------------------------------------
587
588static CallExpr* CallConstructor(QualType ctorType,
589 DeclRefExpr* lhsDeclRef,
590 Expr* lhsMemberExpr,
591 ArrayRef<Expr*> callParams,
592 DoCast doCast,
593 AsReference asReference)
594{
595 if(nullptr == lhsMemberExpr) {
596 lhsMemberExpr = lhsDeclRef;
597 }
598
599 auto* callCtor =
600 CreateFunctionDecl(StrCat("Constructor_"sv, GetName(ctorType)), {{kwInternalThis, lhsDeclRef->getType()}});
601
602 SmallVector<Expr*, 8> modCallParams{};
603
604 if(DoCast::Yes == doCast) {
605 modCallParams.push_back(StaticCast(lhsDeclRef->getType(), lhsDeclRef, false));
606
607 } else {
608 if(AsReference::Yes == asReference) {
609 modCallParams.push_back(Ref(lhsMemberExpr));
610 } else {
611 modCallParams.push_back(lhsMemberExpr);
612 }
613 }
614
615 modCallParams.append(callParams.begin(), callParams.end());
616
617 return Call(callCtor, modCallParams);
618}
619//-----------------------------------------------------------------------------
620
621CallExpr* CallConstructor(QualType ctorType,

Callers 3

InsertArgMethod · 0.85
InsertCXXMethodDeclMethod · 0.85
InsertArgMethod · 0.85

Calls 11

CreateFunctionDeclFunction · 0.85
StrCatFunction · 0.85
GetNameFunction · 0.85
StaticCastFunction · 0.85
RefFunction · 0.85
mkVarDeclRefExprFunction · 0.85
mkDeclRefExprFunction · 0.85
CallFunction · 0.70
AccessMemberFunction · 0.70
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected