[clang-tools-extra] r236625 - 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.

Sean Silva chisophugis at gmail.com
Wed May 6 12:51:48 PDT 2015


Seems out of place in a function "getAddDependenciesAdjuster". Also it
seems egregious to change the default language, what's the rationale?

-- Sean Silva

On Wed, May 6, 2015 at 11:43 AM, John Thompson <
John.Thompson.JTSoftware at gmail.com> wrote:

> Author: jtsoftware
> Date: Wed May  6 13:43:01 2015
> New Revision: 236625
>
> URL: http://llvm.org/viewvc/llvm-project?rev=236625&view=rev
> Log:
> 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.
>
> Modified:
>     clang-tools-extra/trunk/docs/ModularizeUsage.rst
>     clang-tools-extra/trunk/modularize/Modularize.cpp
>
> Modified: clang-tools-extra/trunk/docs/ModularizeUsage.rst
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ModularizeUsage.rst?rev=236625&r1=236624&r2=236625&view=diff
>
> ==============================================================================
> --- clang-tools-extra/trunk/docs/ModularizeUsage.rst (original)
> +++ clang-tools-extra/trunk/docs/ModularizeUsage.rst Wed May  6 13:43:01
> 2015
> @@ -37,9 +37,10 @@ directory.
>
>  ``<front-end-options>`` is a place-holder for regular Clang
>  front-end arguments, which must follow the <include-files-list>.
> -Note that by default, the underlying Clang front end assumes .h files
> -contain C source, so you might need to specify the ``-x c++`` Clang option
> -to tell Clang that the header contains C++ definitions.
> +Note that by default, modularize assumes .h files
> +contain C++ source, so if you are using a different language,
> +you might need to use a ``-x`` option to tell Clang that the
> +header contains another language, i.e.:  ``-x c``
>
>  Note also that because modularize does not use the clang driver,
>  you will likely need to pass in additional compiler front-end
>
> Modified: clang-tools-extra/trunk/modularize/Modularize.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/Modularize.cpp?rev=236625&r1=236624&r2=236625&view=diff
>
> ==============================================================================
> --- clang-tools-extra/trunk/modularize/Modularize.cpp (original)
> +++ clang-tools-extra/trunk/modularize/Modularize.cpp Wed May  6 13:43:01
> 2015
> @@ -73,9 +73,9 @@
>  // you will likely need to pass in additional compiler front-end
>  // arguments to match those passed in by default by the driver.
>  //
> -// Note that by default, the underlying Clang front end assumes .h files
> -// contain C source.  If your .h files in the file list contain C++
> source,
> -// you should append the following to your command lines: -x c++
> +// Note that by default, the modularize assumes .h files contain C++
> source.
> +// If your .h files in the file list contain another language, you should
> +// append an appropriate -x option to your command line, i.e.:  -x c
>  //
>  // Modularization Issue Checks
>  //
> @@ -331,7 +331,8 @@ static std::string findInputFile(const C
>  }
>
>  // This arguments adjuster inserts "-include (file)" arguments for header
> -// dependencies.
> +// dependencies.  It also insertts a "-w" option and a "-x c++",
> +// if no other "-x" option is present.
>  static ArgumentsAdjuster
>  getAddDependenciesAdjuster(DependencyMap &Dependencies) {
>    return [&Dependencies](const CommandLineArguments &Args) {
> @@ -346,6 +347,13 @@ getAddDependenciesAdjuster(DependencyMap
>          NewArgs.push_back(FileDependents[Index]);
>        }
>      }
> +    // Ignore warnings.  (Insert after "clang_tool" at beginning.)
> +    NewArgs.insert(NewArgs.begin() + 1, "-w");
> +    // Since we are compiling .h files, assume C++ unless given a -x
> option.
> +    if (std::find(NewArgs.begin(), NewArgs.end(), "-x") == NewArgs.end())
> {
> +      NewArgs.insert(NewArgs.begin() + 2, "-x");
> +      NewArgs.insert(NewArgs.begin() + 3, "c++");
> +    }
>      return NewArgs;
>    };
>  }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150506/64803e38/attachment.html>


More information about the cfe-commits mailing list