From fd6d0821ebfe990a3b4ebdfb9c2c9561a6b594eb Mon Sep 17 00:00:00 2001 From: Devin Coughlin Date: Tue, 7 Jun 2016 05:37:02 +0000 Subject: Revert "[analyzer] Reapply r271907 (2nd try)." Even with the fix in r271981, ASan is finding a stack use after return. This reverts commits r271977 and r271981. llvm-svn: 271984 --- clang/lib/StaticAnalyzer/Core/MemRegion.cpp | 59 ----------------------------- 1 file changed, 59 deletions(-) (limited to 'clang/lib/StaticAnalyzer/Core/MemRegion.cpp') diff --git a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp index b7b6f42b291..083f6c01bc2 100644 --- a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp +++ b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -632,65 +632,6 @@ void CXXBaseObjectRegion::printPrettyAsExpr(raw_ostream &os) const { superRegion->printPrettyAsExpr(os); } -std::string MemRegion::getDescriptiveName(bool UseQuotes) const { - std::string VariableName; - std::string ArrayIndices; - const MemRegion *R = this; - SmallString<50> buf; - llvm::raw_svector_ostream os(buf); - - // Obtain array indices to add them to the variable name. - const ElementRegion *ER = nullptr; - while ((ER = R->getAs())) { - // Index is a ConcreteInt. - if (auto CI = ER->getIndex().getAs()) { - llvm::SmallString<2> Idx; - CI->getValue().toString(Idx); - ArrayIndices = (llvm::Twine("[") + Idx.str() + "]" + ArrayIndices).str(); - } - // If not a ConcreteInt, try to obtain the variable - // name by calling 'getDescriptiveName' recursively. - else { - std::string Idx = ER->getDescriptiveName(false); - if (!Idx.empty()) { - ArrayIndices = (llvm::Twine("[") + Idx + "]" + ArrayIndices).str(); - } - } - R = ER->getSuperRegion(); - } - - // Get variable name. - if (R && R->canPrintPrettyAsExpr()) { - R->printPrettyAsExpr(os); - if (UseQuotes) { - return (llvm::Twine("'") + os.str() + ArrayIndices + "'").str(); - } else { - return (llvm::Twine(os.str()) + ArrayIndices).str(); - } - } - - return VariableName; -} - -SourceRange MemRegion::sourceRange() const { - const VarRegion *const VR = dyn_cast(this->getBaseRegion()); - const FieldRegion *const FR = dyn_cast(this); - - // Check for more specific regions first. - // FieldRegion - if (FR) { - return FR->getDecl()->getSourceRange(); - } - // VarRegion - else if (VR) { - return VR->getDecl()->getSourceRange(); - } - // Return invalid source range (can be checked by client). - else { - return SourceRange{}; - } -} - //===----------------------------------------------------------------------===// // MemRegionManager methods. //===----------------------------------------------------------------------===// -- cgit v1.2.3