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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 19 05:49:45 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:

okay, so my guess was correct. It's still odd though because that same logic applies to C99 (it's "old" and the behavior can still change). But yeah, we should follow the same behavior as GCC in this case (less confusion for users).

https://github.com/llvm/llvm-project/pull/88265


More information about the cfe-commits mailing list