[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-07-10 Thread via cfe-commits
https://github.com/Sirraide closed 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

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-07-08 Thread via cfe-commits
Sirraide wrote: Silly me forgot to *actually update the test* after enabling raw string literals in the dependency scanner, but *now* everything should pass. https://github.com/llvm/llvm-project/pull/88265 ___ cfe-commits mailing list cfe-commits@list

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-07-08 Thread via cfe-commits
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/8] [Clang] Allow raw string literals in C as an extension --- clan

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-07-05 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: > I assume that @benlangmuir added the scanner unit-test to demonstrate the > current behavior instead of trying to make sure it's preserved. Correct. They're only interesting to the scanner insofar as they're used in `_Pragma()` as far as I know. If we can handle them, gre

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-07-03 Thread via cfe-commits
Sirraide wrote: Alright, I just enabled raw string literals in the dependency scanner by default; barring any further complications, I’ll merge this once CI is done. https://github.com/llvm/llvm-project/pull/88265 ___ cfe-commits mailing list cfe-comm

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-07-03 Thread via cfe-commits
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/7] [Clang] Allow raw string literals in C as an extension --- clan

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-07-02 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: > To clarify, that means setting the `RawStringLiterals` LangOpt in > `DependencyDirectivesScanner.cpp`, right? I’m assuming yes, but I just want > to make sure. Yes, that's what I had in mind 👍 https://github.com/llvm/llvm-project/pull/88265 _

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-24 Thread via cfe-commits
Sirraide wrote: > I think making it so that the test passes (actually handles raw string > literals) and updating the FIXME in DependencyDirectivesScanner.cpp should be > fine To clarify, that means setting the `RawStringLiterals` LangOpt in `DependencyDirectivesScanner.cpp`, right? I’m assum

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-21 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: I assume that @benlangmuir added the scanner unit-test to demonstrate the current behavior instead of trying to make sure it's preserved. I think making it so that the test passes (actually handles raw string literals) and updating the FIXME in `DependencyDirectivesScanner.

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-20 Thread via cfe-commits
Sirraide wrote: > Clang changes LGTM modulo the dependency scanner bits. Alright, I’ll wait for a reply from @jansvoboda11 then https://github.com/llvm/llvm-project/pull/88265 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-20 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. Clang changes LGTM modulo the dependency scanner bits. https://github.com/llvm/llvm-project/pull/88265 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-20 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > Why gnu99 mode and not gnu89 mode? I see GCC has that behavior, but I'm not > > certain why. > > We went over this a while back: [#88265 > (comment)](https://github.com/llvm/llvm-project/pull/88265#discussion_r1571088366) THAT is why this was so familiar to me! :-D Tha

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-20 Thread via cfe-commits
Sirraide wrote: > Why gnu99 mode and not gnu89 mode? I see GCC has that behavior, but I'm not > certain why. We went over this a while back: https://github.com/llvm/llvm-project/pull/88265#discussion_r1571088366 > I'm not certain there's any harm in always supporting raw string literals > fr

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-20 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > raw string literals are enabled in C++11 and later, as well as in C in gnu99 > mode and later; Why gnu99 mode and not gnu89 mode? I see GCC has that behavior, but I'm not certain why. > I’m not entirely sure how to fix this candidly. It doesn’t look like > unconditional

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-19 Thread via cfe-commits
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/6] [Clang] Allow raw string literals in C as an extension --- clan

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-19 Thread via cfe-commits
Sirraide wrote: So, apparently, this test here https://github.com/llvm/llvm-project/blob/cb76896d6e45e2c9b7ef5e47b6ec37aeca43f7a8/clang/unittests/Lex/DependencyDirectivesScannerTest.cpp#L586-L589 is now failing, presumably because of this: https://github.com/llvm/llvm-project/blob/cb76896d6e45

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-19 Thread via cfe-commits
Sirraide wrote: Alright, I think this has the behaviour that we want now: - raw string literals are enabled in C++11 and later, as well as in C in gnuXY mode; - raw string literals can be explicitly enabled or disabled in C (and in C++ standards before C++11) using `-f[no-]raw-string-literals`;

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-19 Thread via cfe-commits
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/5] [Clang] Allow raw string literals in C as an extension --- clan

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-03 Thread via cfe-commits
cor3ntin wrote: > C has Unicode string literals as well: https://godbolt.org/z/chdjYrK9v and so > if we're allowing raw string literals, it makes sense to also allow raw > unicode string literals IMO. I don't think we need to rename the flag though. Yes, these things are completely orthogonal,

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-02 Thread via cfe-commits
https://github.com/Sirraide 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

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-02 Thread via cfe-commits
@@ -3850,6 +3850,7 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) { // the sequence "<::" will be unconditionally treated as "[:". // Cf. Lexer::LexTokenInternal. LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11; + LangOpts.RawStringLiterals = Lexi

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-02 Thread Owen Pan via cfe-commits
https://github.com/owenca 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

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-02 Thread Owen Pan via cfe-commits
https://github.com/owenca 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

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-02 Thread Owen Pan via cfe-commits
@@ -3850,6 +3850,7 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) { // the sequence "<::" will be unconditionally treated as "[:". // Cf. Lexer::LexTokenInternal. LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11; + LangOpts.RawStringLiterals = Lexi

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-05-31 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > In that case I think it might just make sense to ignore the flag in C++11 and > later then and allow it before C++11. I think that makes the most sense. https://github.com/llvm/llvm-project/pull/88265 ___ cfe-commits mailing lis

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-05-31 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: C has Unicode string literals as well: https://godbolt.org/z/chdjYrK9v and so if we're allowing raw string literals, it makes sense to also allow raw unicode string literals IMO. I don't think we need to rename the flag though. https://github.com/llvm/llvm-project/pull/8826

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-05-20 Thread via cfe-commits
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). Should

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-05-20 Thread via cfe-commits
@@ -3850,6 +3850,7 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) { // the sequence "<::" will be unconditionally treated as "[:". // Cf. Lexer::LexTokenInternal. LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11; + LangOpts.RawStringLiterals = Lexi

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-05-15 Thread via cfe-commits
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

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-05-15 Thread Aaron Ballman via cfe-commits
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 https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-comm

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-05-15 Thread Aaron Ballman via cfe-commits
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 i

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-05-07 Thread via cfe-commits
@@ -3850,6 +3850,7 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) { // the sequence "<::" will be unconditionally treated as "[:". // Cf. Lexer::LexTokenInternal. LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11; + LangOpts.RawStringLiterals = Lexi

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-05-06 Thread Owen Pan via cfe-commits
@@ -3850,6 +3850,7 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) { // the sequence "<::" will be unconditionally treated as "[:". // Cf. Lexer::LexTokenInternal. LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11; + LangOpts.RawStringLiterals = Lexi

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-05-04 Thread via cfe-commits
@@ -3850,6 +3850,7 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) { // the sequence "<::" will be unconditionally treated as "[:". // Cf. Lexer::LexTokenInternal. LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11; + LangOpts.RawStringLiterals = Lexi

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-05-03 Thread Owen Pan via cfe-commits
@@ -3850,6 +3850,7 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) { // the sequence "<::" will be unconditionally treated as "[:". // Cf. Lexer::LexTokenInternal. LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11; + LangOpts.RawStringLiterals = Lexi

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-04-22 Thread via cfe-commits
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 --- clan

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-04-22 Thread via cfe-commits
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++ (neither

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-04-19 Thread Aaron Ballman via cfe-commits
@@ -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 supp

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-04-18 Thread via cfe-commits
@@ -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 supp

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-04-18 Thread via cfe-commits
@@ -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 supp

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-04-18 Thread via cfe-commits
@@ -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 supp

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-04-18 Thread Aaron Ballman via cfe-commits
@@ -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 supp

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-04-18 Thread Aaron Ballman via cfe-commits
@@ -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 ``-f[no-]raw-string-lit

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-04-18 Thread Aaron Ballman via cfe-commits
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

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-04-18 Thread Aaron Ballman via 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 > ena

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-04-10 Thread via cfe-commits
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 litera

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-04-10 Thread via cfe-commits
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