[cfe-dev] Is this a redundant statement?

Mingjie Xing mingjie.xing at gmail.com
Wed Apr 8 00:50:00 PDT 2015


Hello,

Look at the last call statement "Init.get();" in the following
function, in file lib/Sema/SemaInit.cpp.  It seems useless.

ExprResult
Sema::PerformCopyInitialization(const InitializedEntity &Entity,
                                SourceLocation EqualLoc,
                                ExprResult Init,
                                bool TopLevelOfInitList,
                                bool AllowExplicit) {
  if (Init.isInvalid())
    return ExprError();

  Expr *InitE = Init.get();
  assert(InitE && "No initialization expression?");

  if (EqualLoc.isInvalid())
    EqualLoc = InitE->getLocStart();

  InitializationKind Kind = InitializationKind::CreateCopy(InitE->getLocStart(),
                                                           EqualLoc,
                                                           AllowExplicit);
  InitializationSequence Seq(*this, Entity, Kind, InitE, TopLevelOfInitList);
  Init.get();

  ExprResult Result = Seq.Perform(*this, Entity, Kind, InitE);

  return Result;
}

Mingjie



More information about the cfe-dev mailing list