[clang-tools-extra] [clang-tidy] add default error message for performance-avoid-endl (PR #107867)

Danny Mösch via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 9 12:06:59 PDT 2024


================
@@ -225,3 +225,14 @@ void bad_custom_stream() {
   // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]
   // CHECK-FIXES: logger << '\n';
 }
+
+namespace gh107859 {
+
+#define ENDL std::endl;
+
+void bad_macro() {
+  std::cout << ENDL;
+  // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: do not use '::std::endl' with streams; use '\n' instead [performance-avoid-endl]
----------------
SimplyDanny wrote:

```suggestion
  // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]
```

This'd be more in line with the reported name in case the source text is available.

https://github.com/llvm/llvm-project/pull/107867


More information about the cfe-commits mailing list