From 6e613778717c7bfca8f9aabd5fc43ee0926e6098 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Tue, 18 Apr 2017 20:54:23 +0000 Subject: The SubjectMatchRule enum should not be used as a DenseMap key to avoid UBSAN 'invalid value' failures The commit r300556 introduced a UBSAN issue that was caught by http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap. The DenseMap failed to create an empty/tombstone value as the empty/tombstone values for the SubjectMatchRule enum were not valid enum constants. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300591 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/AttrSubjectMatchRules.h | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'include/clang/Basic/AttrSubjectMatchRules.h') diff --git a/include/clang/Basic/AttrSubjectMatchRules.h b/include/clang/Basic/AttrSubjectMatchRules.h index 955f495ad6..4c88adf57f 100644 --- a/include/clang/Basic/AttrSubjectMatchRules.h +++ b/include/clang/Basic/AttrSubjectMatchRules.h @@ -24,23 +24,9 @@ enum SubjectMatchRule { const char *getSubjectMatchRuleSpelling(SubjectMatchRule Rule); -using ParsedSubjectMatchRuleSet = llvm::DenseMap; +using ParsedSubjectMatchRuleSet = llvm::DenseMap; } // end namespace attr } // end namespace clang -namespace llvm { - -template <> -struct DenseMapInfo : DenseMapInfo { - static inline clang::attr::SubjectMatchRule getEmptyKey() { - return (clang::attr::SubjectMatchRule)DenseMapInfo::getEmptyKey(); - } - static inline clang::attr::SubjectMatchRule getTombstoneKey() { - return (clang::attr::SubjectMatchRule)DenseMapInfo::getTombstoneKey(); - } -}; - -} // end namespace llvm - #endif -- cgit v1.2.1