summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-03-02 03:54:43 +0000
committerChris Lattner <sabre@nondot.org>2005-03-02 03:54:43 +0000
commitfe760deb752c06253ad373703b1f51b9dc6f8b08 (patch)
tree095248497fa72665cbf8a9eaf7d8242e146fdf40
parent884ebd4c79b317efc7977c3861851f9cea9f2bb4 (diff)
downloadbcm5719-llvm-fe760deb752c06253ad373703b1f51b9dc6f8b08.tar.gz
bcm5719-llvm-fe760deb752c06253ad373703b1f51b9dc6f8b08.zip
Fix a nasty order of evaluation bug that Gabor Greif ran into. Here's an
explanation from IRC: |sabre| I think it's an order of evaluation thing |sabre| for me, the RHS of the assignment is evaluated first |sabre| getTypeDescription checks to see if ConcreteTypeDescription[Ty] contains anything |sabre| since it doesn't, it computes and returns the value |sabre| this gets put into the map. |sabre| For you, the LHS is evaluated first. |sabre| Map[Ty] (aka ConcreteTypeDescriptions[Ty]) inserts an empty string into the map, returning a reference |sabre| getTypeDesc then sees the empty string in the map |sabre| and returns it |sabre| bork :) llvm-svn: 20394
-rw-r--r--llvm/lib/VMCore/Type.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/Type.cpp b/llvm/lib/VMCore/Type.cpp
index d2d6a2a9439..875de4b6357 100644
--- a/llvm/lib/VMCore/Type.cpp
+++ b/llvm/lib/VMCore/Type.cpp
@@ -291,7 +291,8 @@ static const std::string &getOrCreateDesc(std::map<const Type*,std::string>&Map,
if (I != Map.end()) return I->second;
std::vector<const Type *> TypeStack;
- return Map[Ty] = getTypeDescription(Ty, TypeStack);
+ std::string Result = getTypeDescription(Ty, TypeStack);
+ return Map[Ty] = Result;
}
OpenPOWER on IntegriCloud