[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

2017-11-09 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment. In https://reviews.llvm.org/D39799#920780, @JVApen wrote: > How does this new file know if it should handle it's flags as it does in > clang.exe or clang-cl.exe? It doesn't set argv[0], so it's treated like `clang` by default. I believe the flag `--driver-mode={gcc

[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

2017-11-09 Thread JVApen via Phabricator via cfe-commits
JVApen added a comment. How does this new file know if it should handle it's flags as it does in clang.exe or clang-cl.exe? Repository: rL LLVM https://reviews.llvm.org/D39799 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists

[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

2017-11-09 Thread Sam McCall via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL31: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found. (authored by sammccall). Repository: rL LLVM https://reviews.llvm.org/D39799 Files: cfe/trunk/docs/JSONCompilationDa

[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

2017-11-09 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 122211. sammccall added a comment. Add fixme to upgrade out-param APIs. https://reviews.llvm.org/D39799 Files: docs/JSONCompilationDatabase.rst include/clang/Tooling/CompilationDatabase.h lib/Tooling/CompilationDatabase.cpp test/Tooling/Inputs/fix

[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

2017-11-09 Thread Manuel Klimek via Phabricator via cfe-commits
klimek accepted this revision. klimek added a comment. lg Comment at: lib/Tooling/CompilationDatabase.cpp:312 +FixedCompilationDatabase::loadFromFile(StringRef Path, std::string &ErrorMsg) { + ErrorMsg.clear(); + llvm::ErrorOr> File = sammccall wrote: > klime

[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

2017-11-09 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision. ilya-biryukov added a comment. This revision is now accepted and ready to land. In https://reviews.llvm.org/D39799#920195, @sammccall wrote: > It's doable, but then you're fighting the infrastructure here. The same > ambiguity can exist between any pair of C

[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

2017-11-09 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment. In https://reviews.llvm.org/D39799#919508, @ilya-biryukov wrote: > In https://reviews.llvm.org/D39799#919494, @sammccall wrote: > > > e.g. IIUC, things like `#include "sibling.h"` won't look for the h file > > next to the cc file? > > > Actually, this should work as qu

[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

2017-11-09 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 122206. sammccall added a comment. Add test verifying that working directory is compile_flags's parent. https://reviews.llvm.org/D39799 Files: docs/JSONCompilationDatabase.rst include/clang/Tooling/CompilationDatabase.h lib/Tooling/CompilationDataba

[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

2017-11-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. In https://reviews.llvm.org/D39799#919494, @sammccall wrote: > e.g. IIUC, things like `#include "sibling.h"` won't look for the h file next > to the cc file? Actually, this should work as quoted includes are always searched relative to the current file before lo

[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

2017-11-08 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment. In https://reviews.llvm.org/D39799#919468, @ilya-biryukov wrote: > In https://reviews.llvm.org/D39799#919415, @sammccall wrote: > > > Currently the working directory is always the parent of `compile_flags.txt` > > as you suggest. > > Maybe this isn't great though - so

[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

2017-11-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. In https://reviews.llvm.org/D39799#919415, @sammccall wrote: > Currently the working directory is always the parent of `compile_flags.txt` > as you suggest. > Maybe this isn't great though - sometimes it might be important that the WD > is the parent of the sourc

[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

2017-11-08 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 122100. sammccall added a comment. llvm::make_unique https://reviews.llvm.org/D39799 Files: docs/JSONCompilationDatabase.rst include/clang/Tooling/CompilationDatabase.h lib/Tooling/CompilationDatabase.cpp test/Tooling/fixed-database.cpp Index: te

[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

2017-11-08 Thread Sam McCall via Phabricator via cfe-commits
sammccall marked an inline comment as done. sammccall added a comment. In https://reviews.llvm.org/D39799#919388, @ilya-biryukov wrote: > I can see that `FixedCompilationDatabase` does not set a working directory. > Is this something we may want to have for `compile_flags.txt` or one would > ne

[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

2017-11-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. I can see that `FixedCompilationDatabase` does not set a working directory. Is this something we may want to have for `compile_flags.txt` or one would need to resort to `compile_commands.json` to get this? E.g., I'd find it useful to add includes with paths relativ

[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

2017-11-08 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments. Comment at: include/clang/Tooling/CompilationDatabase.h:188 + static std::unique_ptr + loadFromFile(StringRef Path, std::string &ErrorMsg); + klimek wrote: > Perhaps loadFromTextFile? This mirrors JSONCompilationDatabase for con

[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

2017-11-08 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added inline comments. Comment at: include/clang/Tooling/CompilationDatabase.h:188 + static std::unique_ptr + loadFromFile(StringRef Path, std::string &ErrorMsg); + Perhaps loadFromTextFile? Comment at: lib/Tooling/CompilationDatabase.

[PATCH] D39799: [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

2017-11-08 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision. Herald added a subscriber: ilya-biryukov. This is an alternative to JSONCompilationDatabase for simple projects that don't use a build system such as CMake. (You can also drop one in ~, to make your tools use e.g. C++11 by default) There's no facility for varying