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 :
Context.BoolTy));

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.

Attachment: rm_TypesCompatibleExprClass .patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to