]> granicus.if.org Git - clang/commit
[Tooling] Improve handling of CL-style options
authorHamza Sood <hamza_sood@me.com>
Sun, 9 Sep 2018 12:06:35 +0000 (12:06 +0000)
committerHamza Sood <hamza_sood@me.com>
Sun, 9 Sep 2018 12:06:35 +0000 (12:06 +0000)
commite978feba76c11c9882c59321a1901445555c1f89
tree733d0bed0455f8eeff0ba1cf80cf1900b41ef274
parent22354ba448e057204e41c2e5f4bac7833a677c40
[Tooling] Improve handling of CL-style options

This patch fixes the handling of clang-cl options in InterpolatingCompilationDatabase.
They were previously ignored completely, which led to a lot of bugs:

Additional options were being added with the wrong syntax. E.g. a file was
specified as C++ by adding -x c++, which causes an error in CL mode.

The args were parsed and then rendered, which means that the aliasing information
was lost. E.g. /W4 was rendered to -Wall, which in CL mode means -Weverything.

CL options were ignored when checking things like -std=, so a lot of logic was
being bypassed.

Differential Revision: https://reviews.llvm.org/D51321

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341760 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Tooling/InterpolatingCompilationDatabase.cpp
unittests/Tooling/CompilationDatabaseTest.cpp