r196647 - Tweak r196646

Alp Toker alp at nuanti.com
Fri Dec 6 23:32:31 PST 2013


Author: alp
Date: Sat Dec  7 01:32:31 2013
New Revision: 196647

URL: http://llvm.org/viewvc/llvm-project?rev=196647&view=rev
Log:
Tweak r196646

There was already a condition earlier in the function so just place the check
there.

Cleanup only.

Modified:
    cfe/trunk/lib/Sema/SemaExprCXX.cpp

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=196647&r1=196646&r2=196647&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sat Dec  7 01:32:31 2013
@@ -3925,8 +3925,11 @@ ExprResult Sema::BuildBinaryTypeTrait(Bi
                                       SourceLocation RParen) {
   QualType LhsT = LhsTSInfo->getType();
   QualType RhsT = RhsTSInfo->getType();
+  QualType ResultType = Context.BoolTy;
 
+  // __builtin_types_compatible_p is a GNU C extension, not a C++ type trait.
   if (BTT == BTT_TypeCompatible) {
+    ResultType = Context.IntTy;
     if (getLangOpts().CPlusPlus) {
       Diag(KWLoc, diag::err_types_compatible_p_in_cplusplus)
         << SourceRange(KWLoc, RParen);
@@ -3938,11 +3941,6 @@ ExprResult Sema::BuildBinaryTypeTrait(Bi
   if (!LhsT->isDependentType() && !RhsT->isDependentType())
     Value = EvaluateBinaryTypeTrait(*this, BTT, LhsT, RhsT, KWLoc);
 
-  QualType ResultType = Context.BoolTy;
-  // __builtin_types_compatible_p is a GNU C extension, not a C++ type trait.
-  if (BTT == BTT_TypeCompatible)
-    ResultType = Context.IntTy;
-
   return Owned(new (Context) BinaryTypeTraitExpr(KWLoc, BTT, LhsTSInfo,
                                                  RhsTSInfo, Value, RParen,
                                                  ResultType));





More information about the cfe-commits mailing list