[clang] 435225c - [clang][Interp][NFC] Remove an unnecessary isArray() check
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 27 00:02:54 PST 2023
Author: Timm Bäder
Date: 2023-01-27T09:00:51+01:00
New Revision: 435225c6e2f860ecc53fcd65e193f832569d090e
URL: https://github.com/llvm/llvm-project/commit/435225c6e2f860ecc53fcd65e193f832569d090e
DIFF: https://github.com/llvm/llvm-project/commit/435225c6e2f860ecc53fcd65e193f832569d090e.diff
LOG: [clang][Interp][NFC] Remove an unnecessary isArray() check
We already do an isPrimitiveArray() check, so no need for the isArray()
check.
Added:
Modified:
clang/lib/AST/Interp/Pointer.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/Pointer.cpp b/clang/lib/AST/Interp/Pointer.cpp
index fd8c98fae039..e25b4f8b5844 100644
--- a/clang/lib/AST/Interp/Pointer.cpp
+++ b/clang/lib/AST/Interp/Pointer.cpp
@@ -166,22 +166,20 @@ void Pointer::initialize() const {
Descriptor *Desc = getFieldDesc();
assert(Desc);
- if (Desc->isArray()) {
- if (Desc->isPrimitiveArray()) {
- // Primitive global arrays don't have an initmap.
- if (isStatic() && Base == 0)
- return;
-
- // Primitive array initializer.
- InitMap *&Map = getInitMap();
- if (Map == (InitMap *)-1)
- return;
- if (Map == nullptr)
- Map = InitMap::allocate(Desc->getNumElems());
- if (Map->initialize(getIndex())) {
- free(Map);
- Map = (InitMap *)-1;
- }
+ if (Desc->isPrimitiveArray()) {
+ // Primitive global arrays don't have an initmap.
+ if (isStatic() && Base == 0)
+ return;
+
+ // Primitive array initializer.
+ InitMap *&Map = getInitMap();
+ if (Map == (InitMap *)-1)
+ return;
+ if (Map == nullptr)
+ Map = InitMap::allocate(Desc->getNumElems());
+ if (Map->initialize(getIndex())) {
+ free(Map);
+ Map = (InitMap *)-1;
}
} else {
// Field has its bit in an inline descriptor.
More information about the cfe-commits
mailing list