[PATCH] Pulled out cast detection in TokenAnnotator into its own function
Daniel Jasper
djasper at google.com
Tue May 6 00:59:35 PDT 2014
================
Comment at: lib/Format/TokenAnnotator.cpp:827
@@ +826,3 @@
+ /// \brief Determine whether ')' is ending a cast.
+ TokenType determineCastUsage(const FormatToken &Tok) {
+ TokenType tokType = Tok.Type;
----------------
I think this should return a bool (essentially IsCast..). Otherwise, this is a bit confusing and it gets much harder to understand the what can actually happen here.
================
Comment at: lib/Format/TokenAnnotator.cpp:828
@@ +827,3 @@
+ TokenType determineCastUsage(const FormatToken &Tok) {
+ TokenType tokType = Tok.Type;
+ FormatToken *LeftOfParens = NULL;
----------------
According to LLVM naming conventions this needs to be TokType.
================
Comment at: lib/Format/TokenAnnotator.cpp:881
@@ +880,3 @@
+ }
+ if (IsCast && !ParensAreEmpty)
+ return TT_CastRParen;
----------------
So basically "return IsCast && !ParensAreEmpty;"
http://reviews.llvm.org/D3619
More information about the cfe-commits
mailing list