Define addString() and lookup() out-of-line to dissuade the C++ compiler from inlining it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45068 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anton Korobeynikov
2007-12-16 01:36:16 +00:00
parent 11ffccf2a5
commit cdd0417ba3

View File

@@ -178,7 +178,14 @@ public:
inline Node* getRoot() const { return Nodes[0]; }
bool addString(const std::string& s, const Payload& data) {
bool addString(const std::string& s, const Payload& data);
const Payload& lookup(const std::string& s) const;
};
// Define this out-of-line to dissuade the C++ compiler from inlining it.
template<class Payload>
bool Trie<Payload>::addString(const std::string& s, const Payload& data) {
Node* cNode = getRoot();
Node* tNode = NULL;
std::string s1(s);
@@ -214,9 +221,10 @@ public:
}
return true;
}
}
const Payload& lookup(const std::string& s) const {
template<class Payload>
const Payload& Trie<Payload>::lookup(const std::string& s) const {
Node* cNode = getRoot();
Node* tNode = NULL;
std::string s1(s);
@@ -247,9 +255,7 @@ public:
}
return tNode->data();
}
};
}
template<class Payload>
struct GraphTraits<Trie<Payload> > {