[compiler-rt] r338053 - [test] Use printf instead of C++ iostream, NFC.

Jonas Hahnfeld via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 26 11:23:40 PDT 2018


Author: hahnfeld
Date: Thu Jul 26 11:23:40 2018
New Revision: 338053

URL: http://llvm.org/viewvc/llvm-project?rev=338053&view=rev
Log:
[test] Use printf instead of C++ iostream, NFC.

This test fails with libc++ when built with MemorySanitizer. This
is because we link to an uninstrumented version of the library
so msan detects a nested error when calling std::cout << "...".
This can be easily avoided by using good old printf.

Differential Revision: https://reviews.llvm.org/D49867

Modified:
    compiler-rt/trunk/test/ubsan/TestCases/Misc/monitor.cpp

Modified: compiler-rt/trunk/test/ubsan/TestCases/Misc/monitor.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/Misc/monitor.cpp?rev=338053&r1=338052&r2=338053&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/Misc/monitor.cpp (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/Misc/monitor.cpp Thu Jul 26 11:23:40 2018
@@ -8,7 +8,7 @@
 // Linkage issue
 // XFAIL: openbsd
 
-#include <iostream>
+#include <cstdio>
 
 extern "C" {
 void __ubsan_get_current_report_data(const char **OutIssueKind,
@@ -26,9 +26,9 @@ void __ubsan_on_report(void) {
   __ubsan_get_current_report_data(&IssueKind, &Message, &Filename, &Line, &Col,
                                   &Addr);
 
-  std::cout << "Issue: " << IssueKind << "\n"
-            << "Location: " << Filename << ":" << Line << ":" << Col << "\n"
-            << "Message: " << Message << std::endl;
+  printf("Issue: %s\n", IssueKind);
+  printf("Location: %s:%u:%u\n", Filename, Line, Col);
+  printf("Message: %s\n", Message);
 
   (void)Addr;
 }




More information about the llvm-commits mailing list