[PATCH] D146764: [clang] Make predefined expressions string literals under -fms-extensions
Hans Wennborg via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 24 06:00:20 PDT 2023
hans added a reviewer: mstorsjo.
hans added a comment.
+mstorsjo is this okay for mingw mode too?
================
Comment at: clang/lib/Sema/SemaExpr.cpp:3558
+ return PredefinedExpr::Create(Context, Loc, ResTy, IK, SL);
+ } else {
// Pre-defined identifiers are of type char[x], where x is the length of
----------------
Since this becomes an "else after return" it could be dropped.
================
Comment at: clang/test/CodeGen/predefined-expr.c:4
+
+// ITANIUM: @__func__.plainFunction = private unnamed_addr constant [14 x i8] c"plainFunction\00"
+// ITANIUM: @__PRETTY_FUNCTION__.plainFunction = private unnamed_addr constant [25 x i8] c"void plainFunction(void)\00"
----------------
Both invocations use the Itanium abi, so the check prefix is a bit confusing. How about DEFAULT and MS?
================
Comment at: clang/test/Sema/ms_predefined_expr.cpp:4
+
+void f(void) {
+ const char a[] = __FUNCTION__;
----------------
ultra nit: the 'void' param makes this look like c code. Should it go in a .c file instead of .cpp?
================
Comment at: clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp:1062
+ // Predefined expressions are string literals under Microsoft extensions.
+ if (GetParam().isWin32())
+ return;
----------------
Could the same check be used in ASTImporterTest.cpp?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146764/new/
https://reviews.llvm.org/D146764
More information about the cfe-commits
mailing list