Fix a trivial bool-related bug I spotted while skimming David Fang's
authorEli Friedman <eli.friedman@gmail.com>
Thu, 15 Nov 2012 01:21:59 +0000 (01:21 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Thu, 15 Nov 2012 01:21:59 +0000 (01:21 +0000)
current list of powerpc-darwin8 failures.

llvm-svn: 168016

clang/lib/AST/ASTContext.cpp
clang/test/Sema/ppc-bool.c [new file with mode: 0644]

index d5107b0..c192d28 100644 (file)
@@ -4153,8 +4153,8 @@ QualType ASTContext::getPromotedIntegerType(QualType Promotable) const {
   // 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;
 }
diff --git a/clang/test/Sema/ppc-bool.c b/clang/test/Sema/ppc-bool.c
new file mode 100644 (file)
index 0000000..2a4303e
--- /dev/null
@@ -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;