aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-02-18 12:57:05 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-02-18 12:57:05 +0000
commit3460f221cd9d3329aefb3f10a0f9d0800d8db70a (patch)
treea06fa6c3885cd096683a523e497217be6a16cca3 /tools
parentb49985a8499e18675db7e9baf920d6ef4e2b65cf (diff)
downloadexternal_llvm-3460f221cd9d3329aefb3f10a0f9d0800d8db70a.zip
external_llvm-3460f221cd9d3329aefb3f10a0f9d0800d8db70a.tar.gz
external_llvm-3460f221cd9d3329aefb3f10a0f9d0800d8db70a.tar.bz2
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
Diffstat (limited to 'tools')
-rw-r--r--tools/opt/opt.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 5200180..b123d54 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -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;