Skip to content

Commit 2ceb18b

Browse files
NagyDonatsteakhal
andauthored
Apply suggestions from code review
Co-authored-by: Balazs Benics <[email protected]>
1 parent 690e311 commit 2ceb18b

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

clang/lib/StaticAnalyzer/Core/MemRegion.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,8 +1222,7 @@ MemRegionManager::getElementRegion(QualType elementType, NonLoc Idx,
12221222
// The address space must be preserved because some target-specific address
12231223
// spaces influence the size of the pointer value which is represented by the
12241224
// element region.
1225-
LangAS AS = elementType.getAddressSpace();
1226-
if (AS != LangAS::Default) {
1225+
if (LangAS AS = elementType.getAddressSpace()) {
12271226
Qualifiers Quals;
12281227
Quals.setAddressSpace(AS);
12291228
T = Ctx.getQualifiedType(T, Quals);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// RUN: %clang_analyze_cc1 -triple amdgcn-unknown-unknown \
2-
// RUN: -analyzer-checker=core,unix.Malloc -verify %s
2+
// RUN: -analyzer-checker=core -verify %s
33

44
// expected-no-diagnostics
55
//
66
// By default, pointers are 64-bits.
77
#define ADDRESS_SPACE_32BITS __attribute__((address_space(3)))
88

99
int test(ADDRESS_SPACE_32BITS int *p, ADDRESS_SPACE_32BITS void *q) {
10-
return p == q;
10+
return p == q; // no-crash
1111
}

0 commit comments

Comments
 (0)