[PATCH] D71727: [clang][Tooling] Prefer -x over -std when interpolating

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 20 04:15:08 PST 2019


sammccall added a comment.

Thanks for taking care of this!



================
Comment at: clang/lib/Tooling/InterpolatingCompilationDatabase.cpp:194
 
-    if (Std != LangStandard::lang_unspecified) // -std take precedence over -x
+    // Make use of -std iff -x was missing.
+    if (Type == types::TY_INVALID && Std != LangStandard::lang_unspecified)
----------------
Note that type is initialized from guessType, not only -x, so this comment isn't true in general, just for *.h.

Example: if CDB contains `clang -std=c++14 foo.cc`, then we'll treat `foo.mm` as obj-c++ rather than c++. (The right thing in that case and probably in general)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71727/new/

https://reviews.llvm.org/D71727





More information about the cfe-commits mailing list