forked from OSchip/llvm-project
Fix an ASAN detected bug introduced by cr/227067644. While MLFunctions always
have one block, CFG Functions don't necessarily have one (e.g. when they are being first constructed by the parser). PiperOrigin-RevId: 227075636
This commit is contained in:
parent
1b430f1d32
commit
bd24a131d3
|
@ -163,10 +163,13 @@ protected:
|
||||||
/// automatically inserted at an insertion point. The builder is copyable.
|
/// automatically inserted at an insertion point. The builder is copyable.
|
||||||
class FuncBuilder : public Builder {
|
class FuncBuilder : public Builder {
|
||||||
public:
|
public:
|
||||||
/// Create an ML function builder and set the insertion point to the start of
|
/// Create a function builder and set the insertion point to the start of
|
||||||
/// the function.
|
/// the function.
|
||||||
FuncBuilder(Function *func) : Builder(func->getContext()), function(func) {
|
FuncBuilder(Function *func) : Builder(func->getContext()), function(func) {
|
||||||
setInsertionPoint(&func->front(), func->front().begin());
|
if (!func->empty())
|
||||||
|
setInsertionPoint(&func->front(), func->front().begin());
|
||||||
|
else
|
||||||
|
clearInsertionPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a function builder and set insertion point to the given statement,
|
/// Create a function builder and set insertion point to the given statement,
|
||||||
|
|
Loading…
Reference in New Issue