[PATCH] D89982: [analyzer] [NFC] Simplify SVal::getAsLocSymbol function using existing functions
Denys Petrov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 26 08:00:47 PDT 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG32efb81ea60a: [analyzer] [NFC] Simplify SVal::getAsLocSymbol function using existing functions (authored by ASDenysPetrov).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89982/new/
https://reviews.llvm.org/D89982
Files:
clang/lib/StaticAnalyzer/Core/SVals.cpp
Index: clang/lib/StaticAnalyzer/Core/SVals.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/SVals.cpp
+++ clang/lib/StaticAnalyzer/Core/SVals.cpp
@@ -84,16 +84,12 @@
/// the first symbolic parent region is returned.
SymbolRef SVal::getAsLocSymbol(bool IncludeBaseRegions) const {
// FIXME: should we consider SymbolRef wrapped in CodeTextRegion?
- if (Optional<nonloc::LocAsInteger> X = getAs<nonloc::LocAsInteger>())
- return X->getLoc().getAsLocSymbol(IncludeBaseRegions);
-
- if (Optional<loc::MemRegionVal> X = getAs<loc::MemRegionVal>()) {
- const MemRegion *R = X->getRegion();
- if (const SymbolicRegion *SymR = IncludeBaseRegions ?
- R->getSymbolicBase() :
- dyn_cast<SymbolicRegion>(R->StripCasts()))
+ if (const MemRegion *R = getAsRegion())
+ if (const SymbolicRegion *SymR =
+ IncludeBaseRegions ? R->getSymbolicBase()
+ : dyn_cast<SymbolicRegion>(R->StripCasts()))
return SymR->getSymbol();
- }
+
return nullptr;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89982.300676.patch
Type: text/x-patch
Size: 1134 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201026/4b8feb93/attachment.bin>
More information about the cfe-commits
mailing list