diff options
author | Alex Lorenz <arphaman@gmail.com> | 2017-04-18 20:54:23 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2017-04-18 20:54:23 +0000 |
commit | 6e613778717c7bfca8f9aabd5fc43ee0926e6098 (patch) | |
tree | 507e77f4e2843b70bd86c97e0f0477e7abab2390 /include/clang/Basic/AttrSubjectMatchRules.h | |
parent | 9a355a6a8807b63b1abe5ade63c7a8ff48adc2dc (diff) | |
download | clang-6e613778717c7bfca8f9aabd5fc43ee0926e6098.tar.gz |
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
Diffstat (limited to 'include/clang/Basic/AttrSubjectMatchRules.h')
-rw-r--r-- | include/clang/Basic/AttrSubjectMatchRules.h | 16 |
1 files changed, 1 insertions, 15 deletions
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<SubjectMatchRule, SourceRange>; +using ParsedSubjectMatchRuleSet = llvm::DenseMap<int, SourceRange>; } // end namespace attr } // end namespace clang -namespace llvm { - -template <> -struct DenseMapInfo<clang::attr::SubjectMatchRule> : DenseMapInfo<int> { - static inline clang::attr::SubjectMatchRule getEmptyKey() { - return (clang::attr::SubjectMatchRule)DenseMapInfo<int>::getEmptyKey(); - } - static inline clang::attr::SubjectMatchRule getTombstoneKey() { - return (clang::attr::SubjectMatchRule)DenseMapInfo<int>::getTombstoneKey(); - } -}; - -} // end namespace llvm - #endif |