[llvm] 639b85e - [IR] Assert on getPointerElementType() on opaque pointer (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 1 02:41:17 PST 2021
Author: Nikita Popov
Date: 2021-12-01T11:41:06+01:00
New Revision: 639b85ea0ba2f19ec3ad682f2715b312cfc691da
URL: https://github.com/llvm/llvm-project/commit/639b85ea0ba2f19ec3ad682f2715b312cfc691da
DIFF: https://github.com/llvm/llvm-project/commit/639b85ea0ba2f19ec3ad682f2715b312cfc691da.diff
LOG: [IR] Assert on getPointerElementType() on opaque pointer (NFC)
Previously this simply crashed.
Added:
Modified:
llvm/include/llvm/IR/Type.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Type.h b/llvm/include/llvm/IR/Type.h
index 47431adc6fac..c899c46d4055 100644
--- a/llvm/include/llvm/IR/Type.h
+++ b/llvm/include/llvm/IR/Type.h
@@ -368,6 +368,8 @@ class Type {
Type *getPointerElementType() const {
assert(getTypeID() == PointerTyID);
+ assert(NumContainedTys &&
+ "Attempting to get element type of opaque pointer");
return ContainedTys[0];
}
More information about the llvm-commits
mailing list