File tree Expand file tree Collapse file tree
cpp/common/src/codingstandards/cpp Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,16 @@ module Cpp14Literal {
77 private import cpp as StandardLibrary
88
99 /** An numeric literal. */
10- abstract class NumericLiteral extends StandardLibrary:: Literal { }
10+ abstract class NumericLiteral extends StandardLibrary:: Literal {
11+ NumericLiteral ( ) {
12+ // exclude user-defined literals as they define custom suffixes
13+ not exists ( StandardLibrary:: FunctionCall fc |
14+ this = fc .getArgument ( 0 ) and fc .getTarget ( ) .getName ( ) .matches ( "operator \"\"%" )
15+ ) and
16+ // exclude literals derived from template instantiations
17+ not this .isFromTemplateInstantiation ( _)
18+ }
19+ }
1120
1221 /** Convenience for implementing class `UnrecognizedNumericLiteral` */
1322 abstract private class RecognizedNumericLiteral extends StandardLibrary:: Literal { }
@@ -49,7 +58,7 @@ module Cpp14Literal {
4958 * Octal literals must always start with the digit `0`.
5059 */
5160 class OctalLiteral extends IntegerLiteral , RecognizedNumericLiteral {
52- OctalLiteral ( ) { getValueText ( ) .regexpMatch ( "\\s*0[0-7']+ [uUlL]*\\s*" ) }
61+ OctalLiteral ( ) { getValueText ( ) .regexpMatch ( "\\s*0[0-7']* [uUlL]*\\s*" ) }
5362
5463 override string getAPrimaryQlClass ( ) { result = "OctalLiteral" }
5564 }
You can’t perform that action at this time.
0 commit comments