[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 18 11:10:52 PDT 2024
================
@@ -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 supports raw string literals in C, but not in C++ before C++11.
+ return isCPlusPlus11() || (!isCPlusPlus() && isGNUMode());
----------------
AaronBallman wrote:
GCC doesn't allow them in gnu89 mode: https://godbolt.org/z/hahja6Y87
If I had to hazard a guess as to why, my guess is that there are concerns about `R` conflicting with a user-defined macro. The same concern exists in all versions of C, but code explicitly compiling in C89 mode can be a signal the code isn't being actively maintained in some regard. But still, this is a bit of a surprise, so it might be nice to understand better why the discrepancy exists.
https://github.com/llvm/llvm-project/pull/88265
More information about the cfe-commits
mailing list