diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-02-21 22:23:56 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-02-21 22:23:56 +0000 |
commit | 7a95de68c093991047ed8d339479ccad51b88663 (patch) | |
tree | 30fb6ba3d10757a7453dab5e854dc12db3cd1168 /lib/StaticAnalyzer/Core/PathDiagnostic.cpp | |
parent | 94f3f549a7e0c426d5ffda7f25d1983c885dab9c (diff) |
Replace ProgramPoint llvm::cast support to be well-defined.
See r175462 for another example/more details.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175812 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/PathDiagnostic.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/PathDiagnostic.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp index 12d85db7cb..b27a80f93c 100644 --- a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -583,29 +583,24 @@ PathDiagnosticLocation const SourceManager &SMng) { const Stmt* S = 0; - if (const BlockEdge *BE = dyn_cast<BlockEdge>(&P)) { + if (Optional<BlockEdge> BE = P.getAs<BlockEdge>()) { const CFGBlock *BSrc = BE->getSrc(); S = BSrc->getTerminatorCondition(); - } - else if (const StmtPoint *SP = dyn_cast<StmtPoint>(&P)) { + } else if (Optional<StmtPoint> SP = P.getAs<StmtPoint>()) { S = SP->getStmt(); - if (isa<PostStmtPurgeDeadSymbols>(P)) + if (P.getAs<PostStmtPurgeDeadSymbols>()) return PathDiagnosticLocation::createEnd(S, SMng, P.getLocationContext()); - } - else if (const PostImplicitCall *PIE = dyn_cast<PostImplicitCall>(&P)) { + } else if (Optional<PostImplicitCall> PIE = P.getAs<PostImplicitCall>()) { return PathDiagnosticLocation(PIE->getLocation(), SMng); - } - else if (const CallEnter *CE = dyn_cast<CallEnter>(&P)) { + } else if (Optional<CallEnter> CE = P.getAs<CallEnter>()) { return getLocationForCaller(CE->getCalleeContext(), CE->getLocationContext(), SMng); - } - else if (const CallExitEnd *CEE = dyn_cast<CallExitEnd>(&P)) { + } else if (Optional<CallExitEnd> CEE = P.getAs<CallExitEnd>()) { return getLocationForCaller(CEE->getCalleeContext(), CEE->getLocationContext(), SMng); - } - else { + } else { llvm_unreachable("Unexpected ProgramPoint"); } @@ -622,13 +617,13 @@ PathDiagnosticLocation while (NI) { ProgramPoint P = NI->getLocation(); - if (const StmtPoint *PS = dyn_cast<StmtPoint>(&P)) { + if (Optional<StmtPoint> PS = P.getAs<StmtPoint>()) { S = PS->getStmt(); - if (isa<PostStmtPurgeDeadSymbols>(P)) + if (P.getAs<PostStmtPurgeDeadSymbols>()) return PathDiagnosticLocation::createEnd(S, SM, NI->getLocationContext()); break; - } else if (const BlockEdge *BE = dyn_cast<BlockEdge>(&P)) { + } else if (Optional<BlockEdge> BE = P.getAs<BlockEdge>()) { S = BE->getSrc()->getTerminator(); break; } @@ -998,7 +993,7 @@ StackHintGenerator::~StackHintGenerator() {} std::string StackHintGeneratorForSymbol::getMessage(const ExplodedNode *N){ ProgramPoint P = N->getLocation(); - const CallExitEnd *CExit = dyn_cast<CallExitEnd>(&P); + Optional<CallExitEnd> CExit = P.getAs<CallExitEnd>(); assert(CExit && "Stack Hints should be constructed at CallExitEnd points."); // FIXME: Use CallEvent to abstract this over all calls. |