summaryrefslogtreecommitdiffstats
path: root/tools/clang-format
Commit message (Collapse)AuthorAgeFilesLines
* Fix clang-format CLion integration bug.Eric Liu2017-11-021-1/+1
| | | | | | | | | | | | | CLion's Sax parser threw this error: Failed to parse clang-format XML replacements. Input: <?xml version='1.0'?> <replacements xml:space='preserve' incomplete_format='true' line=89> [...] [org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 66; Open quote is expected for attribute "line" associated with an element type "replacements".] Patch by Justine Tunney (jart@google.com)! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317205 91177308-0d34-0410-b5e6-96231b3b80d8
* [cmake] Rename LIB_FUZZING_ENGINE to LLVM_LIB_FUZZING_ENGINE.Matt Morehouse2017-10-122-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315630 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Allow building fuzzer with OSS-Fuzz flags.Matt Morehouse2017-10-122-3/+7
| | | | | | | | | | | | Reviewers: kcc, bogner Reviewed By: kcc Subscribers: cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D38853 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315603 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for llvm change.Rafael Espindola2017-09-081-1/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312766 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Fix lines=all case in clang-format.pyKrasimir Georgiev2017-09-051-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312536 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix ClangFormatFuzzer.George Karpenkov2017-08-241-2/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311621 91177308-0d34-0410-b5e6-96231b3b80d8
* Update Clang fuzzers to use libFuzzer bundled with the toolchain.George Karpenkov2017-08-231-3/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D37043 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311516 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Fix lines regression in clang-format.pyKrasimir Georgiev2017-08-221-1/+1
| | | | | | | | | | | | | | | | Summary: This patch fixes a regression after https://reviews.llvm.org/rL305665, which updates the structure of the `lines` variable. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D37011 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311456 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: add an option -verbose to list the files being processedSylvestre Ledru2017-08-121-16/+16
| | | | | | | | | | | | | | Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D34824 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310778 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Add capability to format the diff on save in vim.Daniel Jasper2017-06-191-2/+13
| | | | | | | | | | | | With this patch, one can configure a BufWrite hook that will make the clang-format integration compute a diff of the current buffer with the file that's on disk and format all changed lines. This should create a zero-overhead auto-format solution that doesn't require the file to already be clang-format clean to avoid spurious diffs. Review: https://reviews.llvm.org/D32429 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305665 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Allow git-clang-format to handle empty extensions.Eric Fiselier2017-06-151-0/+2
| | | | | | | | | | | Most of libc++'s header files don't use extension. This prevents using git-clang-format on them, which is frustrating. This patch allows empty extensions to be passed using either the --extensions option, or the clangformat.extensions git-config value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305437 91177308-0d34-0410-b5e6-96231b3b80d8
* Print registered targets in clang's version informationDimitry Andric2017-06-061-2/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Other llvm tools display their registered targets when showing version information, but for some reason clang has never done this. To support this, D33899 adds the llvm parts, which make it possible to print version information to arbitrary raw_ostreams. This change adds a call to printRegisteredTargetsForVersion in clang's PrintVersion, and adds a raw_ostream parameter to two other PrintVersion functions. Reviewers: beanz, chandlerc, dberris, mehdi_amini, zturner Reviewed By: mehdi_amini Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33900 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304836 91177308-0d34-0410-b5e6-96231b3b80d8
* Make git-clang-format python 3 compatibleEric Fiselier2017-05-251-4/+30
| | | | | | | | | | | | | | Summary: This patch attempts to make `git-clang-format` both python2 and python3 compatible. Currently it only works in python2. Reviewers: modocache, compnerd, djasper, jbcoe, srhines, ddunbar Reviewed By: jbcoe Subscribers: kimgr, mgorny, llvm-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D30773 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303871 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Replace IncompleteFormat by a struct with LineKrasimir Georgiev2017-04-211-5/+12
| | | | | | | | | | | | | | Summary: This patch replaces the boolean IncompleteFormat that is used to notify the client if an unrecoverable syntax error occurred by a struct that also contains a line number. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D32298 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300985 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix Python 2 vs 3 incompatability with dict.items() vs iteritems()Eric Fiselier2017-04-201-1/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300895 91177308-0d34-0410-b5e6-96231b3b80d8
* Begin making git-clang-format python3 compatible.Eric Fiselier2017-04-201-21/+25
| | | | | | | | | | | | | | | | | | | | | | This patch fixes most of the python3 incompatabilities within git-clang-format while keeping the script python2 compatible. There is still one remaining incompatability that prevents using Python3 which is the `str` vs `byte` type change. I plan to put those fixes up for review separately. This patch contains fixes for the following incompatabilities: 1) Use the new style Python3 `print` function. This requires importing __future__.print_function. 2) Fix incompatability between the Python3 octal prefix and the octal prefix Git uses. 3) Replace use of dict.iteritems() with dict.viewitems() because iteritems() has been removed in Python3. viewitems() reviews python 2.7 but that is also what the script is documented as requiring. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300891 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Don't leave behind temp files in -i mode on Windows, PR26125, ↵Nico Weber2017-02-271-4/+9
| | | | | | | | | | | | | | | | | | | reloaded Second attempt after http://llvm.org/viewvc/llvm-project?rev=296166&view=rev In the first attempt, Code (the memory buffer backing the input file) was reset before overwriteChangedFiles() was called, but overwriteChangedFiles() still reads from it. This time, load the whole input file into memory instead of using mmap when formatting in-place. (Since the test is identical to what was in the repo before chapuni's revert, svn diff doesn't show it – see the above link for the test.) https://reviews.llvm.org/D30385 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296408 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r296166, "clang-format: Don't leave behind temp files in -i mode on ↵NAKAMURA Takumi2017-02-251-1/+0
| | | | | | | | | | | | | | | | | | | | | Windows, PR26125", and r296171. (MemoryBuffer)Code.reset() was too early. ==26912== Invalid read of size 1 ==26912== at 0x437E1D: llvm::MemoryBuffer::init(char const*, char const*, bool) (MemoryBuffer.cpp:47) ==26912== by 0x438013: (anonymous namespace)::MemoryBufferMem::MemoryBufferMem(llvm::StringRef, bool) (MemoryBuffer.cpp:86) ==26912== by 0x438128: llvm::MemoryBuffer::getMemBuffer(llvm::StringRef, llvm::StringRef, bool) (MemoryBuffer.cpp:112) ==26912== by 0x4E189D: clang::vfs::detail::(anonymous namespace)::InMemoryFileAdaptor::getBuffer(llvm::Twine const&, long, bool, bool) (VirtualFileSystem.cpp:443) ==26912== by 0x4DF5BA: clang::vfs::FileSystem::getBufferForFile(llvm::Twine const&, long, bool, bool) (VirtualFileSystem.cpp:94) ==26912== by 0x4B72EC: clang::FileManager::getBufferForFile(clang::FileEntry const*, bool, bool) (FileManager.cpp:443) ==26912== by 0x4C1F81: clang::SrcMgr::ContentCache::getBuffer(clang::DiagnosticsEngine&, clang::SourceManager const&, clang::SourceLocation, bool*) const (SourceManager.cpp:98) ==26912== by 0x4C50E5: clang::SourceManager::getBufferData(clang::FileID, bool*) const (SourceManager.cpp:689) ==26912== by 0x58E794: clang::Rewriter::getEditBuffer(clang::FileID) (Rewriter.cpp:230) ==26912== by 0x407297: clang::format::format(llvm::StringRef) (ClangFormat.cpp:311) ==26912== by 0x4078D7: main (ClangFormat.cpp:363) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296237 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Don't leave behind temp files in -i mode on Windows, PR26125Nico Weber2017-02-241-0/+1
| | | | | | | Fix and analysis by Wei Mao <weimao1@gmail.com> (see bug), test by me. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296166 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: [JS] do not format MPEG transport streams.Martin Probst2017-01-271-0/+1
| | | | | | | | | | | | | | | Summary: The MPEG transport stream file format also uses ".ts" as its file extension. This change detects its specific framing format (0x47 every 189 bytes) and simply ignores MPEG TS files. Reviewers: djasper, sammccall Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D29186 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293270 91177308-0d34-0410-b5e6-96231b3b80d8
* Use UTF-8 for all communication with clang-formatPhilipp Stephani2017-01-202-21/+42
| | | | | | | | | | | | Summary: Instead of picking the buffer file coding system, always use utf-8-unix for communicating with clang-format. This is fine because clang-format never actually reads the file to be formatted, only standard input. This is a bit simpler (process coding system is now a constant) and potentially faster, as utf-8-unix is Emacs's internal coding system. Also add an end-to-end test that actually invokes clang-format. Reviewers: klimek Reviewed By: klimek Differential Revision: https://reviews.llvm.org/D28904 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292593 91177308-0d34-0410-b5e6-96231b3b80d8
* Make sure that clang-format input is in the right encodingPhilipp Stephani2017-01-172-1/+115
| | | | | | | | | | | | Summary: Add unit tests. Reviewers: klimek, massberg Reviewed By: massberg Differential Revision: https://reviews.llvm.org/D28800 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292234 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Make GetStyle return Expected<FormatStyle> instead of FormatStyleAntonio Maiorano2017-01-171-7/+17
| | | | | | | | | | Change the contract of GetStyle so that it returns an error when an error occurs (i.e. when it writes to stderr), and only returns the fallback style when it can't find a configuration file. Differential Revision: https://reviews.llvm.org/D28081 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292174 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Separate out a language kind for ObjC.Daniel Jasper2016-12-121-1/+2
| | | | | | | | | | | | | While C(++) and ObjC are generally formatted the same way and can be mixed, people might want to choose different styles based on the language. This patch recognizes .m and .mm files as ObjC and also implements a very crude detection of whether or not a .h file contains ObjC code. This can be improved over time. Also move most of the ObjC tests into their own test file to keep file size maintainable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289428 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Another attempt at python 3 compatibilityVedant Kumar2016-12-101-1/+7
| | | | | | | | | The entries in vim.current.buffer appear to be decoded strings, which means that python3 won't allow invoking 'decode' on them. Keep the old behavior when running under python2, but skip the error-inducing decode step with python3.. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289308 91177308-0d34-0410-b5e6-96231b3b80d8
* Add the --no-color option to the git call in the doc when using ↵Sylvestre Ledru2016-12-031-1/+1
| | | | | | clang-format-diff git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288605 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Use git-ls-tree to get file mode in diff modeStephen Hines2016-11-081-1/+10
| | | | | | | | | | | | | | | | | | Summary: If a file has been renamed/deleted from the filesystem and --diff mode with two commits is active, attempting to get the file's mode will fail. This change uses git-ls-tree instead to get the correct permissions for the given revision. Patch by Luis Hector Chavez! Reviewers: djasper, lodato Subscribers: srhines, cfe-commits Differential Revision: https://reviews.llvm.org/D26287 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286212 91177308-0d34-0410-b5e6-96231b3b80d8
* Attempt to make clang-format.py python 3 - compatible.Alexander Kornienko2016-10-271-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285301 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix warnings from python difflib.Alexander Kornienko2016-10-271-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285291 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix clang-format vim integration issue with non-ascii charactersAlexander Kornienko2016-10-241-1/+1
| | | | | | | | | | | | | | | | clang-format.py currently seems to treat vim.current.buf as ascii-encoded data, which leads to an UnicodeDecodeError when trying to format any text containing non-ascii characters: Traceback (most recent call last): File "<string>", line 1, in <module> File ".../tools/clang/tools/clang-format/clang-format.py", line 110, in <module> main() File ".../tools/clang/tools/clang-format/clang-format.py", line 87, in main stdout, stderr = p.communicate(input=text.encode(encoding)) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 3996: ordinal not in range(128) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284988 91177308-0d34-0410-b5e6-96231b3b80d8
* Minor cleanups in clang-format.el.Manuel Klimek2016-10-041-41/+48
| | | | | | | | | | | | | | | | | | - Enable lexical binding - Formatting - Enable file name completion for the clang-format-executable variable - Add a missing docstring - When available, use bufferpos-to-filepos and filepos-to-bufferpos. These functions given more precise mapping than byte-to-position and position-bytes. - Rename arguments of clang-format-region to match the docstring - Instead of binding local variables to nil and then assigning them, bind them directly to their values - Make use of the fact that insert-file-contents returns the number of characters it inserted - Use cl-destructuring-bind to make the code a bit shorter - Use standard iteration (dolist) instead of mapc with a lambda, which is more common and shorter - Remove a message that was most likely only present for debugging purposes Patch by Philipp Stephani. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283206 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Add an option to git-clang-format to diff between to commitsStephen Hines2016-09-221-50/+97
| | | | | | | | | | | | | | | | | | | | | Summary: When building pre-upload hooks using git-clang-format, it is useful to limit the scope to a diff of two commits (instead of from a commit against the working tree) to allow for less false positives in dependent commits. This change adds the option of specifying two git commits to git-clang-format when using the `--diff` flag, which uses a different strategy to diff (using `git-diff-tree` instead of `git-diff-index`), and runs clang-format against the second commit instead of the working directory. There is a slight backwards-incompatibility introduced with this change: if a filename matches a branch name or other commit-ish, then `git clang-format <commit> <file>` will no longer work as expected; use `git clang-format <commit> -- <file>` instead. Patch by Luis Hector Chavez! Reviewers: djasper, lodato Subscribers: lodato, cfe-commits, srhines Projects: #clang-c Differential Revision: https://reviews.llvm.org/D24319 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@282136 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Add Java detection to git-clang-format.Stephen Hines2016-09-131-0/+1
| | | | | | | | | | | | | | Summary: This change adds "java" to the list of known extensions that clang-format supports. Patch by Luis Hector Chavez Reviewers: djasper Subscribers: srhines, cfe-commits Differential Revision: https://reviews.llvm.org/D24401 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281294 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Make emacs integration work with narrowed buffers.Daniel Jasper2016-09-121-1/+1
| | | | | | | | | Use (call-process region nil ...) instead of (point-min) so that the call works in narrowed buffers. Patch by Philipp Stephani, thank you! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281203 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format-vim] Support vim linked against py3Luke Drummond2016-08-311-7/+11
| | | | | | | | | | | | | | clang-format.py previously only worked in vim compiled against python2. This patch adds the necessary syntax changes to make this work with vim linked against python3, which is now shipped by default for at least Ubuntu16 and Arch. Differential Revision: https://reviews.llvm.org/D23319 Subscribers: cfe-commits git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@280240 91177308-0d34-0410-b5e6-96231b3b80d8
* Make clang-format remove duplicate headers when sorting #includes.Eric Liu2016-08-101-3/+2
| | | | | | | | | | | | Summary: When sorting #includes, #include directives that have the same text will be deduplicated when sorting #includes, and only the first #include in the duplicate #includes remains. If the `Cursor` is provided and put on a deleted #include, it will be put on the remaining #include in the duplicate #includes. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D23274 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278206 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement tooling::Replacements as a class.Eric Liu2016-08-011-4/+4
| | | | | | | | | | | | | | | | | | | Summary: - Implement clang::tooling::Replacements as a class to provide interfaces to control how replacements for a single file are combined and provide guarantee on the order of replacements being applied. - tooling::Replacements only contains replacements for the same file now. Use std::map<std::string, tooling::Replacements> to represent multi-file replacements. - Error handling for the interface change will be improved in followup patches. Reviewers: djasper, klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D21748 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277335 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC] Header cleanupMehdi Amini2016-07-181-2/+0
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275882 91177308-0d34-0410-b5e6-96231b3b80d8
* Make tooling::applyAllReplacements return llvm::Expected<string> instead of ↵Eric Liu2016-07-111-3/+6
| | | | | | | | | | | | | | | | empty string to indicate potential error. Summary: return llvm::Expected<> to carry error status and error information. This is the first step towards introducing "Error" into tooling::Replacements. Reviewers: djasper, klimek Subscribers: ioeric, klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D21601 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275062 91177308-0d34-0410-b5e6-96231b3b80d8
* Update to match LLVM r272232.Richard Smith2016-06-091-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272233 91177308-0d34-0410-b5e6-96231b3b80d8
* [CMake] Add install-clang-format target by migrating to add_clang_toolChris Bieneman2016-02-231-8/+19
| | | | | | This change migrates clang-format to add_clang_tool which makes a component-based install target. To support component-based installation the extra installed scripts all need to have the "clang-format" component too. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261680 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove autoconf supportChris Bieneman2016-01-261-22/+0
| | | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "This is the way [autoconf] ends Not with a bang but a whimper." -T.S. Eliot Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D16472 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258862 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format-diff: Replace hard-code default for clang-format binary with flag.Daniel Jasper2016-01-201-9/+6
| | | | | | Patch by Kwasi Mensah, thank you. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258328 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Make moving of the Cursor work properly when sorting #includes.Daniel Jasper2015-11-231-34/+33
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253860 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Enable #include sorting by default.Daniel Jasper2015-11-164-17/+15
| | | | | | | | | This has seen quite some usage and I am not aware of any issues. Also add a style option to enable/disable include sorting. The existing command line flag can from now on be used to override whatever is set in the style. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253202 91177308-0d34-0410-b5e6-96231b3b80d8
* Update list of languages advertised in OVERVIEW: A tool to format ↵Nico Weber2015-10-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C/C++/Java/JavaScript/Objective-C/Protobuf code. If no arguments are specified, it formats the code from standard input and writes the result to the standard output. If <file>s are given, it reformats the files. If -i is specified together with <file>s, the files are edited in-place. Otherwise, the result is written to the standard output. USAGE: clang-format [options] [<file> ...] OPTIONS: -assume-filename=<string> - When reading from stdin, clang-format assumes this filename to look for a style config file (with -style=file) and to determine the language. -cursor=<uint> - The position of the cursor when invoking clang-format from an editor integration -dump-config - Dump configuration options to stdout and exit. Can be used with -style option. -fallback-style=<string> - The name of the predefined style used as a fallback in case clang-format is invoked with -style=file, but can not find the .clang-format file to use. Use -fallback-style=none to skip formatting. -help - Display available options (-help-hidden for more) -i - Inplace edit <file>s, if specified. -length=<uint> - Format a range of this length (in bytes). Multiple ranges can be formatted by specifying several -offset and -length pairs. When only a single -offset is specified without -length, clang-format will format up to the end of the file. Can only be used with one input file. -lines=<string> - <start line>:<end line> - format a range of lines (both 1-based). Multiple ranges can be formatted by specifying several -lines arguments. Can't be used with -offset and -length. Can only be used with one input file. -offset=<uint> - Format a range starting at this byte offset. Multiple ranges can be formatted by specifying several -offset and -length pairs. Can only be used with one input file. -output-replacements-xml - Output replacements as XML. -sort-includes - Sort touched include lines -style=<string> - Coding style, currently supports: LLVM, Google, Chromium, Mozilla, WebKit. Use -style=file 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 -style="{key: value, ...}" to set specific parameters, e.g.: -style="{BasedOnStyle: llvm, IndentWidth: 8}" -version - Display the version of this program output. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250671 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Basic escaping when outputting XML.Daniel Jasper2015-10-151-1/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250440 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Add include sorting capabilities to sublime, emacs andDaniel Jasper2015-10-073-1/+6
| | | | | | clang-format-diff.py. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249567 91177308-0d34-0410-b5e6-96231b3b80d8
* [VFS] Transition clang-format to use an in-memory FS.Benjamin Kramer2015-10-061-9/+15
| | | | | | | | | | | Apart from being cleaner this also means that clang-format no longer has access to the host file system. This isn't necessary because clang-format never reads includes :) Includes minor tweaks and bugfixes found in the VFS implementation while running clang-format tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249385 91177308-0d34-0410-b5e6-96231b3b80d8
* [libFuzzer] make LLVMFuzzerTestOneInput (the fuzzer target function) return ↵Kostya Serebryany2015-10-021-1/+2
| | | | | | int instead of void. (following llvm r249214) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249215 91177308-0d34-0410-b5e6-96231b3b80d8