summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-11-11 03:21:53 +0000
committerJohn McCall <rjmccall@apple.com>2010-11-11 03:21:53 +0000
commit1f425648ca86fc5fea8936f43145d8cdb4700357 (patch)
tree556db1bc2d626803420273059b4c469601f1300e /clang/lib/Sema/SemaInit.cpp
parent6ed689bfcbb3749a715d85ce5345b2c1e93ecb21 (diff)
downloadbcm5719-llvm-1f425648ca86fc5fea8936f43145d8cdb4700357.tar.gz
bcm5719-llvm-1f425648ca86fc5fea8936f43145d8cdb4700357.zip
Extend the bitfield-truncation warning to initializations.
rdar://problem/8652606 llvm-svn: 118773
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r--clang/lib/Sema/SemaInit.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 999d1d24c6c..ffbb76d8c5d 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -4047,6 +4047,13 @@ InitializationSequence::Perform(Sema &S,
break;
}
}
+
+ // Diagnose non-fatal problems with the completed initialization.
+ if (Entity.getKind() == InitializedEntity::EK_Member &&
+ cast<FieldDecl>(Entity.getDecl())->isBitField())
+ S.CheckBitFieldInitialization(Kind.getLocation(),
+ cast<FieldDecl>(Entity.getDecl()),
+ CurInit.get());
return move(CurInit);
}
@@ -4534,7 +4541,7 @@ Sema::PerformCopyInitialization(const InitializedEntity &Entity,
if (Init.isInvalid())
return ExprError();
- Expr *InitE = (Expr *)Init.get();
+ Expr *InitE = Init.get();
assert(InitE && "No initialization expression?");
if (EqualLoc.isInvalid())
OpenPOWER on IntegriCloud