r204012 - Make some assertions on constant expressions static.
Benjamin Kramer
benny.kra at googlemail.com
Sat Mar 15 11:54:13 PDT 2014
Author: d0k
Date: Sat Mar 15 13:54:13 2014
New Revision: 204012
URL: http://llvm.org/viewvc/llvm-project?rev=204012&view=rev
Log:
Make some assertions on constant expressions static.
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
cfe/trunk/lib/AST/APValue.cpp
cfe/trunk/lib/AST/Decl.cpp
Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h?rev=204012&r1=204011&r2=204012&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h Sat Mar 15 13:54:13 2014
@@ -986,7 +986,8 @@ public:
template <typename T>
CallEventRef<T> CallEvent::cloneWithState(ProgramStateRef NewState) const {
assert(isa<T>(*this) && "Cloning to unrelated type");
- assert(sizeof(T) == sizeof(CallEvent) && "Subclasses may not add fields");
+ static_assert(sizeof(T) == sizeof(CallEvent),
+ "Subclasses may not add fields");
if (NewState == State)
return cast<T>(this);
Modified: cfe/trunk/lib/AST/APValue.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/APValue.cpp?rev=204012&r1=204011&r2=204012&view=diff
==============================================================================
--- cfe/trunk/lib/AST/APValue.cpp (original)
+++ cfe/trunk/lib/AST/APValue.cpp Sat Mar 15 13:54:13 2014
@@ -622,7 +622,7 @@ ArrayRef<const CXXRecordDecl*> APValue::
void APValue::MakeLValue() {
assert(isUninit() && "Bad state change");
- assert(sizeof(LV) <= DataSize && "LV too big");
+ static_assert(sizeof(LV) <= DataSize, "LV too big");
new ((void*)(char*)Data.buffer) LV();
Kind = LValue;
}
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=204012&r1=204011&r2=204012&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Sat Mar 15 13:54:13 2014
@@ -1613,8 +1613,10 @@ VarDecl::VarDecl(Kind DK, DeclContext *D
SourceLocation IdLoc, IdentifierInfo *Id, QualType T,
TypeSourceInfo *TInfo, StorageClass SC)
: DeclaratorDecl(DK, DC, IdLoc, Id, T, TInfo, StartLoc), Init() {
- assert(sizeof(VarDeclBitfields) <= sizeof(unsigned));
- assert(sizeof(ParmVarDeclBitfields) <= sizeof(unsigned));
+ static_assert(sizeof(VarDeclBitfields) <= sizeof(unsigned),
+ "VarDeclBitfields too large!");
+ static_assert(sizeof(ParmVarDeclBitfields) <= sizeof(unsigned),
+ "ParmVarDeclBitfields too large!");
AllBits = 0;
VarDeclBits.SClass = SC;
// Everything else is implicitly initialized to false.
More information about the cfe-commits
mailing list