summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKaelyn Uhrain <rikka@google.com>2013-12-07 00:13:34 +0000
committerKaelyn Uhrain <rikka@google.com>2013-12-07 00:13:34 +0000
commitb95d0907fc6859b5f502a108e8793fa5335bf580 (patch)
treeb26af9e38fe657bb17c16f42203fb8f0d29b46b6 /include
parent46af5e8efabfcd57b5872cda3eb10d92ca1780d4 (diff)
downloadllvm-b95d0907fc6859b5f502a108e8793fa5335bf580.tar.gz
llvm-b95d0907fc6859b5f502a108e8793fa5335bf580.tar.bz2
llvm-b95d0907fc6859b5f502a108e8793fa5335bf580.tar.xz
Fix the segfault reported in PR 11990.
The sefault occurs due to an infinite loop when the verifier tries to determine the size of a type of the form "%rt = type { %rt }" while checking an alloca of the type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196626 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/IR/DerivedTypes.h2
-rw-r--r--include/llvm/IR/Type.h7
2 files changed, 5 insertions, 4 deletions
diff --git a/include/llvm/IR/DerivedTypes.h b/include/llvm/IR/DerivedTypes.h
index e279e60e47..758ef71a1f 100644
--- a/include/llvm/IR/DerivedTypes.h
+++ b/include/llvm/IR/DerivedTypes.h
@@ -249,7 +249,7 @@ public:
bool isOpaque() const { return (getSubclassData() & SCDB_HasBody) == 0; }
/// isSized - Return true if this is a sized type.
- bool isSized() const;
+ bool isSized(SmallPtrSet<const Type*, 4> *Visited = 0) const;
/// hasName - Return true if this is a named struct that has a non-empty name.
bool hasName() const { return SymbolTableEntry != 0; }
diff --git a/include/llvm/IR/Type.h b/include/llvm/IR/Type.h
index 3cfb84edd8..9e833dbe6f 100644
--- a/include/llvm/IR/Type.h
+++ b/include/llvm/IR/Type.h
@@ -16,6 +16,7 @@
#define LLVM_IR_TYPE_H
#include "llvm/ADT/APFloat.h"
+#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CBindingWrapping.h"
#include "llvm/Support/DataTypes.h"
@@ -275,7 +276,7 @@ public:
/// get the actual size for a particular target, it is reasonable to use the
/// DataLayout subsystem to do this.
///
- bool isSized() const {
+ bool isSized(SmallPtrSet<const Type*, 4> *Visited = 0) const {
// If it's a primitive, it is always sized.
if (getTypeID() == IntegerTyID || isFloatingPointTy() ||
getTypeID() == PointerTyID ||
@@ -287,7 +288,7 @@ public:
getTypeID() != VectorTyID)
return false;
// Otherwise we have to try harder to decide.
- return isSizedDerivedType();
+ return isSizedDerivedType(Visited);
}
/// getPrimitiveSizeInBits - Return the basic size of this type if it is a
@@ -429,7 +430,7 @@ private:
/// isSizedDerivedType - Derived types like structures and arrays are sized
/// iff all of the members of the type are sized as well. Since asking for
/// their size is relatively uncommon, move this operation out of line.
- bool isSizedDerivedType() const;
+ bool isSizedDerivedType(SmallPtrSet<const Type*, 4> *Visited = 0) const;
};
// Printing of types.