aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp')
-rw-r--r--clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp36
1 files changed, 30 insertions, 6 deletions
diff --git a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
index acb38e5..01db658 100644
--- a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
+++ b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
@@ -1009,12 +1009,15 @@ bool Environment::allows(const Formula &F) const {
}
void Environment::dump(raw_ostream &OS) const {
- // FIXME: add printing for remaining fields and allow caller to decide what
- // fields are printed.
- OS << "DeclToLoc:\n";
- for (auto [D, L] : DeclToLoc)
- OS << " [" << D->getNameAsString() << ", " << L << "]\n";
+ llvm::DenseMap<const StorageLocation *, std::string> LocToName;
+ if (ThisPointeeLoc != nullptr)
+ LocToName[ThisPointeeLoc] = "this";
+ OS << "DeclToLoc:\n";
+ for (auto [D, L] : DeclToLoc) {
+ auto Iter = LocToName.insert({L, D->getNameAsString()}).first;
+ OS << " [" << Iter->second << ", " << L << "]\n";
+ }
OS << "ExprToLoc:\n";
for (auto [E, L] : ExprToLoc)
OS << " [" << E << ", " << L << "]\n";
@@ -1025,7 +1028,28 @@ void Environment::dump(raw_ostream &OS) const {
OS << "LocToVal:\n";
for (auto [L, V] : LocToVal) {
- OS << " [" << L << ", " << V << ": " << *V << "]\n";
+ OS << " [" << L;
+ if (auto Iter = LocToName.find(L); Iter != LocToName.end())
+ OS << " (" << Iter->second << ")";
+ OS << ", " << V << ": " << *V << "]\n";
+ }
+
+ if (const FunctionDecl *Func = getCurrentFunc()) {
+ if (Func->getReturnType()->isReferenceType()) {
+ OS << "ReturnLoc: " << ReturnLoc;
+ if (auto Iter = LocToName.find(ReturnLoc); Iter != LocToName.end())
+ OS << " (" << Iter->second << ")";
+ OS << "\n";
+ } else if (!Func->getReturnType()->isVoidType()) {
+ if (ReturnVal == nullptr)
+ OS << "ReturnVal: nullptr\n";
+ else
+ OS << "ReturnVal: " << *ReturnVal << "\n";
+ }
+
+ if (isa<CXXMethodDecl>(Func)) {
+ OS << "ThisPointeeLoc: " << ThisPointeeLoc << "\n";
+ }
}
OS << "\n";