summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDavid Bolvansky <david.bolvansky@gmail.com>2019-09-06 16:30:44 +0000
committerDavid Bolvansky <david.bolvansky@gmail.com>2019-09-06 16:30:44 +0000
commit454e40eaf328fe34cda7f24d33a1f47060b5ee1a (patch)
tree4944cdc245b48ba1582c0aba5476168b7dab2361 /clang/lib
parent2682bc3c9d1ec7da324bedfa46fce537797b5a49 (diff)
downloadbcm5719-llvm-454e40eaf328fe34cda7f24d33a1f47060b5ee1a.tar.gz
bcm5719-llvm-454e40eaf328fe34cda7f24d33a1f47060b5ee1a.zip
[NFCI] Unbreak buildbots
llvm-svn: 371226
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp32
1 files changed, 10 insertions, 22 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index ca7cf94f9c4..3001be23cf8 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -9154,29 +9154,17 @@ static void DiagnoseDivisionSizeofPointerOrArray(Sema &S, Expr *LHS, Expr *RHS,
else
RHSTy = RUE->getArgumentExpr()->IgnoreParens()->getType();
- if (LHSTy->isPointerType() && !RHSTy->isPointerType()) {
- if (LHSTy->getPointeeType().getCanonicalType().getUnqualifiedType() !=
- RHSTy.getCanonicalType().getUnqualifiedType())
- return;
+ if (!LHSTy->isPointerType() || RHSTy->isPointerType())
+ return;
+ if (LHSTy->getPointeeType().getCanonicalType().getUnqualifiedType() !=
+ RHSTy.getCanonicalType().getUnqualifiedType())
+ return;
- S.Diag(Loc, diag::warn_division_sizeof_ptr) << LHS << LHS->getSourceRange();
- if (const auto *DRE = dyn_cast<DeclRefExpr>(LHSArg)) {
- if (const ValueDecl *LHSArgDecl = DRE->getDecl())
- S.Diag(LHSArgDecl->getLocation(), diag::note_pointer_declared_here)
- << LHSArgDecl;
- }
- } else if (isa<ArrayType>(LHSTy) && !RHSTy->isArrayType()) {
- QualType ArrayElemTy = cast<ArrayType>(LHSTy)->getElementType();
- if (isa<ArrayType>(ArrayElemTy) ||
- ArrayElemTy.getCanonicalType().getUnqualifiedType() ==
- RHSTy.getCanonicalType().getUnqualifiedType())
- return;
- S.Diag(Loc, diag::warn_division_sizeof_array) << ArrayElemTy << RHSTy;
- if (const auto *DRE = dyn_cast<DeclRefExpr>(LHSArg)) {
- if (const ValueDecl *LHSArgDecl = DRE->getDecl())
- S.Diag(LHSArgDecl->getLocation(), diag::note_array_declared_here)
- << LHSArgDecl;
- }
+ S.Diag(Loc, diag::warn_division_sizeof_ptr) << LHS << LHS->getSourceRange();
+ if (const auto *DRE = dyn_cast<DeclRefExpr>(LHSArg)) {
+ if (const ValueDecl *LHSArgDecl = DRE->getDecl())
+ S.Diag(LHSArgDecl->getLocation(), diag::note_pointer_declared_here)
+ << LHSArgDecl;
}
}
OpenPOWER on IntegriCloud