[cfe-commits] r168016 - in /cfe/trunk: lib/AST/ASTContext.cpp test/Sema/ppc-bool.c

Eli Friedman eli.friedman at gmail.com
Wed Nov 14 17:21:59 PST 2012


Author: efriedma
Date: Wed Nov 14 19:21:59 2012
New Revision: 168016

URL: http://llvm.org/viewvc/llvm-project?rev=168016&view=rev
Log:
Fix a trivial bool-related bug I spotted while skimming David Fang's
current list of powerpc-darwin8 failures.


Added:
    cfe/trunk/test/Sema/ppc-bool.c
Modified:
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=168016&r1=168015&r2=168016&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Nov 14 19:21:59 2012
@@ -4153,8 +4153,8 @@
   // At this point, we should have a signed or unsigned integer type.
   if (Promotable->isSignedIntegerType())
     return IntTy;
-  uint64_t PromotableSize = getTypeSize(Promotable);
-  uint64_t IntSize = getTypeSize(IntTy);
+  uint64_t PromotableSize = getIntWidth(Promotable);
+  uint64_t IntSize = getIntWidth(IntTy);
   assert(Promotable->isUnsignedIntegerType() && PromotableSize <= IntSize);
   return (PromotableSize != IntSize) ? IntTy : UnsignedIntTy;
 }

Added: cfe/trunk/test/Sema/ppc-bool.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/ppc-bool.c?rev=168016&view=auto
==============================================================================
--- cfe/trunk/test/Sema/ppc-bool.c (added)
+++ cfe/trunk/test/Sema/ppc-bool.c Wed Nov 14 19:21:59 2012
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple powerpc-apple-macosx10.4.0 -verify -fsyntax-only %s
+// expected-no-diagnostics
+extern __typeof(+(_Bool)0) should_be_int;
+extern int should_be_int;





More information about the cfe-commits mailing list