Skip to content

Commit 36266b6

Browse files
committedSep 11, 2017
[compiler-rt] Cleanup decorators
Summary: Removed redundant End*() methods which defined same way. Removed redundant Warning() methods. Reviewers: eugenis Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37549 llvm-svn: 312950
1 parent c3e4602 commit 36266b6

File tree

9 files changed

+54
-71
lines changed

9 files changed

+54
-71
lines changed
 

‎compiler-rt/lib/asan/asan_descriptions.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static void PrintHeapChunkAccess(uptr addr, const ChunkAccess &descr) {
150150
str.append(" %zu-byte region [%p,%p)\n", descr.chunk_size,
151151
(void *)descr.chunk_begin,
152152
(void *)(descr.chunk_begin + descr.chunk_size));
153-
str.append("%s", d.EndLocation());
153+
str.append("%s", d.Default());
154154
Printf("%s", str.data());
155155
}
156156

@@ -260,7 +260,7 @@ static void PrintAccessAndVarIntersection(const StackVarDescr &var, uptr addr,
260260
// FIXME: we may want to also print the size of the access here,
261261
// but in case of accesses generated by memset it may be confusing.
262262
str.append("%s <== Memory access at offset %zd %s this variable%s\n",
263-
d.Location(), addr, pos_descr, d.EndLocation());
263+
d.Location(), addr, pos_descr, d.Default());
264264
} else {
265265
str.append("\n");
266266
}
@@ -295,7 +295,7 @@ static void DescribeAddressRelativeToGlobal(uptr addr, uptr access_size,
295295
MaybeDemangleGlobalName(g.name));
296296
PrintGlobalLocation(&str, g);
297297
str.append("' (0x%zx) of size %zu\n", g.beg, g.size);
298-
str.append("%s", d.EndLocation());
298+
str.append("%s", d.Default());
299299
PrintGlobalNameIfASCII(&str, g);
300300
Printf("%s", str.data());
301301
}
@@ -343,10 +343,10 @@ void StackAddressDescription::Print() const {
343343
ThreadNameWithParenthesis(tid, tname, sizeof(tname)));
344344

345345
if (!frame_descr) {
346-
Printf("%s\n", d.EndLocation());
346+
Printf("%s\n", d.Default());
347347
return;
348348
}
349-
Printf(" at offset %zu in frame%s\n", offset, d.EndLocation());
349+
Printf(" at offset %zu in frame%s\n", offset, d.Default());
350350

351351
// Now we print the frame where the alloca has happened.
352352
// We print this frame as a stack trace with one element.
@@ -355,7 +355,7 @@ void StackAddressDescription::Print() const {
355355
// previously. That's unfortunate, but I have no better solution,
356356
// especially given that the alloca may be from entirely different place
357357
// (e.g. use-after-scope, or different thread's stack).
358-
Printf("%s", d.EndLocation());
358+
Printf("%s", d.Default());
359359
StackTrace alloca_stack(&frame_pc, 1);
360360
alloca_stack.Print();
361361

@@ -405,18 +405,18 @@ void HeapAddressDescription::Print() const {
405405
Printf("%sfreed by thread T%d%s here:%s\n", d.Allocation(),
406406
free_thread->tid,
407407
ThreadNameWithParenthesis(free_thread, tname, sizeof(tname)),
408-
d.EndAllocation());
408+
d.Default());
409409
StackTrace free_stack = GetStackTraceFromId(free_stack_id);
410410
free_stack.Print();
411411
Printf("%spreviously allocated by thread T%d%s here:%s\n", d.Allocation(),
412412
alloc_thread->tid,
413413
ThreadNameWithParenthesis(alloc_thread, tname, sizeof(tname)),
414-
d.EndAllocation());
414+
d.Default());
415415
} else {
416416
Printf("%sallocated by thread T%d%s here:%s\n", d.Allocation(),
417417
alloc_thread->tid,
418418
ThreadNameWithParenthesis(alloc_thread, tname, sizeof(tname)),
419-
d.EndAllocation());
419+
d.Default());
420420
}
421421
alloc_stack.Print();
422422
DescribeThread(GetCurrentThread());

‎compiler-rt/lib/asan/asan_descriptions.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,8 @@ class Decorator : public __sanitizer::SanitizerCommonDecorator {
3434
public:
3535
Decorator() : SanitizerCommonDecorator() {}
3636
const char *Access() { return Blue(); }
37-
const char *EndAccess() { return Default(); }
3837
const char *Location() { return Green(); }
39-
const char *EndLocation() { return Default(); }
4038
const char *Allocation() { return Magenta(); }
41-
const char *EndAllocation() { return Default(); }
4239

4340
const char *ShadowByte(u8 byte) {
4441
switch (byte) {
@@ -72,9 +69,7 @@ class Decorator : public __sanitizer::SanitizerCommonDecorator {
7269
return Default();
7370
}
7471
}
75-
const char *EndShadowByte() { return Default(); }
7672
const char *MemoryByte() { return Magenta(); }
77-
const char *EndMemoryByte() { return Default(); }
7873
};
7974

8075
enum ShadowKind : u8 {

‎compiler-rt/lib/asan/asan_errors.cc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void ErrorStackOverflow::Print() {
2929
"ERROR: AddressSanitizer: %s on address %p"
3030
" (pc %p bp %p sp %p T%d)\n", scariness.GetDescription(),
3131
(void *)addr, (void *)pc, (void *)bp, (void *)sp, tid);
32-
Printf("%s", d.EndWarning());
32+
Printf("%s", d.Default());
3333
scariness.Print();
3434
BufferedStackTrace stack;
3535
GetStackTraceWithPcBpAndContext(&stack, kStackTraceMax, pc, bp, context,
@@ -77,7 +77,7 @@ void ErrorDeadlySignal::Print() {
7777
"ERROR: AddressSanitizer: %s on unknown address %p (pc %p bp %p sp %p "
7878
"T%d)\n",
7979
description, (void *)addr, (void *)pc, (void *)bp, (void *)sp, tid);
80-
Printf("%s", d.EndWarning());
80+
Printf("%s", d.Default());
8181
if (pc < GetPageSizeCached()) Report("Hint: pc points to the zero page.\n");
8282
if (is_memory_access) {
8383
const char *access_type =
@@ -109,7 +109,7 @@ void ErrorDoubleFree::Print() {
109109
"thread T%d%s:\n",
110110
scariness.GetDescription(), addr_description.addr, tid,
111111
ThreadNameWithParenthesis(tid, tname, sizeof(tname)));
112-
Printf("%s", d.EndWarning());
112+
Printf("%s", d.Default());
113113
scariness.Print();
114114
GET_STACK_TRACE_FATAL(second_free_stack->trace[0],
115115
second_free_stack->top_frame_bp);
@@ -127,7 +127,7 @@ void ErrorNewDeleteSizeMismatch::Print() {
127127
"T%d%s:\n",
128128
scariness.GetDescription(), addr_description.addr, tid,
129129
ThreadNameWithParenthesis(tid, tname, sizeof(tname)));
130-
Printf("%s object passed to delete has wrong type:\n", d.EndWarning());
130+
Printf("%s object passed to delete has wrong type:\n", d.Default());
131131
Printf(
132132
" size of the allocated type: %zd bytes;\n"
133133
" size of the deallocated type: %zd bytes.\n",
@@ -152,7 +152,7 @@ void ErrorFreeNotMalloced::Print() {
152152
"which was not malloc()-ed: %p in thread T%d%s\n",
153153
addr_description.Address(), tid,
154154
ThreadNameWithParenthesis(tid, tname, sizeof(tname)));
155-
Printf("%s", d.EndWarning());
155+
Printf("%s", d.Default());
156156
CHECK_GT(free_stack->size, 0);
157157
scariness.Print();
158158
GET_STACK_TRACE_FATAL(free_stack->trace[0], free_stack->top_frame_bp);
@@ -173,7 +173,7 @@ void ErrorAllocTypeMismatch::Print() {
173173
scariness.GetDescription(),
174174
alloc_names[alloc_type], dealloc_names[dealloc_type],
175175
addr_description.addr);
176-
Printf("%s", d.EndWarning());
176+
Printf("%s", d.Default());
177177
CHECK_GT(dealloc_stack->size, 0);
178178
scariness.Print();
179179
GET_STACK_TRACE_FATAL(dealloc_stack->trace[0], dealloc_stack->top_frame_bp);
@@ -192,7 +192,7 @@ void ErrorMallocUsableSizeNotOwned::Print() {
192192
"ERROR: AddressSanitizer: attempting to call malloc_usable_size() for "
193193
"pointer which is not owned: %p\n",
194194
addr_description.Address());
195-
Printf("%s", d.EndWarning());
195+
Printf("%s", d.Default());
196196
stack->Print();
197197
addr_description.Print();
198198
ReportErrorSummary(scariness.GetDescription(), stack);
@@ -205,7 +205,7 @@ void ErrorSanitizerGetAllocatedSizeNotOwned::Print() {
205205
"ERROR: AddressSanitizer: attempting to call "
206206
"__sanitizer_get_allocated_size() for pointer which is not owned: %p\n",
207207
addr_description.Address());
208-
Printf("%s", d.EndWarning());
208+
Printf("%s", d.Default());
209209
stack->Print();
210210
addr_description.Print();
211211
ReportErrorSummary(scariness.GetDescription(), stack);
@@ -222,7 +222,7 @@ void ErrorStringFunctionMemoryRangesOverlap::Print() {
222222
bug_type, addr1_description.Address(),
223223
addr1_description.Address() + length1, addr2_description.Address(),
224224
addr2_description.Address() + length2);
225-
Printf("%s", d.EndWarning());
225+
Printf("%s", d.Default());
226226
scariness.Print();
227227
stack->Print();
228228
addr1_description.Print();
@@ -235,7 +235,7 @@ void ErrorStringFunctionSizeOverflow::Print() {
235235
Printf("%s", d.Warning());
236236
Report("ERROR: AddressSanitizer: %s: (size=%zd)\n",
237237
scariness.GetDescription(), size);
238-
Printf("%s", d.EndWarning());
238+
Printf("%s", d.Default());
239239
scariness.Print();
240240
stack->Print();
241241
addr_description.Print();
@@ -263,7 +263,7 @@ void ErrorODRViolation::Print() {
263263
Printf("%s", d.Warning());
264264
Report("ERROR: AddressSanitizer: %s (%p):\n", scariness.GetDescription(),
265265
global1.beg);
266-
Printf("%s", d.EndWarning());
266+
Printf("%s", d.Default());
267267
InternalScopedString g1_loc(256), g2_loc(256);
268268
PrintGlobalLocation(&g1_loc, global1);
269269
PrintGlobalLocation(&g2_loc, global2);
@@ -292,7 +292,7 @@ void ErrorInvalidPointerPair::Print() {
292292
Printf("%s", d.Warning());
293293
Report("ERROR: AddressSanitizer: %s: %p %p\n", scariness.GetDescription(),
294294
addr1_description.Address(), addr2_description.Address());
295-
Printf("%s", d.EndWarning());
295+
Printf("%s", d.Default());
296296
GET_STACK_TRACE_FATAL(pc, bp);
297297
stack.Print();
298298
addr1_description.Print();
@@ -491,13 +491,13 @@ void ErrorGeneric::Print() {
491491
uptr addr = addr_description.Address();
492492
Report("ERROR: AddressSanitizer: %s on address %p at pc %p bp %p sp %p\n",
493493
bug_descr, (void *)addr, pc, bp, sp);
494-
Printf("%s", d.EndWarning());
494+
Printf("%s", d.Default());
495495

496496
char tname[128];
497497
Printf("%s%s of size %zu at %p thread T%d%s%s\n", d.Access(),
498498
access_size ? (is_write ? "WRITE" : "READ") : "ACCESS", access_size,
499499
(void *)addr, tid,
500-
ThreadNameWithParenthesis(tid, tname, sizeof(tname)), d.EndAccess());
500+
ThreadNameWithParenthesis(tid, tname, sizeof(tname)), d.Default());
501501

502502
scariness.Print();
503503
GET_STACK_TRACE_FATAL(pc, bp);

‎compiler-rt/lib/asan/asan_report.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ void PrintMemoryByte(InternalScopedString *str, const char *before, u8 byte,
6060
bool in_shadow, const char *after) {
6161
Decorator d;
6262
str->append("%s%s%x%x%s%s", before,
63-
in_shadow ? d.ShadowByte(byte) : d.MemoryByte(),
64-
byte >> 4, byte & 15,
65-
in_shadow ? d.EndShadowByte() : d.EndMemoryByte(), after);
63+
in_shadow ? d.ShadowByte(byte) : d.MemoryByte(), byte >> 4,
64+
byte & 15, d.Default(), after);
6665
}
6766

6867
static void PrintZoneForPointer(uptr ptr, uptr zone_ptr,

‎compiler-rt/lib/lsan/lsan_common.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ class Decorator: public __sanitizer::SanitizerCommonDecorator {
122122
Decorator() : SanitizerCommonDecorator() { }
123123
const char *Error() { return Red(); }
124124
const char *Leak() { return Blue(); }
125-
const char *End() { return Default(); }
126125
};
127126

128127
static inline bool CanBeAHeapPointer(uptr p) {
@@ -564,7 +563,7 @@ static bool CheckForLeaks() {
564563
"\n");
565564
Printf("%s", d.Error());
566565
Report("ERROR: LeakSanitizer: detected memory leaks\n");
567-
Printf("%s", d.End());
566+
Printf("%s", d.Default());
568567
param.leak_report.ReportTopLeaks(flags()->max_leaks);
569568
}
570569
if (common_flags()->print_suppressions)
@@ -698,7 +697,7 @@ void LeakReport::PrintReportForLeak(uptr index) {
698697
Printf("%s leak of %zu byte(s) in %zu object(s) allocated from:\n",
699698
leaks_[index].is_directly_leaked ? "Direct" : "Indirect",
700699
leaks_[index].total_size, leaks_[index].hit_count);
701-
Printf("%s", d.End());
700+
Printf("%s", d.Default());
702701

703702
PrintStackTraceById(leaks_[index].stack_trace_id);
704703

‎compiler-rt/lib/msan/msan_report.cc

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ namespace __msan {
3030
class Decorator: public __sanitizer::SanitizerCommonDecorator {
3131
public:
3232
Decorator() : SanitizerCommonDecorator() { }
33-
const char *Warning() { return Red(); }
3433
const char *Origin() { return Magenta(); }
3534
const char *Name() { return Green(); }
36-
const char *End() { return Default(); }
3735
};
3836

3937
static void DescribeStackOrigin(const char *so, uptr pc) {
@@ -47,7 +45,7 @@ static void DescribeStackOrigin(const char *so, uptr pc) {
4745
" %sUninitialized value was created by an allocation of '%s%s%s'"
4846
" in the stack frame of function '%s%s%s'%s\n",
4947
d.Origin(), d.Name(), s, d.Origin(), d.Name(), sep + 1, d.Origin(),
50-
d.End());
48+
d.Default());
5149
InternalFree(s);
5250

5351
if (pc) {
@@ -66,7 +64,7 @@ static void DescribeOrigin(u32 id) {
6664
StackTrace stack;
6765
o = o.getNextChainedOrigin(&stack);
6866
Printf(" %sUninitialized value was stored to memory at%s\n", d.Origin(),
69-
d.End());
67+
d.Default());
7068
stack.Print();
7169
}
7270
if (o.isStackOrigin()) {
@@ -78,18 +76,19 @@ static void DescribeOrigin(u32 id) {
7876
switch (stack.tag) {
7977
case StackTrace::TAG_ALLOC:
8078
Printf(" %sUninitialized value was created by a heap allocation%s\n",
81-
d.Origin(), d.End());
79+
d.Origin(), d.Default());
8280
break;
8381
case StackTrace::TAG_DEALLOC:
8482
Printf(" %sUninitialized value was created by a heap deallocation%s\n",
85-
d.Origin(), d.End());
83+
d.Origin(), d.Default());
8684
break;
8785
case STACK_TRACE_TAG_POISON:
8886
Printf(" %sMemory was marked as uninitialized%s\n", d.Origin(),
89-
d.End());
87+
d.Default());
9088
break;
9189
default:
92-
Printf(" %sUninitialized value was created%s\n", d.Origin(), d.End());
90+
Printf(" %sUninitialized value was created%s\n", d.Origin(),
91+
d.Default());
9392
break;
9493
}
9594
stack.Print();
@@ -104,7 +103,7 @@ void ReportUMR(StackTrace *stack, u32 origin) {
104103
Decorator d;
105104
Printf("%s", d.Warning());
106105
Report("WARNING: MemorySanitizer: use-of-uninitialized-value\n");
107-
Printf("%s", d.End());
106+
Printf("%s", d.Default());
108107
stack->Print();
109108
if (origin) {
110109
DescribeOrigin(origin);
@@ -144,7 +143,7 @@ void ReportAtExitStatistics() {
144143
Decorator d;
145144
Printf("%s", d.Warning());
146145
Printf("MemorySanitizer: %d warnings reported.\n", msan_report_count);
147-
Printf("%s", d.End());
146+
Printf("%s", d.Default());
148147
}
149148
}
150149

@@ -203,7 +202,7 @@ void DescribeMemoryRange(const void *x, uptr size) {
203202
Decorator d;
204203
Printf("%s", d.Warning());
205204
Printf("Shadow map of [%p, %p), %zu bytes:\n", start, end, end - start);
206-
Printf("%s", d.End());
205+
Printf("%s", d.Default());
207206
while (s < e) {
208207
// Line start.
209208
if (pos % 16 == 0) {
@@ -265,7 +264,7 @@ void ReportUMRInsideAddressRange(const char *what, const void *start, uptr size,
265264
Printf("%s", d.Warning());
266265
Printf("%sUninitialized bytes in %s%s%s at offset %zu inside [%p, %zu)%s\n",
267266
d.Warning(), d.Name(), what, d.Warning(), offset, start, size,
268-
d.End());
267+
d.Default());
269268
if (__sanitizer::Verbosity())
270269
DescribeMemoryRange(start, size);
271270
}

‎compiler-rt/lib/sanitizer_common/sanitizer_report_decorator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class SanitizerCommonDecorator {
2727
SanitizerCommonDecorator() : ansi_(ColorizeReports()) {}
2828
const char *Bold() const { return ansi_ ? "\033[1m" : ""; }
2929
const char *Default() const { return ansi_ ? "\033[1m\033[0m" : ""; }
30-
const char *Warning() { return Red(); }
31-
const char *EndWarning() { return Default(); }
30+
const char *Warning() const { return Red(); }
31+
3232
protected:
3333
const char *Black() const { return ansi_ ? "\033[1m\033[30m" : ""; }
3434
const char *Red() const { return ansi_ ? "\033[1m\033[31m" : ""; }

‎compiler-rt/lib/tsan/rtl/tsan_report.cc

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,11 @@ ReportLocation *ReportLocation::New(ReportLocationType type) {
3939
class Decorator: public __sanitizer::SanitizerCommonDecorator {
4040
public:
4141
Decorator() : SanitizerCommonDecorator() { }
42-
const char *Warning() { return Red(); }
43-
const char *EndWarning() { return Default(); }
4442
const char *Access() { return Blue(); }
45-
const char *EndAccess() { return Default(); }
4643
const char *ThreadDescription() { return Cyan(); }
47-
const char *EndThreadDescription() { return Default(); }
4844
const char *Location() { return Green(); }
49-
const char *EndLocation() { return Default(); }
5045
const char *Sleep() { return Yellow(); }
51-
const char *EndSleep() { return Default(); }
5246
const char *Mutex() { return Magenta(); }
53-
const char *EndMutex() { return Default(); }
5447
};
5548

5649
ReportDesc::ReportDesc()
@@ -181,7 +174,7 @@ static void PrintMop(const ReportMop *mop, bool first) {
181174
}
182175
PrintMutexSet(mop->mset);
183176
Printf(":\n");
184-
Printf("%s", d.EndAccess());
177+
Printf("%s", d.Default());
185178
PrintStack(mop->stack);
186179
}
187180

@@ -222,32 +215,32 @@ static void PrintLocation(const ReportLocation *loc) {
222215
loc->fd, thread_name(thrbuf, loc->tid));
223216
print_stack = true;
224217
}
225-
Printf("%s", d.EndLocation());
218+
Printf("%s", d.Default());
226219
if (print_stack)
227220
PrintStack(loc->stack);
228221
}
229222

230223
static void PrintMutexShort(const ReportMutex *rm, const char *after) {
231224
Decorator d;
232-
Printf("%sM%zd%s%s", d.Mutex(), rm->id, d.EndMutex(), after);
225+
Printf("%sM%zd%s%s", d.Mutex(), rm->id, d.Default(), after);
233226
}
234227

235228
static void PrintMutexShortWithAddress(const ReportMutex *rm,
236229
const char *after) {
237230
Decorator d;
238-
Printf("%sM%zd (%p)%s%s", d.Mutex(), rm->id, rm->addr, d.EndMutex(), after);
231+
Printf("%sM%zd (%p)%s%s", d.Mutex(), rm->id, rm->addr, d.Default(), after);
239232
}
240233

241234
static void PrintMutex(const ReportMutex *rm) {
242235
Decorator d;
243236
if (rm->destroyed) {
244237
Printf("%s", d.Mutex());
245238
Printf(" Mutex M%llu is already destroyed.\n\n", rm->id);
246-
Printf("%s", d.EndMutex());
239+
Printf("%s", d.Default());
247240
} else {
248241
Printf("%s", d.Mutex());
249242
Printf(" Mutex M%llu (%p) created at:\n", rm->id, rm->addr);
250-
Printf("%s", d.EndMutex());
243+
Printf("%s", d.Default());
251244
PrintStack(rm->stack);
252245
}
253246
}
@@ -265,23 +258,23 @@ static void PrintThread(const ReportThread *rt) {
265258
if (rt->workerthread) {
266259
Printf(" (tid=%zu, %s) is a GCD worker thread\n", rt->os_id, thread_status);
267260
Printf("\n");
268-
Printf("%s", d.EndThreadDescription());
261+
Printf("%s", d.Default());
269262
return;
270263
}
271264
Printf(" (tid=%zu, %s) created by %s", rt->os_id, thread_status,
272265
thread_name(thrbuf, rt->parent_tid));
273266
if (rt->stack)
274267
Printf(" at:");
275268
Printf("\n");
276-
Printf("%s", d.EndThreadDescription());
269+
Printf("%s", d.Default());
277270
PrintStack(rt->stack);
278271
}
279272

280273
static void PrintSleep(const ReportStack *s) {
281274
Decorator d;
282275
Printf("%s", d.Sleep());
283276
Printf(" As if synchronized via sleep:\n");
284-
Printf("%s", d.EndSleep());
277+
Printf("%s", d.Default());
285278
PrintStack(s);
286279
}
287280

@@ -325,7 +318,7 @@ void PrintReport(const ReportDesc *rep) {
325318
Printf("%s", d.Warning());
326319
Printf("WARNING: ThreadSanitizer: %s (pid=%d)\n", rep_typ_str,
327320
(int)internal_getpid());
328-
Printf("%s", d.EndWarning());
321+
Printf("%s", d.Default());
329322

330323
if (rep->typ == ReportTypeDeadlock) {
331324
char thrbuf[kThreadBufSize];
@@ -343,7 +336,7 @@ void PrintReport(const ReportDesc *rep) {
343336
PrintMutexShort(rep->mutexes[i], " in ");
344337
Printf("%s", d.ThreadDescription());
345338
Printf("%s:\n", thread_name(thrbuf, rep->unique_tids[i]));
346-
Printf("%s", d.EndThreadDescription());
339+
Printf("%s", d.Default());
347340
if (flags()->second_deadlock_stack) {
348341
PrintStack(rep->stacks[2*i]);
349342
Printf(" Mutex ");

‎compiler-rt/lib/ubsan/ubsan_diag.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ class Decorator : public SanitizerCommonDecorator {
9797
public:
9898
Decorator() : SanitizerCommonDecorator() {}
9999
const char *Highlight() const { return Green(); }
100-
const char *EndHighlight() const { return Default(); }
101100
const char *Note() const { return Black(); }
102-
const char *EndNote() const { return Default(); }
103101
};
104102
}
105103

@@ -295,7 +293,7 @@ static void PrintMemorySnippet(const Decorator &Decor, MemoryLocation Loc,
295293
Buffer.append("%c", P == Loc ? '^' : Byte);
296294
Buffer.append("%c", Byte);
297295
}
298-
Buffer.append("%s\n", Decor.EndHighlight());
296+
Buffer.append("%s\n", Decor.Default());
299297

300298
// Go over the line again, and print names for the ranges.
301299
InRange = 0;
@@ -345,12 +343,12 @@ Diag::~Diag() {
345343

346344
switch (Level) {
347345
case DL_Error:
348-
Buffer.append("%s runtime error: %s%s", Decor.Warning(), Decor.EndWarning(),
346+
Buffer.append("%s runtime error: %s%s", Decor.Warning(), Decor.Default(),
349347
Decor.Bold());
350348
break;
351349

352350
case DL_Note:
353-
Buffer.append("%s note: %s", Decor.Note(), Decor.EndNote());
351+
Buffer.append("%s note: %s", Decor.Note(), Decor.Default());
354352
break;
355353
}
356354

0 commit comments

Comments
 (0)
Please sign in to comment.