[PATCH] D16012: Carry raw string literal information through to the AST StringLiteral representation

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 8 13:57:29 PST 2016


aaron.ballman created this revision.
aaron.ballman added reviewers: rsmith, dblaikie.
aaron.ballman added a subscriber: cfe-commits.

The AST does not currently carry information about whether a string literal is raw or not in the StringLiteral AST representation, which this patch rectifies. It exposes information about whether a string literal is raw, and what prefix (if any) a raw string literal uses. The patch also adds support for pretty printing a raw string literal.

One thing to note, however, is that this is not 100% perfect because of translation phase 6, where adjacent string literals are concatenated. This patch only supports concatenated raw string literals that have the same prefix. It does not support differing prefixes, or adjacent raw & nonraw literals. I felt that these were a sufficiently uncommon edge case to not attempt to support.

http://reviews.llvm.org/D16012

Files:
  include/clang/AST/Expr.h
  include/clang/Lex/LiteralSupport.h
  lib/AST/Expr.cpp
  lib/Frontend/Rewrite/RewriteModernObjC.cpp
  lib/Frontend/Rewrite/RewriteObjC.cpp
  lib/Lex/LiteralSupport.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaExprObjC.cpp
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  test/Misc/ast-print-string-literal.cpp
  test/PCH/cxx-string-literal.cpp
  test/SemaCXX/cxx11-ast-print.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16012.44374.patch
Type: text/x-patch
Size: 21212 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160108/dd3652ed/attachment-0001.bin>


More information about the cfe-commits mailing list