mirror of
https://github.com/intel/llvm.git
synced 2026-02-05 13:21:04 +08:00
Silence a number of static analyzer warnings with assertions and such.
No functionality change. llvm-svn: 176469
This commit is contained in:
@@ -98,6 +98,7 @@ public:
|
||||
|
||||
friend bool operator==(specific_attr_iterator Left,
|
||||
specific_attr_iterator Right) {
|
||||
assert((Left.Current == 0) == (Right.Current == 0));
|
||||
if (Left.Current < Right.Current)
|
||||
Left.AdvanceToNext(Right.Current);
|
||||
else
|
||||
|
||||
@@ -651,9 +651,11 @@ public:
|
||||
}
|
||||
|
||||
bool operator==(const referenced_vars_iterator &I) const {
|
||||
assert((R == 0) == (I.R == 0));
|
||||
return I.R == R;
|
||||
}
|
||||
bool operator!=(const referenced_vars_iterator &I) const {
|
||||
assert((R == 0) == (I.R == 0));
|
||||
return I.R != R;
|
||||
}
|
||||
referenced_vars_iterator &operator++() {
|
||||
|
||||
@@ -1214,6 +1214,8 @@ llvm::Constant *CodeGenModule::EmitConstantValue(const APValue &Value,
|
||||
if (I < NumInitElts)
|
||||
C = EmitConstantValueForMemory(Value.getArrayInitializedElt(I),
|
||||
CAT->getElementType(), CGF);
|
||||
else
|
||||
assert(Filler && "Missing filler for implicit elements of initializer");
|
||||
if (I == 0)
|
||||
CommonElementType = C->getType();
|
||||
else if (C->getType() != CommonElementType)
|
||||
|
||||
@@ -8859,7 +8859,7 @@ NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc,
|
||||
DeclContext *PrevDC = CurContext;
|
||||
CurContext = Context.getTranslationUnitDecl();
|
||||
|
||||
FunctionDecl *FD = dyn_cast<FunctionDecl>(ActOnDeclarator(TUScope, D));
|
||||
FunctionDecl *FD = cast<FunctionDecl>(ActOnDeclarator(TUScope, D));
|
||||
FD->setImplicit();
|
||||
|
||||
CurContext = PrevDC;
|
||||
|
||||
@@ -5109,7 +5109,6 @@ bool Sema::SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM,
|
||||
CXXRecordDecl *RD = MD->getParent();
|
||||
|
||||
bool ConstArg = false;
|
||||
ParmVarDecl *Param0 = MD->getNumParams() ? MD->getParamDecl(0) : 0;
|
||||
|
||||
// C++11 [class.copy]p12, p25:
|
||||
// A [special member] is trivial if its declared parameter type is the same
|
||||
@@ -5124,6 +5123,7 @@ bool Sema::SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM,
|
||||
case CXXCopyAssignment: {
|
||||
// Trivial copy operations always have const, non-volatile parameter types.
|
||||
ConstArg = true;
|
||||
const ParmVarDecl *Param0 = MD->getParamDecl(0);
|
||||
const ReferenceType *RT = Param0->getType()->getAs<ReferenceType>();
|
||||
if (!RT || RT->getPointeeType().getCVRQualifiers() != Qualifiers::Const) {
|
||||
if (Diagnose)
|
||||
@@ -5139,6 +5139,7 @@ bool Sema::SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM,
|
||||
case CXXMoveConstructor:
|
||||
case CXXMoveAssignment: {
|
||||
// Trivial move operations always have non-cv-qualified parameters.
|
||||
const ParmVarDecl *Param0 = MD->getParamDecl(0);
|
||||
const RValueReferenceType *RT =
|
||||
Param0->getType()->getAs<RValueReferenceType>();
|
||||
if (!RT || RT->getPointeeType().getCVRQualifiers()) {
|
||||
@@ -10225,8 +10226,8 @@ Decl *Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) {
|
||||
bool Invalid = D.isInvalidType();
|
||||
|
||||
// Check for unexpanded parameter packs.
|
||||
if (TInfo && DiagnoseUnexpandedParameterPack(D.getIdentifierLoc(), TInfo,
|
||||
UPPC_ExceptionType)) {
|
||||
if (DiagnoseUnexpandedParameterPack(D.getIdentifierLoc(), TInfo,
|
||||
UPPC_ExceptionType)) {
|
||||
TInfo = Context.getTrivialTypeSourceInfo(Context.IntTy,
|
||||
D.getIdentifierLoc());
|
||||
Invalid = true;
|
||||
|
||||
@@ -394,7 +394,7 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) {
|
||||
// Then in ActOnSuperMessage() (SemaExprObjC), set it back to false.
|
||||
// Finally, in ActOnFinishFunctionBody() (SemaDecl), warn if flag is set.
|
||||
// Only do this if the current class actually has a superclass.
|
||||
if (IC->getSuperClass()) {
|
||||
if (const ObjCInterfaceDecl *SuperClass = IC->getSuperClass()) {
|
||||
ObjCMethodFamily Family = MDecl->getMethodFamily();
|
||||
if (Family == OMF_dealloc) {
|
||||
if (!(getLangOpts().ObjCAutoRefCount ||
|
||||
@@ -407,8 +407,8 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) {
|
||||
|
||||
} else {
|
||||
const ObjCMethodDecl *SuperMethod =
|
||||
IC->getSuperClass()->lookupMethod(MDecl->getSelector(),
|
||||
MDecl->isInstanceMethod());
|
||||
SuperClass->lookupMethod(MDecl->getSelector(),
|
||||
MDecl->isInstanceMethod());
|
||||
getCurFunction()->ObjCShouldCallSuper =
|
||||
(SuperMethod && SuperMethod->hasAttr<ObjCRequiresSuperAttr>());
|
||||
}
|
||||
|
||||
@@ -2531,6 +2531,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
|
||||
Diag(ReturnLoc, DiagID) << getCurMethodDecl()->getDeclName() << 1/*meth*/;
|
||||
Result = new (Context) ReturnStmt(ReturnLoc);
|
||||
} else {
|
||||
assert(RetValExp || FnRetType->isDependentType());
|
||||
const VarDecl *NRVOCandidate = 0;
|
||||
if (!FnRetType->isDependentType() && !RetValExp->isTypeDependent()) {
|
||||
// we have a non-void function with an expression, continue checking
|
||||
|
||||
@@ -3385,6 +3385,7 @@ namespace {
|
||||
|
||||
TypeSourceInfo *TInfo = 0;
|
||||
Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
|
||||
assert(TInfo);
|
||||
TL.getValueLoc().initializeFullCopy(TInfo->getTypeLoc());
|
||||
}
|
||||
|
||||
|
||||
@@ -649,6 +649,8 @@ void ExprEngine::VisitGuardedExpr(const Expr *Ex,
|
||||
break;
|
||||
}
|
||||
|
||||
assert(SrcBlock && "missing function entry");
|
||||
|
||||
// Find the last expression in the predecessor block. That is the
|
||||
// expression that is used for the value of the ternary expression.
|
||||
bool hasValue = false;
|
||||
|
||||
Reference in New Issue
Block a user