[llvm-commits] [compiler-rt] r157739 - in /compiler-rt/trunk/lib/tsan: rtl/tsan_suppressions.cc rtl/tsan_suppressions.h unit_tests/tsan_suppressions_test.cc
Dmitry Vyukov
dvyukov at google.com
Thu May 31 06:18:11 PDT 2012
Author: dvyukov
Date: Thu May 31 08:18:11 2012
New Revision: 157739
URL: http://llvm.org/viewvc/llvm-project?rev=157739&view=rev
Log:
tsan: suppress reports against source file names as well
Modified:
compiler-rt/trunk/lib/tsan/rtl/tsan_suppressions.cc
compiler-rt/trunk/lib/tsan/rtl/tsan_suppressions.h
compiler-rt/trunk/lib/tsan/unit_tests/tsan_suppressions_test.cc
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_suppressions.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_suppressions.cc?rev=157739&r1=157738&r2=157739&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_suppressions.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_suppressions.cc Thu May 31 08:18:11 2012
@@ -53,6 +53,8 @@
}
bool SuppressionMatch(char *templ, const char *str) {
+ if (str == 0 || str[0] == 0)
+ return false;
char *tpos;
const char *spos;
while (templ && templ[0]) {
@@ -114,9 +116,9 @@
s->next = head;
head = s;
s->type = stype;
- s->func = (char*)internal_alloc(MBlockSuppression, end2 - line + 1);
- internal_memcpy(s->func, line, end2 - line);
- s->func[end2 - line] = 0;
+ s->templ = (char*)internal_alloc(MBlockSuppression, end2 - line + 1);
+ internal_memcpy(s->templ, line, end2 - line);
+ s->templ[end2 - line] = 0;
}
if (end[0] == 0)
break;
@@ -145,11 +147,11 @@
else
return false;
for (const ReportStack *frame = stack; frame; frame = frame->next) {
- if (frame->func == 0)
- continue;
for (Suppression *supp = g_suppressions; supp; supp = supp->next) {
- if (stype == supp->type && SuppressionMatch(supp->func, frame->func)) {
- DPrintf("ThreadSanitizer: matched suppression '%s'\n", supp->func);
+ if (stype == supp->type ||
+ SuppressionMatch(supp->templ, frame->func) ||
+ SuppressionMatch(supp->templ, frame->file)) {
+ DPrintf("ThreadSanitizer: matched suppression '%s'\n", supp->templ);
return true;
}
}
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_suppressions.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_suppressions.h?rev=157739&r1=157738&r2=157739&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_suppressions.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_suppressions.h Thu May 31 08:18:11 2012
@@ -32,7 +32,7 @@
struct Suppression {
Suppression *next;
SuppressionType type;
- char *func;
+ char *templ;
};
Suppression *SuppressionParse(const char* supp);
Modified: compiler-rt/trunk/lib/tsan/unit_tests/tsan_suppressions_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/unit_tests/tsan_suppressions_test.cc?rev=157739&r1=157738&r2=157739&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/unit_tests/tsan_suppressions_test.cc (original)
+++ compiler-rt/trunk/lib/tsan/unit_tests/tsan_suppressions_test.cc Thu May 31 08:18:11 2012
@@ -29,16 +29,16 @@
); // NOLINT
Suppression *supp = supp0;
EXPECT_EQ(supp->type, SuppressionRace);
- EXPECT_EQ(0, strcmp(supp->func, "quz"));
+ EXPECT_EQ(0, strcmp(supp->templ, "quz"));
supp = supp->next;
EXPECT_EQ(supp->type, SuppressionRace);
- EXPECT_EQ(0, strcmp(supp->func, "baz"));
+ EXPECT_EQ(0, strcmp(supp->templ, "baz"));
supp = supp->next;
EXPECT_EQ(supp->type, SuppressionRace);
- EXPECT_EQ(0, strcmp(supp->func, "bar"));
+ EXPECT_EQ(0, strcmp(supp->templ, "bar"));
supp = supp->next;
EXPECT_EQ(supp->type, SuppressionRace);
- EXPECT_EQ(0, strcmp(supp->func, "foo"));
+ EXPECT_EQ(0, strcmp(supp->templ, "foo"));
supp = supp->next;
EXPECT_EQ((Suppression*)0, supp);
}
@@ -54,10 +54,10 @@
); // NOLINT
Suppression *supp = supp0;
EXPECT_EQ(supp->type, SuppressionRace);
- EXPECT_EQ(0, strcmp(supp->func, "baz* *baz"));
+ EXPECT_EQ(0, strcmp(supp->templ, "baz* *baz"));
supp = supp->next;
EXPECT_EQ(supp->type, SuppressionRace);
- EXPECT_EQ(0, strcmp(supp->func, "bar"));
+ EXPECT_EQ(0, strcmp(supp->templ, "bar"));
supp = supp->next;
EXPECT_EQ((Suppression*)0, supp);
}
@@ -71,10 +71,10 @@
); // NOLINT
Suppression *supp = supp0;
EXPECT_EQ(supp->type, SuppressionRace);
- EXPECT_EQ(0, strcmp(supp->func, "bar"));
+ EXPECT_EQ(0, strcmp(supp->templ, "bar"));
supp = supp->next;
EXPECT_EQ(supp->type, SuppressionRace);
- EXPECT_EQ(0, strcmp(supp->func, "foo"));
+ EXPECT_EQ(0, strcmp(supp->templ, "foo"));
supp = supp->next;
EXPECT_EQ((Suppression*)0, supp);
}
@@ -89,16 +89,16 @@
); // NOLINT
Suppression *supp = supp0;
EXPECT_EQ(supp->type, SuppressionSignal);
- EXPECT_EQ(0, strcmp(supp->func, "quz"));
+ EXPECT_EQ(0, strcmp(supp->templ, "quz"));
supp = supp->next;
EXPECT_EQ(supp->type, SuppressionMutex);
- EXPECT_EQ(0, strcmp(supp->func, "baz"));
+ EXPECT_EQ(0, strcmp(supp->templ, "baz"));
supp = supp->next;
EXPECT_EQ(supp->type, SuppressionThread);
- EXPECT_EQ(0, strcmp(supp->func, "bar"));
+ EXPECT_EQ(0, strcmp(supp->templ, "bar"));
supp = supp->next;
EXPECT_EQ(supp->type, SuppressionRace);
- EXPECT_EQ(0, strcmp(supp->func, "foo"));
+ EXPECT_EQ(0, strcmp(supp->templ, "foo"));
supp = supp->next;
EXPECT_EQ((Suppression*)0, supp);
}
More information about the llvm-commits
mailing list