Re: [PATCH] D19278: [scan-build] fix logic error warnings emitted on clang code base

2016-05-05 Thread Apelete Seketeli via cfe-commits
apelete updated this revision to Diff 56253.
apelete added a comment.

[scan-build] fix warnings emitted on Clang Sema code base

Changes since last revision:

- split patch into Sema changes unit to ease review process,
- cherry-pick Sema changes from http://reviews.llvm.org/D19084,
- cherry-pick Sema changes from http://reviews.llvm.org/D19385.


http://reviews.llvm.org/D19278

Files:
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaInit.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/SemaOverload.cpp

Index: lib/Sema/SemaOverload.cpp
===
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -8705,6 +8705,7 @@
 
 void Sema::diagnoseEquivalentInternalLinkageDeclarations(
 SourceLocation Loc, const NamedDecl *D, ArrayRef Equiv) {
+  assert(D && "named declaration must be not NULL");
   Diag(Loc, diag::ext_equivalent_internal_linkage_decl_in_modules) << D;
 
   Module *M = getOwningModule(const_cast(D));
@@ -9185,7 +9186,9 @@
 !ToRefTy->getPointeeType()->isIncompleteType() &&
 S.IsDerivedFrom(SourceLocation(), ToRefTy->getPointeeType(), FromTy)) {
   BaseToDerivedConversion = 3;
-} else if (ToTy->isLValueReferenceType() && !FromExpr->isLValue() &&
+} else if (FromExpr &&
+   !FromExpr->isLValue() &&
+   ToTy->isLValueReferenceType() &&
ToTy.getNonReferenceType().getCanonicalType() ==
FromTy.getNonReferenceType().getCanonicalType()) {
   S.Diag(Fn->getLocation(), diag::note_ovl_candidate_bad_lvalue)
Index: lib/Sema/SemaOpenMP.cpp
===
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -985,6 +985,7 @@
 (VD && DSAStack->isForceVarCapturing()))
   return VD ? VD : Info.second;
 auto DVarPrivate = DSAStack->getTopDSA(D, DSAStack->isClauseParsingMode());
+assert(DVarPrivate.PrivateCopy && "DSAStackTy object must be not NULL");
 if (DVarPrivate.CKind != OMPC_unknown && isOpenMPPrivate(DVarPrivate.CKind))
   return VD ? VD : cast(DVarPrivate.PrivateCopy->getDecl());
 DVarPrivate = DSAStack->hasDSA(D, isOpenMPPrivate, MatchesAlways(),
@@ -3994,6 +3995,7 @@
 static ExprResult
 tryBuildCapture(Sema , Expr *Capture,
 llvm::MapVector ) {
+  assert(Capture && "cannot build capture if expression is NULL");
   if (Capture->isEvaluatable(SemaRef.Context, Expr::SE_AllowSideEffects))
 return SemaRef.PerformImplicitConversion(
 Capture->IgnoreImpCasts(), Capture->getType(), Sema::AA_Converting,
@@ -4251,7 +4253,7 @@
 SemaRef.Diag(CollapseLoopCountExpr->getExprLoc(),
  diag::note_omp_collapse_ordered_expr)
 << 0 << CollapseLoopCountExpr->getSourceRange();
-  else
+  else if (OrderedLoopCountExpr)
 SemaRef.Diag(OrderedLoopCountExpr->getExprLoc(),
  diag::note_omp_collapse_ordered_expr)
 << 1 << OrderedLoopCountExpr->getSourceRange();
Index: lib/Sema/SemaLookup.cpp
===
--- lib/Sema/SemaLookup.cpp
+++ lib/Sema/SemaLookup.cpp
@@ -3744,6 +3744,7 @@
   bool AnyVisibleDecls = !NewDecls.empty();
 
   for (/**/; DI != DE; ++DI) {
+assert(*DI && "TypoCorrection iterator cannot be NULL");
 NamedDecl *VisibleDecl = *DI;
 if (!LookupResult::isVisible(SemaRef, *DI))
   VisibleDecl = findAcceptableDecl(SemaRef, *DI);
Index: lib/Sema/SemaInit.cpp
===
--- lib/Sema/SemaInit.cpp
+++ lib/Sema/SemaInit.cpp
@@ -4862,6 +4862,8 @@
InitializationSequence ,
const InitializedEntity ,
Expr *Initializer) {
+  assert(Initializer && "Initializer needs to be not NULL");
+
   bool ArrayDecay = false;
   QualType ArgType = Initializer->getType();
   QualType ArgPointee;
@@ -5237,11 +5239,11 @@
 DeclAccessPair dap;
 if (isLibstdcxxPointerReturnFalseHack(S, Entity, Initializer)) {
   AddZeroInitializationStep(Entity.getType());
-} else if (Initializer->getType() == Context.OverloadTy &&
+} else if (Initializer && Initializer->getType() == Context.OverloadTy &&
!S.ResolveAddressOfOverloadedFunction(Initializer, DestType,
  false, dap))
   SetFailed(InitializationSequence::FK_AddressOfOverloadFailed);
-else if (Initializer->getType()->isFunctionType() &&
+else if (Initializer && Initializer->getType()->isFunctionType() &&
  isExprAnUnaddressableFunction(S, Initializer))
   SetFailed(InitializationSequence::FK_AddressOfUnaddressableFunction);
 else
Index: lib/Sema/SemaExprCXX.cpp
===
--- 

Re: [PATCH] D19278: [scan-build] fix logic error warnings emitted on clang code base

2016-05-01 Thread Apelete Seketeli via cfe-commits
apelete added a reviewer: pcc.
apelete added a comment.

Waiting for review, could someone please have a look at this one ?


http://reviews.llvm.org/D19278



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19278: [scan-build] fix logic error warnings emitted on clang code base

2016-05-01 Thread Apelete Seketeli via cfe-commits
apelete updated this revision to Diff 55747.
apelete added a comment.

[scan-build] fix logic error warnings emitted on clang code base

Changes since last revision:

- fast forward rebase on git master branch.


http://reviews.llvm.org/D19278

Files:
  lib/AST/ExprConstant.cpp
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/SemaOverload.cpp
  lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp

Index: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
+++ lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
@@ -693,6 +693,8 @@
 !Param->getType()->isReferenceType())
   continue;
 
+assert(ArgExpr && "cannot get the type of a NULL expression");
+
 NullConstraint Nullness = getNullConstraint(*ArgSVal, State);
 
 Nullability RequiredNullability =
Index: lib/Sema/SemaOverload.cpp
===
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -8705,6 +8705,7 @@
 
 void Sema::diagnoseEquivalentInternalLinkageDeclarations(
 SourceLocation Loc, const NamedDecl *D, ArrayRef Equiv) {
+  assert(D && "named declaration must be not NULL");
   Diag(Loc, diag::ext_equivalent_internal_linkage_decl_in_modules) << D;
 
   Module *M = getOwningModule(const_cast(D));
@@ -9185,7 +9186,9 @@
 !ToRefTy->getPointeeType()->isIncompleteType() &&
 S.IsDerivedFrom(SourceLocation(), ToRefTy->getPointeeType(), FromTy)) {
   BaseToDerivedConversion = 3;
-} else if (ToTy->isLValueReferenceType() && !FromExpr->isLValue() &&
+} else if (FromExpr &&
+   !FromExpr->isLValue() &&
+   ToTy->isLValueReferenceType() &&
ToTy.getNonReferenceType().getCanonicalType() ==
FromTy.getNonReferenceType().getCanonicalType()) {
   S.Diag(Fn->getLocation(), diag::note_ovl_candidate_bad_lvalue)
Index: lib/Sema/SemaOpenMP.cpp
===
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -985,6 +985,7 @@
 (VD && DSAStack->isForceVarCapturing()))
   return VD ? VD : Info.second;
 auto DVarPrivate = DSAStack->getTopDSA(D, DSAStack->isClauseParsingMode());
+assert(DVarPrivate.PrivateCopy && "DSAStackTy object must be not NULL");
 if (DVarPrivate.CKind != OMPC_unknown && isOpenMPPrivate(DVarPrivate.CKind))
   return VD ? VD : cast(DVarPrivate.PrivateCopy->getDecl());
 DVarPrivate = DSAStack->hasDSA(D, isOpenMPPrivate, MatchesAlways(),
@@ -3994,6 +3995,7 @@
 static ExprResult
 tryBuildCapture(Sema , Expr *Capture,
 llvm::MapVector ) {
+  assert(Capture && "cannot build capture if expression is NULL");
   if (Capture->isEvaluatable(SemaRef.Context, Expr::SE_AllowSideEffects))
 return SemaRef.PerformImplicitConversion(
 Capture->IgnoreImpCasts(), Capture->getType(), Sema::AA_Converting,
@@ -4251,7 +4253,7 @@
 SemaRef.Diag(CollapseLoopCountExpr->getExprLoc(),
  diag::note_omp_collapse_ordered_expr)
 << 0 << CollapseLoopCountExpr->getSourceRange();
-  else
+  else if (OrderedLoopCountExpr)
 SemaRef.Diag(OrderedLoopCountExpr->getExprLoc(),
  diag::note_omp_collapse_ordered_expr)
 << 1 << OrderedLoopCountExpr->getSourceRange();
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -434,6 +434,9 @@
 /// error, false otherwise.
 bool Sema::MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old,
 Scope *S) {
+  assert(New && "New function declaration is NULL, aborting merge.");
+  assert(Old && "Old function declaration is NULL, aborting merge.");
+
   bool Invalid = false;
 
   // The declaration context corresponding to the scope is the semantic
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -2299,6 +2299,7 @@
 
 unsigned CodeGenModule::GetGlobalVarAddressSpace(const VarDecl *D,
  unsigned AddrSpace) {
+  assert(D && "variable declaration must be not NULL");
   if (LangOpts.CUDA && LangOpts.CUDAIsDevice) {
 if (D->hasAttr())
   AddrSpace = getContext().getTargetAddressSpace(LangAS::cuda_constant);
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -1314,6 +1314,7 @@
 CGM.getContext().toCharUnitsFromBits((int64_t)fieldOffset);
 V = CGM.getCXXABI().EmitMemberDataPointer(MPT, chars);
   }
+  assert(V && "constant 

Re: [PATCH] D19278: [scan-build] fix logic error warnings emitted on clang code base

2016-04-21 Thread Anna Zaks via cfe-commits
zaks.anna added inline comments.


Comment at: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp:696
@@ -695,1 +695,3 @@
 
+assert(ArgExpr && "cannot get the type of a NULL expression");
+

LGTM


http://reviews.llvm.org/D19278



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19278: [scan-build] fix logic error warnings emitted on clang code base

2016-04-20 Thread John McCall via cfe-commits
rjmccall added a comment.

LGTM, thanks.


http://reviews.llvm.org/D19278



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19278: [scan-build] fix logic error warnings emitted on clang code base

2016-04-19 Thread Apelete Seketeli via cfe-commits
apelete marked an inline comment as done.
apelete added a comment.

http://reviews.llvm.org/D19278



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19278: [scan-build] fix logic error warnings emitted on clang code base

2016-04-19 Thread Apelete Seketeli via cfe-commits
apelete updated this revision to Diff 54269.
apelete added a comment.

[scan-build] fix logic error warnings emitted on clang code base

Following changes were done since last revision:

- lib/Sema/SemaOverload.cpp: avoid interleaving (FromExpr) and 
(!FromExpr->isLValue()) conditions in if() statement for better readability.


http://reviews.llvm.org/D19278

Files:
  lib/AST/ExprConstant.cpp
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/SemaOverload.cpp
  lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp

Index: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
+++ lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
@@ -693,6 +693,8 @@
 !Param->getType()->isReferenceType())
   continue;
 
+assert(ArgExpr && "cannot get the type of a NULL expression");
+
 NullConstraint Nullness = getNullConstraint(*ArgSVal, State);
 
 Nullability RequiredNullability =
Index: lib/Sema/SemaOverload.cpp
===
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -8705,6 +8705,7 @@
 
 void Sema::diagnoseEquivalentInternalLinkageDeclarations(
 SourceLocation Loc, const NamedDecl *D, ArrayRef Equiv) {
+  assert(D && "named declaration must be not NULL");
   Diag(Loc, diag::ext_equivalent_internal_linkage_decl_in_modules) << D;
 
   Module *M = getOwningModule(const_cast(D));
@@ -9185,7 +9186,9 @@
 !ToRefTy->getPointeeType()->isIncompleteType() &&
 S.IsDerivedFrom(SourceLocation(), ToRefTy->getPointeeType(), FromTy)) {
   BaseToDerivedConversion = 3;
-} else if (ToTy->isLValueReferenceType() && !FromExpr->isLValue() &&
+} else if (FromExpr &&
+   !FromExpr->isLValue() &&
+   ToTy->isLValueReferenceType() &&
ToTy.getNonReferenceType().getCanonicalType() ==
FromTy.getNonReferenceType().getCanonicalType()) {
   S.Diag(Fn->getLocation(), diag::note_ovl_candidate_bad_lvalue)
Index: lib/Sema/SemaOpenMP.cpp
===
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -939,6 +939,7 @@
 (VD && DSAStack->isForceVarCapturing()))
   return VD ? VD : Info.second;
 auto DVarPrivate = DSAStack->getTopDSA(D, DSAStack->isClauseParsingMode());
+assert(DVarPrivate.PrivateCopy && "DSAStackTy object must be not NULL");
 if (DVarPrivate.CKind != OMPC_unknown && isOpenMPPrivate(DVarPrivate.CKind))
   return VD ? VD : cast(DVarPrivate.PrivateCopy->getDecl());
 DVarPrivate = DSAStack->hasDSA(D, isOpenMPPrivate, MatchesAlways(),
@@ -3924,6 +3925,7 @@
 static ExprResult
 tryBuildCapture(Sema , Expr *Capture,
 llvm::MapVector ) {
+  assert(Capture && "cannot build capture if expression is NULL");
   if (Capture->isEvaluatable(SemaRef.Context, Expr::SE_AllowSideEffects))
 return SemaRef.PerformImplicitConversion(
 Capture->IgnoreImpCasts(), Capture->getType(), Sema::AA_Converting,
@@ -4177,7 +4179,7 @@
 SemaRef.Diag(CollapseLoopCountExpr->getExprLoc(),
  diag::note_omp_collapse_ordered_expr)
 << 0 << CollapseLoopCountExpr->getSourceRange();
-  else
+  else if (OrderedLoopCountExpr)
 SemaRef.Diag(OrderedLoopCountExpr->getExprLoc(),
  diag::note_omp_collapse_ordered_expr)
 << 1 << OrderedLoopCountExpr->getSourceRange();
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -434,6 +434,9 @@
 /// error, false otherwise.
 bool Sema::MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old,
 Scope *S) {
+  assert(New && "New function declaration is NULL, aborting merge.");
+  assert(Old && "Old function declaration is NULL, aborting merge.");
+
   bool Invalid = false;
 
   // The declaration context corresponding to the scope is the semantic
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -2303,6 +2303,7 @@
 
 unsigned CodeGenModule::GetGlobalVarAddressSpace(const VarDecl *D,
  unsigned AddrSpace) {
+  assert(D && "variable declaration must be not NULL");
   if (LangOpts.CUDA && LangOpts.CUDAIsDevice) {
 if (D->hasAttr())
   AddrSpace = getContext().getTargetAddressSpace(LangAS::cuda_constant);
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -1312,6 +1312,7 @@
 

Re: [PATCH] D19278: [scan-build] fix logic error warnings emitted on clang code base

2016-04-19 Thread John McCall via cfe-commits
rjmccall added inline comments.


Comment at: lib/Sema/SemaOverload.cpp:9191
@@ -9189,1 +9190,3 @@
+   ToTy->isLValueReferenceType() &&
+   !FromExpr->isLValue() &&
ToTy.getNonReferenceType().getCanonicalType() ==

Interleaving these conditions looks strange.  Please group the FromExpr-related 
checks next to each other.

Otherwise LGTM.


http://reviews.llvm.org/D19278



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19278: [scan-build] fix logic error warnings emitted on clang code base

2016-04-19 Thread Apelete Seketeli via cfe-commits
apelete updated this revision to Diff 54246.
apelete added a comment.

[scan-build] fix logic error warnings emitted on clang code base

Following changes were done since last revision:

- fix a typo in lib/Sema/SemaDeclCXX.cpp: decalration ==> declaration.


http://reviews.llvm.org/D19278

Files:
  lib/AST/ExprConstant.cpp
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/SemaOverload.cpp
  lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp

Index: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
+++ lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
@@ -693,6 +693,8 @@
 !Param->getType()->isReferenceType())
   continue;
 
+assert(ArgExpr && "cannot get the type of a NULL expression");
+
 NullConstraint Nullness = getNullConstraint(*ArgSVal, State);
 
 Nullability RequiredNullability =
Index: lib/Sema/SemaOverload.cpp
===
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -8705,6 +8705,7 @@
 
 void Sema::diagnoseEquivalentInternalLinkageDeclarations(
 SourceLocation Loc, const NamedDecl *D, ArrayRef Equiv) {
+  assert(D && "named declaration must be not NULL");
   Diag(Loc, diag::ext_equivalent_internal_linkage_decl_in_modules) << D;
 
   Module *M = getOwningModule(const_cast(D));
@@ -9185,7 +9186,9 @@
 !ToRefTy->getPointeeType()->isIncompleteType() &&
 S.IsDerivedFrom(SourceLocation(), ToRefTy->getPointeeType(), FromTy)) {
   BaseToDerivedConversion = 3;
-} else if (ToTy->isLValueReferenceType() && !FromExpr->isLValue() &&
+} else if (FromExpr &&
+   ToTy->isLValueReferenceType() &&
+   !FromExpr->isLValue() &&
ToTy.getNonReferenceType().getCanonicalType() ==
FromTy.getNonReferenceType().getCanonicalType()) {
   S.Diag(Fn->getLocation(), diag::note_ovl_candidate_bad_lvalue)
Index: lib/Sema/SemaOpenMP.cpp
===
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -939,6 +939,7 @@
 (VD && DSAStack->isForceVarCapturing()))
   return VD ? VD : Info.second;
 auto DVarPrivate = DSAStack->getTopDSA(D, DSAStack->isClauseParsingMode());
+assert(DVarPrivate.PrivateCopy && "DSAStackTy object must be not NULL");
 if (DVarPrivate.CKind != OMPC_unknown && isOpenMPPrivate(DVarPrivate.CKind))
   return VD ? VD : cast(DVarPrivate.PrivateCopy->getDecl());
 DVarPrivate = DSAStack->hasDSA(D, isOpenMPPrivate, MatchesAlways(),
@@ -3924,6 +3925,7 @@
 static ExprResult
 tryBuildCapture(Sema , Expr *Capture,
 llvm::MapVector ) {
+  assert(Capture && "cannot build capture if expression is NULL");
   if (Capture->isEvaluatable(SemaRef.Context, Expr::SE_AllowSideEffects))
 return SemaRef.PerformImplicitConversion(
 Capture->IgnoreImpCasts(), Capture->getType(), Sema::AA_Converting,
@@ -4177,7 +4179,7 @@
 SemaRef.Diag(CollapseLoopCountExpr->getExprLoc(),
  diag::note_omp_collapse_ordered_expr)
 << 0 << CollapseLoopCountExpr->getSourceRange();
-  else
+  else if (OrderedLoopCountExpr)
 SemaRef.Diag(OrderedLoopCountExpr->getExprLoc(),
  diag::note_omp_collapse_ordered_expr)
 << 1 << OrderedLoopCountExpr->getSourceRange();
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -434,6 +434,9 @@
 /// error, false otherwise.
 bool Sema::MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old,
 Scope *S) {
+  assert(New && "New function declaration is NULL, aborting merge.");
+  assert(Old && "Old function declaration is NULL, aborting merge.");
+
   bool Invalid = false;
 
   // The declaration context corresponding to the scope is the semantic
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -2303,6 +2303,7 @@
 
 unsigned CodeGenModule::GetGlobalVarAddressSpace(const VarDecl *D,
  unsigned AddrSpace) {
+  assert(D && "variable declaration must be not NULL");
   if (LangOpts.CUDA && LangOpts.CUDAIsDevice) {
 if (D->hasAttr())
   AddrSpace = getContext().getTargetAddressSpace(LangAS::cuda_constant);
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -1312,6 +1312,7 @@
 CGM.getContext().toCharUnitsFromBits((int64_t)fieldOffset);
 V = CGM.getCXXABI().EmitMemberDataPointer(MPT, 

Re: [PATCH] D19278: [scan-build] fix logic error warnings emitted on clang code base

2016-04-19 Thread Mandeep Singh Grang via cfe-commits
mgrang added a subscriber: mgrang.


Comment at: lib/Sema/SemaDeclCXX.cpp:438
@@ +437,3 @@
+  assert(New && "New function decalration is NULL, aborting merge.");
+  assert(Old && "Old function decalration is NULL, aborting merge.");
+

typo: decalration ==> declaration


http://reviews.llvm.org/D19278



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits