Sirraide wrote:
@AaronBallman I just noticed something that I’ve somehow not realised until now
even though I’d already written a test case for it: Not only does GCC allow raw
string literals in gnuXY mode, but also UTF string literals, e.g. `u"foo"`
(https://godbolt.org/z/771s8ne5d).
@@ -3850,6 +3850,7 @@ LangOptions getFormattingLangOpts(const FormatStyle
) {
// the sequence "<::" will be unconditionally treated as "[:".
// Cf. Lexer::LexTokenInternal.
LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11;
+ LangOpts.RawStringLiterals = LexingStd
Sirraide wrote:
> I think we should allow users to enable them in C++03 modes if
> -fraw-string-literals is passed. I think it's fine to have
> -fno-raw-string-literals that allows users to disable them in C++03 mode (in
> case an earlier command line option opted into them and the user wants
AaronBallman wrote:
Btw, it seems that precommit CI found some valid issues to be addressed
https://github.com/llvm/llvm-project/pull/88265
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
AaronBallman wrote:
> > I don't think we should allow it for C++11 and later modes
>
> To clarify, should we allow enabling them in e.g. `c++03` mode if
> `-fraw-string-literals` is passed? I don’t see why not, but I’m not entirely
> sure whether you’re saying we should not support that flag
@@ -3850,6 +3850,7 @@ LangOptions getFormattingLangOpts(const FormatStyle
) {
// the sequence "<::" will be unconditionally treated as "[:".
// Cf. Lexer::LexTokenInternal.
LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11;
+ LangOpts.RawStringLiterals = LexingStd
@@ -3850,6 +3850,7 @@ LangOptions getFormattingLangOpts(const FormatStyle
) {
// the sequence "<::" will be unconditionally treated as "[:".
// Cf. Lexer::LexTokenInternal.
LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11;
+ LangOpts.RawStringLiterals = LexingStd
@@ -3850,6 +3850,7 @@ LangOptions getFormattingLangOpts(const FormatStyle
) {
// the sequence "<::" will be unconditionally treated as "[:".
// Cf. Lexer::LexTokenInternal.
LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11;
+ LangOpts.RawStringLiterals = LexingStd
@@ -3850,6 +3850,7 @@ LangOptions getFormattingLangOpts(const FormatStyle
) {
// the sequence "<::" will be unconditionally treated as "[:".
// Cf. Lexer::LexTokenInternal.
LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11;
+ LangOpts.RawStringLiterals = LexingStd
https://github.com/Sirraide updated
https://github.com/llvm/llvm-project/pull/88265
>From 40e533e6f58acbe832b3fa4e14ca9fd600cf77cf Mon Sep 17 00:00:00 2001
From: Sirraide
Date: Wed, 10 Apr 2024 14:36:23 +0200
Subject: [PATCH 1/2] [Clang] Allow raw string literals in C as an extension
---
Sirraide wrote:
> I don't think we should allow it for C++11 and later modes
To clarify, should we allow enabling them in e.g. `c++03` mode if
`-fraw-string-literals` is passed? I don’t see why not, but I’m not entirely
sure whether you’re saying we should not support that flag in C++
@@ -130,6 +130,12 @@ struct LangStandard {
/// hasDigraphs - Language supports digraphs.
bool hasDigraphs() const { return Flags & Digraphs; }
+ /// hasRawStringLiterals - Language supports R"()" raw string literals.
+ bool hasRawStringLiterals() const {
+// GCC
@@ -130,6 +130,12 @@ struct LangStandard {
/// hasDigraphs - Language supports digraphs.
bool hasDigraphs() const { return Flags & Digraphs; }
+ /// hasRawStringLiterals - Language supports R"()" raw string literals.
+ bool hasRawStringLiterals() const {
+// GCC
@@ -130,6 +130,12 @@ struct LangStandard {
/// hasDigraphs - Language supports digraphs.
bool hasDigraphs() const { return Flags & Digraphs; }
+ /// hasRawStringLiterals - Language supports R"()" raw string literals.
+ bool hasRawStringLiterals() const {
+// GCC
@@ -130,6 +130,12 @@ struct LangStandard {
/// hasDigraphs - Language supports digraphs.
bool hasDigraphs() const { return Flags & Digraphs; }
+ /// hasRawStringLiterals - Language supports R"()" raw string literals.
+ bool hasRawStringLiterals() const {
+// GCC
@@ -130,6 +130,12 @@ struct LangStandard {
/// hasDigraphs - Language supports digraphs.
bool hasDigraphs() const { return Flags & Digraphs; }
+ /// hasRawStringLiterals - Language supports R"()" raw string literals.
+ bool hasRawStringLiterals() const {
+// GCC
@@ -43,6 +43,9 @@ code bases.
C/C++ Language Potentially Breaking Changes
---
+- Clang now supports raw string literals in ``-std=gnuXY`` mode as an
extension in
+ C. This behaviour can also be overridden using
https://github.com/AaronBallman edited
https://github.com/llvm/llvm-project/pull/88265
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/AaronBallman commented:
Thank you for working on this! Broadly speaking, I think the idea makes a lot
of sense.
> GCC does not seem to support raw string literals in C++ before C++11, even
> if e.g. -std=gnu++03 is passed. Should we follow this behaviour or should we
>
llvmbot wrote:
@llvm/pr-subscribers-clang-driver
Author: None (Sirraide)
Changes
This is a tentative implementation of support for raw string literals in C
following the discussion on #85703.
GCC supports raw string literals in C in `-gnuXY` mode. This pr both enables
raw string
https://github.com/Sirraide created
https://github.com/llvm/llvm-project/pull/88265
This is a tentative implementation of support for raw string literals in C
following the discussion on #85703.
GCC supports raw string literals in C in `-gnuXY` mode. This pr both enables
raw string literals
21 matches
Mail list logo