diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-08-12 15:00:55 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-08-12 15:00:55 +0000 |
commit | 0d2ed35d3ea8a6625142d677dd71ee44ee0ec1b1 (patch) | |
tree | d5685e7f6ca791232121b4b7fa974c6ce90e2063 /llvm/lib/Support/YAMLParser.cpp | |
parent | ad7eb9db466874dbc28c0dc2fbeb7226bbd9004b (diff) | |
download | bcm5719-llvm-0d2ed35d3ea8a6625142d677dd71ee44ee0ec1b1.tar.gz bcm5719-llvm-0d2ed35d3ea8a6625142d677dd71ee44ee0ec1b1.zip |
ADT: Share code for embedded sentinel traits, NFC
Share code for the (mostly problematic) embedded sentinel traits.
- Move the LLVM_NO_SANITIZE("object-size") attribute to
ilist_half_embedded_sentinel_traits and ilist_embedded_sentinel_traits
(previously it spread throughout the code duplication).
- Add an ilist_full_embedded_sentinel_traits which has no UB (but has
the downside of storing the complete node).
- Replace all the custom sentinel traits in LLVM with a declaration of
ilist_sentinel_traits that inherits from one of the embedded sentinel
traits classes.
There are still custom sentinel traits in other LLVM subprojects. I'll
remove those in a follow-up.
Nothing at all should be changing here, this is just rearranging code.
Note that the final goal here is to remove the sentinel traits
altogether, settling on the memory layout of
ilist_half_embedded_sentinel_traits without the UB. This intermediate
step moves the logic into ilist.h.
llvm-svn: 278513
Diffstat (limited to 'llvm/lib/Support/YAMLParser.cpp')
-rw-r--r-- | llvm/lib/Support/YAMLParser.cpp | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/llvm/lib/Support/YAMLParser.cpp b/llvm/lib/Support/YAMLParser.cpp index 2b71c596cc4..4d5b750e266 100644 --- a/llvm/lib/Support/YAMLParser.cpp +++ b/llvm/lib/Support/YAMLParser.cpp @@ -149,20 +149,9 @@ struct Token : ilist_node<Token> { } namespace llvm { -template<> -struct ilist_sentinel_traits<Token> { - Token *createSentinel() const { - return &Sentinel; - } - static void destroySentinel(Token*) {} - - Token *provideInitialHead() const { return createSentinel(); } - Token *ensureHead(Token*) const { return createSentinel(); } - static void noteHead(Token*, Token*) {} - -private: - mutable Token Sentinel; -}; +template <> +struct ilist_sentinel_traits<Token> + : public ilist_full_embedded_sentinel_traits<Token> {}; template<> struct ilist_node_traits<Token> { |