sammccall added a comment.

The idea here does seem to be a natural extension of -style, at least for the 
case when the arg is a filename directly. I'm not opposed, happy to review this.

I do want to probe the use case a bit though: we have found that configuring 
via -style= doesn't scale that well to lots of codebases and tools. e.g. if 
someone's running clang-tidy or clangd via some driver, are they going to have 
a way to plumb through the right -style=?

Being able to discover the right style from the filesystem is powerful, and if 
I was going to use this flag, I'd consider symlinking the style-file to 
`subproject/.clang_format` instead. That way the setting is persistent and 
available to all tools, rather than us needing to get it right on each 
invocation.



================
Comment at: lib/Format/Format.cpp:938
+  const llvm::SmallVector<Twine, 3> paths = {
+    {"/usr/local/share/clang-format/", Name},
+    {"~/.local/share/clang-format/", Name},
----------------
I'm not sure these prefixes are a good idea - can you explain what the purpose 
is, and why the simpler model of just using the path doesn't work?

Certainly this needs some more thought about how it would work on windows etc. 
I'd suggest limiting this patch to filenames.


Repository:
  rC Clang

https://reviews.llvm.org/D50147



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to