[clang] [clang] Restrict -Wnrvo to C++ code only. (PR #157059)

2025-09-12 Thread Javier Muñoz Kirschberg via cfe-commits
@@ -16174,8 +16174,10 @@ void Sema::computeNRVO(Stmt *Body, FunctionScopeInfo *Scope) { for (unsigned I = 0, E = Scope->Returns.size(); I != E; ++I) { if (const VarDecl *NRVOCandidate = Returns[I]->getNRVOCandidate()) { if (!NRVOCandidate->isNRVOVariable()) { -

[clang] [clang] Restrict -Wnrvo to C++ code only. (PR #157059)

2025-09-12 Thread Javier Muñoz Kirschberg via cfe-commits
https://github.com/javiermunozkirschberg updated https://github.com/llvm/llvm-project/pull/157059 From b81368b2a7dcc8e998e9ffae8109c622faee6bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Mu=C3=B1oz=20Kirschberg?= Date: Fri, 5 Sep 2025 10:57:24 +0200 Subject: [PATCH 1/2] [clang] Restrict

[clang] [clang] Restrict -Wnrvo to C++ code only. (PR #157059)

2025-09-12 Thread Javier Muñoz Kirschberg via cfe-commits
https://github.com/javiermunozkirschberg edited https://github.com/llvm/llvm-project/pull/157059 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Restrict -Wnrvo to C++ code only. (PR #157059)

2025-09-09 Thread Javier Muñoz Kirschberg via cfe-commits
@@ -0,0 +1,41 @@ +// RUN: %clang -std=c23 -Wnrvo -Xclang -verify %s +// expected-no-diagnostics + +#include + +#define SIZE 20 + +typedef struct String_s { +char* buf; +size_t len; +} String; + + +void clean(String* s) { +free(s->buf); +} + +String randomString() { +