summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2014-11-29 14:18:05 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2014-11-29 14:18:05 +0000
commit4bd88e3debd7facdcbfffdec82c14c5ddd4ecc50 (patch)
treeda976a6f63ec6595d3443458506bf6a0fce2b86e /compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc
parentc7e220f6e0e7996617ca5a6b4f4d5226b671491b (diff)
downloadbcm5719-llvm-4bd88e3debd7facdcbfffdec82c14c5ddd4ecc50.tar.gz
bcm5719-llvm-4bd88e3debd7facdcbfffdec82c14c5ddd4ecc50.zip
Add a HasSuppressionType method into SuppressionContext
Extending SuppressionContext to add a HasSuppressionType method that tells whether a certain suppression type is currently used or not. It's a step to implement issue suppressions for ASan, see http://reviews.llvm.org/D6280. Reviewed at http://reviews.llvm.org/D6443 llvm-svn: 222954
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc b/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc
index 7f76693e57c..2d6f76a8560 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc
@@ -70,6 +70,10 @@ bool TemplateMatch(char *templ, const char *str) {
ALIGNED(64) static char placeholder[sizeof(SuppressionContext)];
static SuppressionContext *suppression_ctx = 0;
+SuppressionContext::SuppressionContext() : suppressions_(1), can_parse_(true) {
+ internal_memset(has_suppresson_type_, 0, sizeof(has_suppresson_type_));
+}
+
SuppressionContext *SuppressionContext::Get() {
CHECK(suppression_ctx);
return suppression_ctx;
@@ -96,6 +100,8 @@ void SuppressionContext::InitIfNecessary() {
bool SuppressionContext::Match(const char *str, SuppressionType type,
Suppression **s) {
+ if (!has_suppresson_type_[type])
+ return false;
can_parse_ = false;
uptr i;
for (i = 0; i < suppressions_.size(); i++)
@@ -151,6 +157,7 @@ void SuppressionContext::Parse(const char *str) {
s.hit_count = 0;
s.weight = 0;
suppressions_.push_back(s);
+ has_suppresson_type_[s.type] = true;
}
if (end[0] == 0)
break;
@@ -162,6 +169,10 @@ uptr SuppressionContext::SuppressionCount() const {
return suppressions_.size();
}
+bool SuppressionContext::HasSuppressionType(SuppressionType type) const {
+ return has_suppresson_type_[type];
+}
+
const Suppression *SuppressionContext::SuppressionAt(uptr i) const {
CHECK_LT(i, suppressions_.size());
return &suppressions_[i];
OpenPOWER on IntegriCloud