[llvm-commits] RFC: new tool: llvm-strings

Dmitri Gribenko gribozavr at gmail.com
Wed Nov 14 13:21:27 PST 2012


On Wed, Nov 14, 2012 at 10:30 PM, Marshall Clow <mclow.lists at gmail.com> wrote:
> Ok, I think I've got all the style guidelines.

Here are some nitpicks:

There's some trailing whitespace.

+/*
+  A string is just a sequence of printable characters

Documentation comments for the function should use '///' starting sequence.

+template <typename PrintFunction>
+error_code findStringsInBlob(StringRef theData, std::size_t initialOffset,
+                    std::size_t sizeThreshold, bool verbose,
PrintFunction pf) {

Please align parameter names on the second line to the first line.
Split to a third line if needed.  (Here and a few cases below.)

+        curr = p; // start new string

In general we don't put a comment on the same line as the comment.

+}
+
+
+template <typename PrintFunction>

Extra newline between functions.

+    errs() << "archive: " << a->getFileName() <<
+                       " does not contain a member named: " <<
onlyFile << endl;

Line break before '<<'.  '<<' should be aligned to the previous line's '<<'.

+  else for (std::vector<std::string>::iterator Iter = InputFileNames.begin(),
+                     End = InputFileNames.end(); !Err && Iter != End; ++Iter) {

In general, we align lines to the left rather than to the right.

> I haven't heard any complaints about the code ;-)
>
> Now I just need docs and tests.

More complaints may appear after you include tests :)

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the llvm-commits mailing list