summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2018-12-11 19:42:04 +0000
committerAaron Ballman <aaron@aaronballman.com>2018-12-11 19:42:04 +0000
commit1c7977b54a0ac103dc6f95d8f4ac418856da677a (patch)
tree56b3a8359168ac19d51ac54af79390f58e274a2d /clang/lib
parent94f3e74bc805884735252e638b024edccd0701e1 (diff)
downloadbcm5719-llvm-1c7977b54a0ac103dc6f95d8f4ac418856da677a.tar.gz
bcm5719-llvm-1c7977b54a0ac103dc6f95d8f4ac418856da677a.zip
Revert r348889; it fails some tests.
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/40784 llvm-svn: 348892
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp26
1 files changed, 4 insertions, 22 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index b54bcd8e053..9fed4761b9b 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -7709,24 +7709,6 @@ shouldNotPrintDirectly(const ASTContext &Context,
return std::make_pair(QualType(), StringRef());
}
-/// Return true if \p ICE is an implicit argument promotion of an arithmetic
-/// type. Bit-field 'promotions' from a higher ranked type to a lower ranked
-/// type do not count.
-static bool
-isArithmeticArgumentPromotion(Sema &S, const ImplicitCastExpr *ICE) {
- QualType From = ICE->getSubExpr()->getType();
- QualType To = ICE->getType();
- // It's a floating promotion if the source type is a lower rank.
- if (ICE->getCastKind() == CK_FloatingCast &&
- S.Context.getFloatingTypeOrder(From, To) < 0)
- return true;
- // It's an integer promotion if the destination type is the promoted
- // source type.
- return ICE->getCastKind() == CK_IntegralCast &&
- From->isPromotableIntegerType() &&
- S.Context.getPromotedIntegerType(From) == To;
-}
-
bool
CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS,
const char *StartSpecifier,
@@ -7754,11 +7736,11 @@ CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS,
// Look through argument promotions for our error message's reported type.
// This includes the integral and floating promotions, but excludes array
- // and function pointer decay (seeing that an argument intended to be a
- // string has type 'char [6]' is probably more confusing than 'char *') and
- // certain bitfield promotions (bitfields can be 'demoted' to a lesser type).
+ // and function pointer decay; seeing that an argument intended to be a
+ // string has type 'char [6]' is probably more confusing than 'char *'.
if (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E)) {
- if (isArithmeticArgumentPromotion(S, ICE)) {
+ if (ICE->getCastKind() == CK_IntegralCast ||
+ ICE->getCastKind() == CK_FloatingCast) {
E = ICE->getSubExpr();
ExprTy = E->getType();
OpenPOWER on IntegriCloud