[cfe-commits] [PATCH][Review request] - Merge TypesCompatibleExprClass into BinaryTypeTraitExpr

Francois Pichet pichet2000 at gmail.com
Wed Dec 8 03:10:51 PST 2010

This patch remove the TypesCompatibleExprClass AST node and merge it
into BinaryTypeTraitExpr.
A lot of - sign there.

The things to watch out are :

  return Owned(new (Context) BinaryTypeTraitExpr(KWLoc, BTT, LhsTSInfo,
                                                  RhsTSInfo, Value, RParen,
-                                                 Context.BoolTy));
+                                                 (BTT == BTT_TypeCompatible) ?
+                                                 Context.IntTy :

BTT_TypeCompatible must have an int type otherwise some lit tests fail.

Also this:
   Value *VisitBinaryTypeTraitExpr(const BinaryTypeTraitExpr *E) {
-    return llvm::ConstantInt::get(Builder.getInt1Ty(), E->getValue());
+    return llvm::ConstantInt::get(ConvertType(E->getType()), E->getValue());

I am honestly not sure if that is right but the old line was causing
some weird code generation problem.

The problem seems that __is_base_of return a Context.BoolTy while
_builtin_types_compatible_p return a Context.IntTy.
I am not knowledgeable enough about CodeGen to know all the issues
regarding this.
But at least this patch pass all the lit tests.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rm_TypesCompatibleExprClass .patch
Type: application/octet-stream
Size: 27346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20101208/5298345c/attachment.obj>

More information about the cfe-commits mailing list