[cfe-commits] [PATCH] Initial version of formatting library

Sean Silva silvas at purdue.edu
Sat Nov 17 14:01:37 PST 2012



================
Comment at: lib/Format/Format.cpp:49
@@ +48,3 @@
+    // Start iterating at 1 as we have correctly formatted of Token #0 above.
+    for (unsigned i = 1, n = Line.Tokens.size(); i != n; ++i) {
+      bool InsertNewLine = Line.Tokens[i].NewlinesBefore > 0;
----------------
Daniel Jasper wrote:
> Sean Silva wrote:
> > These variables should be capitalized.
> You mean as opposed to pretty much every example on http://llvm.org/docs/CodingStandards.html?
> 
> Also, they use e, not n, so I am going to change that back.
This wouldn't be the first time the coding standards document would be out of date with its own advice *sigh*. <http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly> very clearly states that variable names are upper camel case. I'm currently preparing a patch to fix the examples to comply with the docs.

Using N as the end seems to be more common recently in the clang codebase, although it really doesn't matter and isn't worth bikeshedding over.

```
sean:~/pg/llvm/llvm/tools/clang % git log --since='6 months ago' --pickaxe-regex --oneline -S'for.*unsigned.*\bI\b =.*N =' | wc -l
25
sean:~/pg/llvm/llvm/tools/clang % git log --since='6 months ago' --pickaxe-regex --oneline -S'for.*unsigned.*\bI\b =.*E =' | wc -l
5```


http://llvm-reviews.chandlerc.com/D80



More information about the cfe-commits mailing list