[cfe-commits] r55299 - in /cfe/trunk/lib: AST/Expr.cpp CodeGen/CGExprConstant.cpp
Daniel Dunbar
daniel at zuster.org
Sun Aug 24 20:38:42 PDT 2008
Nice, thanks! A few notes:
return builtinID == Builtin::BI__builtin___CFStringMakeConstantString ||
> - builtinID == Builtin::BI__builtin_classify_type;
> + builtinID == Builtin::BI__builtin_classify_type ||
> + builtinID == Builtin::BI__builtin_huge_valf;
>
Quite a few builtins are treated as constant exprs. We should probably add
another parameter to BUILTIN in Builtins.def to handle this instead of
building a big disjunction here.
+ llvm::Constant *VisitCallExpr(const CallExpr *E) {
> + if (const ImplicitCastExpr *IcExpr =
> + dyn_cast<const ImplicitCastExpr>(E->getCallee()))
> + if (const DeclRefExpr *DRExpr =
> + dyn_cast<const DeclRefExpr>(IcExpr->getSubExpr()))
> + if (const FunctionDecl *FDecl =
> + dyn_cast<const FunctionDecl>(DRExpr->getDecl()))
> + if (unsigned builtinID = FDecl->getIdentifier()->getBuiltinID())
> + return EmitBuiltinExpr(builtinID, E);
> +
> + CGM.ErrorUnsupported(E, "constant call expression");
> + return llvm::Constant::getNullValue(ConvertType(E->getType()));
> + }
This seems rather fragile and possibly broken. Two immediates issues:
(1) The cast is being ignored, which probably means we may end up emitting
the wrong type.
(2) We also should handle the case when there is no ImplicitCastExpr of a
builtin.
- Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20080824/4cd3124d/attachment.html>
More information about the cfe-commits
mailing list