Avoid a dangling pointer dereference, PassManager::add can delete the Pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96576 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2010-02-18 12:57:05 +00:00
parent b49985a849
commit 3460f221cd

View File

@ -475,10 +475,11 @@ int main(int argc, char **argv) {
errs() << argv[0] << ": cannot create pass: "
<< PassInf->getPassName() << "\n";
if (P) {
PassKind Kind = P->getPassKind();
addPass(Passes, P);
if (AnalyzeOnly) {
switch (P->getPassKind()) {
switch (Kind) {
case PT_BasicBlock:
Passes.add(new BasicBlockPassPrinter(PassInf));
break;