[PATCH] D19331: [Clang-tidy] Fix for crash in modernize-raw-string-literal check
Marek via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 20 13:27:17 PDT 2016
edyp87 marked an inline comment as done.
edyp87 added a comment.
1. Extended diff has been generated - sorry, I am new to Phabricator.
2. AST for this case looks like this:
> AST for crashing case:
>
> -VarDecl 0x2b27370 <line:96:1, col:28> col:19 function 'const char *const' callinit
> `-ImplicitCastExpr 0x2b274c0 <col:28> 'const char *' <ArrayToPointerDecay>
> `-PredefinedExpr 0x2b27470 <col:28> 'const char [1]' lvalue __FUNCTION__
> `-StringLiteral 0x2b27448 <col:28> 'const char [1]' lvalue ""
>
> Valid case:
>
> -VarDecl 0x2b26660 <line:90:1, col:32> col:19 HexPrintable 'const char *const' callinit
> `-ImplicitCastExpr 0x2b26718 <col:32> 'const char *' <ArrayToPointerDecay>
> `-StringLiteral 0x2b266b8 <col:32> 'const char [3]' lvalue "@\\"
For `StringExpr` whose parent is `PredefinedExpr` `Lexer::getSourceText` returns this expr literally (`__FUNCTION__`) instead of evaluated function name.
I was wondering whether there is another case which results in such assert (lack of quote in string) but I could not came with an idea of such scenario.
Another approach would be just returning from `check()` method while evaluating "quote-less" string but I thought that it would be less elegant.
http://reviews.llvm.org/D19331
More information about the cfe-commits
mailing list