.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4. .TH CLANG-MODERNIZE "1" "October 2016" "clang-modernize 3.7" "User Commands" .SH NAME clang-modernize \- manual page for clang-modernize 3.7 .SH DESCRIPTION ERROR: ld.so: object 'libfakeroot\-sysv.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. USAGE: clang\-modernize [options] [...] .PP OPTIONS: .PP Formatting Options: .TP \fB\-format\fR \- Enable formatting of code changed by applying replacements. Use \fB\-style\fR to choose formatting style. .TP \fB\-style=\fR \- Coding style, currently supports: LLVM, Google, Chromium, Mozilla, WebKit. .TP Use \fB\-style\fR=\fI\,file\/\fR to load style configuration from \&.clang\-format file located in one of the parent directories of the source file (or current directory for stdin). Use \fB\-style=\fR"{key: value, ...}" to set specific parameters, e.g.: .IP \fB\-style=\fR"{BasedOnStyle: llvm, IndentWidth: 8}" .TP \fB\-style\-config=\fR \- Path to a directory containing a .clang\-format file describing a formatting style to use for formatting code when \fB\-style\fR=\fI\,file\/\fR. .PP Generic Options: .HP \fB\-help\fR \- Display available options (\fB\-help\-hidden\fR for more) .HP \fB\-help\-list\fR \- Display list of available options (\fB\-help\-list\-hidden\fR for more) .HP \fB\-version\fR \- Display the version of this program .PP Inclusion/Exclusion Options: .HP \fB\-exclude=\fR \- Comma\-separated list of paths that can not be transformed .HP \fB\-exclude\-from=\fR \- File containing a list of paths that can not be transformed .HP \fB\-include=\fR \- Comma\-separated list of paths to consider to be transformed .HP \fB\-include\-from=\fR \- File containing a list of paths to consider to be transformed .PP Modernizer Options: .HP \fB\-final\-syntax\-check\fR \- Check for correct syntax after applying transformations .TP \fB\-for\-compilers=\fR \- Select transforms targeting the intersection of language features supported by the given compilers. Takes a comma\-separated list of \-. .TP can be any of: clang, gcc, icc, msvc is [.] .HP \fB\-perf=\fR \- Capture performance data and output to specified directory. Default: ./migrate_perf .HP \fB\-risk\fR \- Select a maximum risk level: .TP =safe \- Only safe transformations .TP =reasonable \- Enable transformations that might change semantics (default) .TP =risky \- Enable transformations that are likely to change semantics .HP \fB\-summary\fR \- Print transform summary .PP Serialization Options: .TP \fB\-serialize\-dir=\fR \- Path to an existing directory in which to write serialized replacements. Default behaviour is to write to a temporary directory. .HP \fB\-serialize\-replacements\fR \- Serialize translation unit replacements to disk instead of changing files. .PP Transforms: .HP \fB\-add\-override\fR \- Make use of override specifier where possible .HP \fB\-loop\-convert\fR \- Make use of range\-based for loops where possible .HP \fB\-pass\-by\-value\fR \- Pass parameters by value where possible .HP \fB\-replace\-auto_ptr\fR \- Replace std::auto_ptr (deprecated) by std::unique_ptr (EXPERIMENTAL) .HP \fB\-use\-auto\fR \- Use of 'auto' type specifier .HP \fB\-use\-nullptr\fR \- Make use of nullptr keyword where possible .PP Transforms' options: .HP \fB\-override\-macros\fR \- Detect and use macros that expand to the 'override' keyword. .HP \fB\-user\-null\-macros=\fR \- Comma\-separated list of user\-defined macro names that behave like NULL .PP \fB\-p\fR is used to read a compile command database. .IP For example, it can be a CMake build directory in which a file named compile_commands.json exists (use \fB\-DCMAKE_EXPORT_COMPILE_COMMANDS\fR=\fI\,ON\/\fR CMake option to get this output). When no build path is specified, a search for compile_commands.json will be attempted through all parent paths of the first input file . See: http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html for an example of setting up Clang Tooling on a source tree. .PP ... specify the paths of source files. These paths are .IP looked up in the compile command database. If the path of a file is absolute, it needs to point into CMake's source tree. If the path is relative, the current working directory needs to be in the CMake source tree and the file must be in a subdirectory of the current working directory. "./" prefixes in the relative files will be automatically removed, but the rest of a relative path must be a suffix of a path in the compile command database. .PP EXAMPLES: .PP Apply all transforms on a file that doesn't require compilation arguments: .IP clang\-modernize file.cpp .PP Convert for loops to ranged\-based for loops for all files in the compilation database that belong in a project subtree and then reformat the code automatically using the LLVM style: .IP clang\-modernize \fB\-p\fR build/path \fB\-include\fR project/path \fB\-format\fR \fB\-loop\-convert\fR .PP Make use of both nullptr and the override specifier, using git ls\-files: .IP git ls\-files '*.cpp' | xargs \fB\-I\fR{} clang\-modernize \fB\-p\fR build/path \e .HP \fB\-use\-nullptr\fR \fB\-add\-override\fR \fB\-override\-macros\fR {} .PP Apply all transforms supported by both clang >= 3.0 and gcc >= 4.7 to foo.cpp and any included headers in bar: .IP clang\-modernize \fB\-for\-compilers\fR=\fI\,clang\-3\/\fR.0,gcc\-4.7 foo.cpp \e .HP \fB\-include\fR bar \fB\-\-\fR \fB\-std\fR=\fI\,c\/\fR++11 \fB\-Ibar\fR .SH "SEE ALSO" The full documentation for .B clang-modernize is maintained as a Texinfo manual. If the .B info and .B clang-modernize programs are properly installed at your site, the command .IP .B info clang-modernize .PP should give you access to the complete manual.