コード例 #1
0
ファイル: EvalFixed.java プロジェクト: MarkZ3/Eclipse-CDT-WIP
 @Override
 public ICPPEvaluation computeForFunctionCall(
     CPPFunctionParameterMap parameterMap, int maxdepth, IASTNode point) {
   ICPPEvaluation eval = fValue.getEvaluation();
   if (eval == null) return this;
   eval = eval.computeForFunctionCall(parameterMap, maxdepth, point);
   if (eval == fValue.getEvaluation()) return this;
   return new EvalFixed(fType, fValueCategory, Value.create(eval));
 }
コード例 #2
0
 public CPPTemplateNonTypeArgument(ICPPEvaluation evaluation, IASTNode point) {
   Assert.isNotNull(evaluation);
   if (evaluation instanceof EvalFixed
       || point == null
       || evaluation.isTypeDependent()
       || evaluation.isValueDependent()) {
     fEvaluation = evaluation;
   } else {
     IValue value = evaluation.getValue(point);
     // Avoid nesting EvalFixed's as nesting causes the signature to be different.
     if (value.getEvaluation() instanceof EvalFixed) {
       fEvaluation = value.getEvaluation();
     } else {
       fEvaluation =
           new EvalFixed(
               evaluation.getTypeOrFunctionSet(point), evaluation.getValueCategory(point), value);
     }
   }
 }
コード例 #3
0
ファイル: EvalUnary.java プロジェクト: clarkhale/cdt
  @Override
  public IValue getValue(IASTNode point) {
    if (isValueDependent()) return Value.create(this);

    if (getOverload(point) != null) {
      // TODO(sprigogin): Simulate execution of a function call.
      return Value.create(this);
    }

    switch (fOperator) {
      case op_sizeof:
        {
          SizeAndAlignment info =
              SizeofCalculator.getSizeAndAlignment(fArgument.getTypeOrFunctionSet(point), point);
          return info == null ? Value.UNKNOWN : Value.create(info.size);
        }
      case op_alignOf:
        {
          SizeAndAlignment info =
              SizeofCalculator.getSizeAndAlignment(fArgument.getTypeOrFunctionSet(point), point);
          return info == null ? Value.UNKNOWN : Value.create(info.alignment);
        }
      case op_noexcept:
        return Value.UNKNOWN; // TODO(sprigogin): Implement
      case op_sizeofParameterPack:
        return Value.UNKNOWN; // TODO(sprigogin): Implement
      case op_typeid:
        return Value.UNKNOWN; // TODO(sprigogin): Implement
      case op_throw:
        return Value.UNKNOWN; // TODO(sprigogin): Implement
    }

    IValue val = fArgument.getValue(point);
    if (val == null) return Value.UNKNOWN;

    Long num = val.numericalValue();
    if (num != null) {
      return Value.evaluateUnaryExpression(fOperator, num);
    }
    return Value.create(this);
  }
コード例 #4
0
ファイル: EvalFixed.java プロジェクト: MarkZ3/Eclipse-CDT-WIP
 public EvalFixed(IType type, ValueCategory cat, IValue value) {
   if (type instanceof CPPBasicType) {
     Long num = value.numericalValue();
     if (num != null) {
       CPPBasicType t = (CPPBasicType) type.clone();
       t.setAssociatedNumericalValue(num);
       type = t;
     }
   }
   fType = type;
   fValueCategory = cat;
   fValue = value;
 }
コード例 #5
0
ファイル: ExecSwitch.java プロジェクト: jonahkichwacoders/cdt
 private boolean isSatisfiedCaseStatement(
     ICPPExecution stmtExec,
     IValue controllerValue,
     ActivationRecord record,
     ConstexprEvaluationContext context) {
   if (stmtExec instanceof ExecCase) {
     ExecCase caseStmtExec = (ExecCase) stmtExec;
     caseStmtExec = (ExecCase) caseStmtExec.executeForFunctionCall(record, context);
     Number caseVal = caseStmtExec.getCaseExpressionEvaluation().getValue(null).numberValue();
     Number controllerVal = controllerValue.numberValue();
     return caseVal.equals(controllerVal);
   }
   return stmtExec instanceof ExecDefault;
 }
コード例 #6
0
 @Override
 public String toString() {
   if (fValue != null) return fValue.toString();
   return fType.toString();
 }
コード例 #7
0
 public boolean isSameValue(ICPPTemplateArgument arg) {
   if (fValue != null) {
     return fValue.equals(arg.getNonTypeValue());
   }
   return fType.isSameType(arg.getTypeValue());
 }