<div dir="ltr">Seems out of place in a function "getAddDependenciesAdjuster". Also it seems egregious to change the default language, what's the rationale?<div><br></div><div>-- Sean Silva<br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 6, 2015 at 11:43 AM, John Thompson <span dir="ltr"><<a href="mailto:John.Thompson.JTSoftware@gmail.com" target="_blank">John.Thompson.JTSoftware@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: jtsoftware<br>
Date: Wed May  6 13:43:01 2015<br>
New Revision: 236625<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=236625&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=236625&view=rev</a><br>
Log:<br>
Changed option processing to implicitly use -x c++ if no other -x option specified.  Added implicit -w option to disable compilation warnings, in particular to avoid warning on pragma once.<br>
<br>
Modified:<br>
    clang-tools-extra/trunk/docs/ModularizeUsage.rst<br>
    clang-tools-extra/trunk/modularize/Modularize.cpp<br>
<br>
Modified: clang-tools-extra/trunk/docs/ModularizeUsage.rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ModularizeUsage.rst?rev=236625&r1=236624&r2=236625&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ModularizeUsage.rst?rev=236625&r1=236624&r2=236625&view=diff</a><br>
==============================================================================<br>
--- clang-tools-extra/trunk/docs/ModularizeUsage.rst (original)<br>
+++ clang-tools-extra/trunk/docs/ModularizeUsage.rst Wed May  6 13:43:01 2015<br>
@@ -37,9 +37,10 @@ directory.<br>
<br>
 ``<front-end-options>`` is a place-holder for regular Clang<br>
 front-end arguments, which must follow the <include-files-list>.<br>
-Note that by default, the underlying Clang front end assumes .h files<br>
-contain C source, so you might need to specify the ``-x c++`` Clang option<br>
-to tell Clang that the header contains C++ definitions.<br>
+Note that by default, modularize assumes .h files<br>
+contain C++ source, so if you are using a different language,<br>
+you might need to use a ``-x`` option to tell Clang that the<br>
+header contains another language, i.e.:  ``-x c``<br>
<br>
 Note also that because modularize does not use the clang driver,<br>
 you will likely need to pass in additional compiler front-end<br>
<br>
Modified: clang-tools-extra/trunk/modularize/Modularize.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/Modularize.cpp?rev=236625&r1=236624&r2=236625&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/Modularize.cpp?rev=236625&r1=236624&r2=236625&view=diff</a><br>
==============================================================================<br>
--- clang-tools-extra/trunk/modularize/Modularize.cpp (original)<br>
+++ clang-tools-extra/trunk/modularize/Modularize.cpp Wed May  6 13:43:01 2015<br>
@@ -73,9 +73,9 @@<br>
 // you will likely need to pass in additional compiler front-end<br>
 // arguments to match those passed in by default by the driver.<br>
 //<br>
-// Note that by default, the underlying Clang front end assumes .h files<br>
-// contain C source.  If your .h files in the file list contain C++ source,<br>
-// you should append the following to your command lines: -x c++<br>
+// Note that by default, the modularize assumes .h files contain C++ source.<br>
+// If your .h files in the file list contain another language, you should<br>
+// append an appropriate -x option to your command line, i.e.:  -x c<br>
 //<br>
 // Modularization Issue Checks<br>
 //<br>
@@ -331,7 +331,8 @@ static std::string findInputFile(const C<br>
 }<br>
<br>
 // This arguments adjuster inserts "-include (file)" arguments for header<br>
-// dependencies.<br>
+// dependencies.  It also insertts a "-w" option and a "-x c++",<br>
+// if no other "-x" option is present.<br>
 static ArgumentsAdjuster<br>
 getAddDependenciesAdjuster(DependencyMap &Dependencies) {<br>
   return [&Dependencies](const CommandLineArguments &Args) {<br>
@@ -346,6 +347,13 @@ getAddDependenciesAdjuster(DependencyMap<br>
         NewArgs.push_back(FileDependents[Index]);<br>
       }<br>
     }<br>
+    // Ignore warnings.  (Insert after "clang_tool" at beginning.)<br>
+    NewArgs.insert(NewArgs.begin() + 1, "-w");<br>
+    // Since we are compiling .h files, assume C++ unless given a -x option.<br>
+    if (std::find(NewArgs.begin(), NewArgs.end(), "-x") == NewArgs.end()) {<br>
+      NewArgs.insert(NewArgs.begin() + 2, "-x");<br>
+      NewArgs.insert(NewArgs.begin() + 3, "c++");<br>
+    }<br>
     return NewArgs;<br>
   };<br>
 }<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div></div>