summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
Commit message (Collapse)AuthorAgeFilesLines
...
* clang-format: [js] Support template strings.Daniel Jasper2015-02-202-1/+66
| | | | | | | | | Merge template strings (marked by backticks ``). Do not format any contents of template strings. Patch by Martin Probst. Thank you. llvm-svn: 230011
* clang-format: [js] Support ES6 module exports.Daniel Jasper2015-02-193-7/+24
| | | | | | Patch by Martin Probst, thank you! llvm-svn: 229865
* clang-format: [js] Support ES6 module imports.Daniel Jasper2015-02-194-8/+31
| | | | | | Patch by Martin Probst. llvm-svn: 229863
* clang-format: [js] Do not fall through for JS structural elements.Daniel Jasper2015-02-191-1/+2
| | | | | | Patch by Martin Probst. Thank you. llvm-svn: 229862
* clang-format: Space and triple angle braces.Jacques Pienaar2015-02-182-35/+82
| | | | | | Committing patch http://reviews.llvm.org/D6800. llvm-svn: 229783
* clang-format: [JS] support AtScript style annotations for JS.Daniel Jasper2015-02-181-1/+7
| | | | | | | | Based on Java annotation support and style. Patch by Martin Probst. llvm-svn: 229703
* clang-format: [JS] Support classes.Daniel Jasper2015-02-182-4/+10
| | | | | | | | | | This adds support for JavaScript class definitions (again following TypeScript & AtScript style). This only required support for visibility modifiers in JS, everything else was already working. Patch by Martin Probst, thank you. llvm-svn: 229701
* clang-format: [JS] Support type annotations.Daniel Jasper2015-02-182-7/+16
| | | | | | | | | | This patch adds support for type annotations that follow TypeScript's, Flow's, and AtScript's syntax style. Patch by Martin Probst, thank you. Review: http://reviews.llvm.org/D7721 llvm-svn: 229700
* clang-format: Don't force a break after "endl" if everything fits on one line.Daniel Jasper2015-02-172-3/+4
| | | | llvm-svn: 229486
* clang-format: Fix crasher.Daniel Jasper2015-02-171-1/+1
| | | | llvm-svn: 229485
* Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for ↵Aaron Ballman2015-02-152-4/+4
| | | | | | requiring the macro. NFC; Clang edition. llvm-svn: 229339
* Format: Make FormatToken's isOneOf a variadic templateBenjamin Kramer2015-02-151-20/+3
| | | | llvm-svn: 229326
* clang-format: Correctly mark preprocessor lines in child blocks.Daniel Jasper2015-02-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | This prevents contracting: auto lambda = []() { int a = 2 #if A + 2 #endif ; }; into: auto lambda = []() { int a = 2 #if A + 2 #endif ; }; Which is obviously BAD. This fixes llvm.org/PR22496. llvm-svn: 228522
* clang-format: Format Objective-C try blocks like all the other try blocks.Nico Weber2015-02-072-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: @try { // ... } @finally { // ... } Now: @try { // ... } @finally { // ... } This is consistent with how we format C++ try blocks and SEH try blocks. clang-format not doing this before was an implementation oversight. This is dependent on BraceBreakingStyle. The snippet above is with the Attach style. Style Stroustrip for example still results in the "Before:" snippet, which makes sense since other blocks (try, else) break after '}' too. llvm-svn: 228483
* clang-format: Fix assert triggering on carriage returns.Daniel Jasper2015-02-051-0/+3
| | | | llvm-svn: 228288
* clang-format: Add support for SEH __try / __except / __finally blocks.Nico Weber2015-02-046-12/+30
| | | | | | | | | | | | | | | | | | | | | | | | This lets clang-format format __try { } __except(0) { } and __try { } __finally { } correctly. __try and __finally are keywords if `LangOpts.MicrosoftExt` is set, so this turns this on. This also enables a few other keywords, but it shouldn't overly perturb regular clang-format operation. __except is a context-sensitive keyword, so `AdditionalKeywords` needs to be passed around to a few more places. Fixes PR22321. llvm-svn: 228148
* clang-format: Fix incorrect handling of leading whitespace.Daniel Jasper2015-01-311-6/+12
| | | | | | | Added an assertion that triggered in an existing test case (without observable differences) and fixed the code. llvm-svn: 227677
* clang-format: FIXME that led to access of uninitialized memory.Daniel Jasper2015-01-291-1/+2
| | | | | | | | | | I have so far not succeeded in finding a nicely reduced test case or an observable difference which could help me create a test failure without msan. Committing without test to unblock kcc's further fuzzing progress. llvm-svn: 227433
* clang-format: Fix crasher caused by not properly setting dry-run.Daniel Jasper2015-01-292-2/+7
| | | | llvm-svn: 227427
* clang-format: Fix another crasher caused by incomplete macro code.Daniel Jasper2015-01-231-5/+11
| | | | | | | | We did't properly mark all of an AnnotatedLine's children as finalized and thus would reformat the same tokens in different branches of #if/#else sequences leading to invalid replacements. llvm-svn: 226930
* clang-format: Fix incorrect classification of "*".Daniel Jasper2015-01-231-13/+14
| | | | | | | | | | Before: *a = b *c; After: *a = b * c; llvm-svn: 226923
* clang-format: Fix crasher when splitting incomplete escape sequences.Daniel Jasper2015-01-211-1/+1
| | | | llvm-svn: 226698
* clang-format: Fix crasher caused by incorrect resetting of token info.Daniel Jasper2015-01-211-0/+1
| | | | llvm-svn: 226685
* clang-format: Fix bad memory access.Daniel Jasper2015-01-211-0/+1
| | | | llvm-svn: 226680
* clang-format: Fix use-heap-after-free bug.Daniel Jasper2015-01-211-5/+7
| | | | | | Discovered by the awesome test case and ASAN. llvm-svn: 226678
* clang-format: Fix AlwaysBreakBeforeMultilineStrings with ColumnLimit=0Daniel Jasper2015-01-201-2/+3
| | | | | | | | | | | | | | Before: const char *x = "hello llvm"; After: const char *x = "hello llvm"; This fixes llvm.org/PR22245. Patch by Bill Meltsner, thank you! llvm-svn: 226564
* clang-format: Fix crasher on weird comments.Daniel Jasper2015-01-191-4/+2
| | | | | | | | Crashing input: /\ / comment llvm-svn: 226454
* clang-format: Fix crasher on incomplete condition compilation.Daniel Jasper2015-01-191-1/+1
| | | | | | | | | | | Previously crashing input: void f( #if A ); #else #endif llvm-svn: 226451
* clang-format: Fix crash on invalid code.Daniel Jasper2015-01-191-1/+2
| | | | | | Input "a<," made clang-format crash. llvm-svn: 226450
* clang-format: Fix clang-format crash on invalid code.Daniel Jasper2015-01-191-1/+1
| | | | llvm-svn: 226449
* clang-format: Fix assertion when trying to build a nullptr StringRef.Daniel Jasper2015-01-191-0/+1
| | | | llvm-svn: 226448
* clang-format: Fix endless loop on incomplete try-catch-block.Daniel Jasper2015-01-191-1/+1
| | | | llvm-svn: 226447
* clang-format: Remove assert that isn't helpful.Daniel Jasper2015-01-191-1/+0
| | | | | | | This assert would trigger on: #d , = } llvm-svn: 226446
* clang-format: Disable flag for Google's Java and Javascript styles.Daniel Jasper2015-01-141-0/+2
| | | | | | | Disable AlwaysBreakBeforeMultilineString, as the style guides don't really say to do so. llvm-svn: 225982
* clang-format: [Java] Support try blocks with resources.Daniel Jasper2015-01-142-1/+6
| | | | | | | | | | | | | | | Before: try (SomeResource rs = someFunction()) { Something(); } After: try (SomeResource rs = someFunction()) { Something(); } llvm-svn: 225973
* clang-format: [Java] Prefer not to break in parameter annotations.Daniel Jasper2015-01-141-0/+2
| | | | | | | | | | | | | | Before: boolean someFunction(@Param(aaaaaaaaaaaaaaaa) String aaaaa, String bbbbbbbbbbbbbbb) {} After: boolean someFunction( @Param(aaaaaaaaaaaaaaaa) String aaaaa, String bbbbbbbbbbbbbbb) {} llvm-svn: 225971
* clang-format: [Java] Understand "import static".Daniel Jasper2015-01-141-1/+2
| | | | llvm-svn: 225965
* clang-format: [Java] Don't let annotations confuse return type analysis.Daniel Jasper2015-01-141-0/+3
| | | | | | | | | | | | | | Before: @Test ReturnType doSomething(String aaaaaaaaaaaaa, String bbbbbbbbbbbbbbb) {} After: @Test ReturnType doSomething( String aaaaaaaaaaaaa, String bbbbbbbbbbbbbbb) {} llvm-svn: 225964
* clang-format: [Java] Don't line-wrap before annotations' l_parens.Daniel Jasper2015-01-141-1/+1
| | | | | | | | | | | | | | Before: @SomeAnnotation (aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa) int i; After: @SomeAnnotation( aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa) int i; llvm-svn: 225963
* clang-format: [Java] Don't get confused by leading annotations.Daniel Jasper2015-01-141-1/+2
| | | | | | | | | | | | | | Before: @Test(a) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaa); After: @Test(a) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaa); llvm-svn: 225962
* clang-format: [Java] Detect `native` keyword.Nico Weber2015-01-132-1/+4
| | | | | | | | | | Before: public native<X> Foo foo(); After: public native <X> Foo foo(); llvm-svn: 225839
* Fix assertion in BreakableBlockComment (http://llvm.org/PR21916).Alexander Kornienko2015-01-122-1/+7
| | | | | | | | | | | | Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6894 llvm-svn: 225628
* clang-format: Improve format of lambdas in ctor initializers.Daniel Jasper2015-01-121-0/+1
| | | | | | | | | | | | | | | | Before: Constructor() : Constructor([] { // comment int i; }) {} After: Constructor() : Constructor([] { // comment int i; }) {} llvm-svn: 225625
* clang-format: Fix formatting of inline asm.Daniel Jasper2015-01-121-2/+2
| | | | | | | | | Specifically, adjust the leading "__asm {" and trailing "}" while still leaving the assembly inside it alone. This fixes llvm.org/PR22190. llvm-svn: 225623
* clang-format: [Java] Support formatting qualified annotations.Nico Weber2015-01-092-23/+35
| | | | llvm-svn: 225559
* clang-format: Force line break between "endl" and "<<".Daniel Jasper2015-01-081-28/+26
| | | | | | | | | | | | | | | | This makes piped output easier to read in many instances. Before: llvm::errs() << aaaa << std::endl << bbbb << std::endl; After: llvm::errs() << aaaa << std::endl << bbbb << std::endl; Also fix a few instance of "don't use else after return" as per the coding standards. llvm-svn: 225444
* clang-format: Improve template parameter detection.Daniel Jasper2015-01-081-2/+5
| | | | | | | | | | Before: struct A < std::enable_if<sizeof(T2) <sizeof(int32)>::type>; After: struct A<std::enable_if<sizeof(T2) < sizeof(int32)>::type>; llvm-svn: 225435
* clang-format: Let Chromium use the Google default for AlignTrailingComments.Nico Weber2015-01-071-1/+0
| | | | | | | | | | | r225141 changed the defaults of AllowShortIfStatementsOnASingleLine and AlignTrailingComments for Google style and added explicit overrides for Chromium style to undo these changes. For AllowShortIfStatementsOnASingleLine that's good as the Android style guide (which Chromium uses for Java) explicitly permits single-line ifs. But it's silent on trailing comments, to it makes sense for Chromium style to just follow Google style. llvm-svn: 225363
* clang-format: Understand single-line comments at the end of blocks.Daniel Jasper2015-01-071-4/+6
| | | | | | | | | | | This prevents clang-format from moving/aligning the comment in the snippet: void f() { int i; // some comment // some unrelated comment } llvm-svn: 225352
* clang-format: Fix unary operator detection.Daniel Jasper2015-01-071-4/+4
| | | | | | | | | | Before: ** outparam = 1; After: **outparam = 1; llvm-svn: 225349
OpenPOWER on IntegriCloud