[clang] [clang][Modules] Complete the implementation of P2615: Meaningful exports (PR #194201)
Yihan Wang via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 28 20:25:28 PDT 2026
================
@@ -3,9 +3,135 @@
// RUN: %clang_cc1 -std=c++20 -verify -fsyntax-only %t/A.cpp
+// RUN: %clang_cc1 -std=c++20 -verify -fsyntax-only %t/B.cpp
+// RUN: not %clang_cc1 -std=c++20 -fsyntax-only -fdiagnostics-parseable-fixits %t/B.cpp 2>&1 | FileCheck %t/B.cpp
+// RUN: %clang_cc1 -std=c++20 -verify -fsyntax-only %t/msvc-stl-exception-1.cpp
----------------
yronglin wrote:
> Not on every check. Macro lookup result is cached at the first time calling NeedsCXXStandardLibraryWorkaroundBefore.
We should avoid this cost even it's called only once.
IIUC, it's only needed when users want to compile the code that requires MSVC compatibility.
> So we check the grammar first, then check the standard library version. AFAICT libc++ and libstdc++ users don't pay that cost.
> The behaviour is slightly different. We suppress diagnostics when the value of the macro is within specific range.
I a bit concerns here: will this code snippet also take effect for non-MSVC-compatible code? Aside from clang MSVC-compatibility mode and use microsoft/STL, this macro shouldn't have any impact on code targeting other platforms. If that is indeed the case, we should ensure it is enabled only when Clang is operating in MSVC-compatibility mode.
https://github.com/llvm/llvm-project/pull/194201
More information about the cfe-commits
mailing list