summaryrefslogtreecommitdiffstats
path: root/clang/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* [AST] Add TableGen for StmtDataCollectorsJohannes Altmanninger2017-09-061-1/+1
| | | | | | | | | | | | | | Summary: This adds an option "-gen-clang-data-collectors" to the Clang TableGen that is used to generate StmtDataCollectors.inc. Reviewers: arphaman, teemperor! Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D37383 llvm-svn: 312634
* [AST] Traverse CXXOperatorCallExpr in LexicallyOrderedRecursiveASTVisitorJohannes Altmanninger2017-09-061-8/+72
| | | | | | | | | | | | | | | | Summary: This affects overloaded operators, which are represented by a CXXOperatorCallExpr whose first child is always a DeclRefExpr referring to the operator. For infix, postfix and call operators we want the first argument to be traversed before the operator. Reviewers: arphaman Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D37200 llvm-svn: 312633
* [AST] Traverse templates in LexicallyOrderedRecursiveASTVisitorJohannes Altmanninger2017-09-061-4/+26
| | | | | | | | | | | | | | | | | Summary: We need to specialize this because RecursiveASTVisitor visits template template parameters after the templated declaration, unlike the order in which they appear in the source code. Reviewers: arphaman Reviewed By: arphaman Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D36998 llvm-svn: 312631
* clang-format: Fix indentation of macros in include guards (after r312125).Daniel Jasper2017-09-041-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | Before: #ifndef A_H #define A_H #define A() \ int i; \ int j; #endif // A_H After: #ifndef A_H #define A_H #define A() \ int i; \ int j; #endif // A_H llvm-svn: 312484
* clang-format: Fix formatting of for loops with multiple increments.Daniel Jasper2017-09-031-0/+4
| | | | | | This fixes llvm.org/PR34366. llvm-svn: 312437
* [refactor] Use a RefactoringResultConsumer instead of tagged refactoringAlex Lorenz2017-09-011-16/+29
| | | | | | | | | | | | | rule classes This commit changes the way that the refactoring results are produced. Instead of using different `RefactoringActionRule` subclasses for each result type, Clang now use a single `RefactoringResultConsumer`. This was suggested by Manuel in https://reviews.llvm.org/D36075. Differential Revision: https://reviews.llvm.org/D37291 llvm-svn: 312316
* Disable clang-format's MemoizationTest as it becomes prohibitive with ↵David Blaikie2017-08-311-0/+5
| | | | | | | | | | | | | | | | EXPENSIVE_CHECKS EXPENSIVE_CHECKS enables libstdc++'s library consistency checks, which includes checking the container passed to std::priority_queue for its well-formedness. This makes the clang-format memoization too expensive, so disable it. (it's a necessary feature of libstdc++'s consistency checks that it ruins the required scalability of C++ standard library features - so these workarounds are to be expected if a test ever tries to test scalability in some way, like this test does) llvm-svn: 312268
* [analyzer] Performance optimizations for the CloneCheckerRaphael Isemann2017-08-311-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch aims at optimizing the CloneChecker for larger programs. Before this patch we took around 102 seconds to analyze sqlite3 with a complexity value of 50. After this patch we now take 2.1 seconds to analyze sqlite3. The biggest performance optimization is that we now put the constraint for group size before the constraint for the complexity. The group size constraint is much faster in comparison to the complexity constraint as it only does a simple integer comparison. The complexity constraint on the other hand actually traverses each Stmt and even checks the macro stack, so it is obviously not able to handle larger amounts of incoming clones. The new order filters out all the single-clone groups that the type II constraint generates in a faster way before passing the fewer remaining clones to the complexity constraint. This reduced runtime by around 95%. The other change is that we also delay the verification part of the type II clones back in the chain of constraints. This required to split up the constraint into two parts - a verification and a hash constraint (which is also making it more similar to the original design of the clone detection algorithm). The reasoning for this is the same as before: The verification constraint has to traverse many statements and shouldn't be at the start of the constraint chain. However, as the type II hashing has to be the first step in our algorithm, we have no other choice but split this constrain into two different ones. Now our group size and complexity constrains filter out a chunk of the clones before they reach the slow verification step, which reduces the runtime by around 8%. I also kept the full type II constraint around - that now just calls it's two sub-constraints - in case someone doesn't care about the performance benefits of doing this. Reviewers: NoQ Reviewed By: NoQ Subscribers: klimek, v.g.vassilev, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D34182 llvm-svn: 312222
* Avoid 'size_t' typedef in the unittest ObjC codeAlex Lorenz2017-08-301-3/+3
| | | | | | | This should fix http://bb.pgr.jp/builders/test-clang-msc-x64-on-i686-linux-RA llvm-svn: 312133
* Recommit r312127: [refactor] AST selection tree should contain syntacticAlex Lorenz2017-08-302-1/+140
| | | | | | | | | | | | | | | | form of PseudoObjectExpr The new commit adjusts unittest test code compilation options so that the Objective-C code in the unittest can be parsed on non-macOS platforms. Original message: The AST selection finder now constructs a selection tree that contains only the syntactic form of PseudoObjectExpr. This form of selection tree is more meaningful when doing downstream analysis as we're interested in the syntactic features of the AST and the correct lexical parent relation. llvm-svn: 312132
* Revert r312127 as the ObjC unittest code fails to compile on LinuxAlex Lorenz2017-08-301-136/+0
| | | | llvm-svn: 312131
* [refactor] AST selection tree should contain syntactic formAlex Lorenz2017-08-301-0/+136
| | | | | | | | | | | of PseudoObjectExpr The AST selection finder now constructs a selection tree that contains only the syntactic form of PseudoObjectExpr. This form of selection tree is more meaningful when doing downstream analysis as we're interested in the syntactic features of the AST and the correct lexical parent relation. llvm-svn: 312127
* clang-format: Add preprocessor directive indentationKrasimir Georgiev2017-08-302-3/+179
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is an implementation for [bug 17362](https://bugs.llvm.org/attachment.cgi?bugid=17362) which adds support for indenting preprocessor statements inside if/ifdef/endif. This takes previous work from fmauch (https://github.com/fmauch/clang/tree/preprocessor_indent) and makes it into a full feature. The context of this patch is that I'm a VMware intern, and I implemented this because VMware needs the feature. As such, some decisions were made based on what VMware wants, and I would appreciate suggestions on expanding this if necessary to use-cases other people may want. This adds a new enum config option, `IndentPPDirectives`. Values are: * `PPDIS_None` (in config: `None`): ``` #if FOO #if BAR #include <foo> #endif #endif ``` * `PPDIS_AfterHash` (in config: `AfterHash`): ``` #if FOO # if BAR # include <foo> # endif #endif ``` This is meant to work whether spaces or tabs are used for indentation. Preprocessor indentation is independent of indentation for non-preprocessor lines. Preprocessor indentation also attempts to ignore include guards with the checks: 1. Include guards cover the entire file 2. Include guards don't have `#else` 3. Include guards begin with ``` #ifndef <var> #define <var> ``` This patch allows `UnwrappedLineParser::PPBranchLevel` to be decremented to -1 (the initial value is -1) so the variable can be used for indent tracking. Defects: * This patch does not handle the case where there's code between the `#ifndef` and `#define` but all other conditions hold. This is because when the #define line is parsed, `UnwrappedLineParser::Lines` doesn't hold the previous code line yet, so we can't detect it. This is out of the scope of this patch. * This patch does not handle cases where legitimate lines may be outside an include guard. Examples are `#pragma once` and `#pragma GCC diagnostic`, or anything else that does not change the meaning of the file if it's included multiple times. * This does not detect when there is a single non-preprocessor line in front of an include-guard-like structure where other conditions hold because `ScopedLineState` hides the line. * Preprocessor indentation throws off `TokenAnnotator::setCommentLineLevels` so the indentation of comments immediately before indented preprocessor lines is toggled on each run. Fixing this issue appears to be a major change and too much complexity for this patch. Contributed by @euhlmann! Reviewers: djasper, klimek, krasimir Reviewed By: djasper, krasimir Subscribers: krasimir, mzeren-vmw, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D35955 llvm-svn: 312125
* [refactor] Examine the whole range for ObjC @implementation declsAlex Lorenz2017-08-301-0/+19
| | | | | | when computing the AST selection llvm-svn: 312121
* [clang-format] Do not format likely xmlKrasimir Georgiev2017-08-292-0/+18
| | | | | | | | | | | | | | | | | Summary: This patch detects the leading '<' in likely xml files and stops formatting in that case. A recent use of a Qt xml file with a .ts extension triggered this: http://doc.qt.io/qt-4.8/linguist-ts-file-format.html Reviewers: djasper Reviewed By: djasper Subscribers: sammccall, cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D37136 llvm-svn: 311999
* [clang-format] Fixed typedef enum brace wrappingKrasimir Georgiev2017-08-291-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Bug: https://bugs.llvm.org/show_bug.cgi?id=34016 - **Typedef enum part** **Problem:** Clang format does not allow the flag **BraceWrapping.AfterEnum** control the case when our **enum** is preceded by **typedef** keyword (what is common in C language). **Patch description:** Added case to the **"AfterEnum"** flag when our enum does not start a line - is preceded by **typedef** keyword. **After fix:** **CONFIG:** ``` BreakBeforeBraces: Custom BraceWrapping: { AfterClass: true, AfterControlStatement: true, AfterEnum: true, AfterFunction: true, AfterNamespace: false, AfterStruct: true, AfterUnion: true, BeforeCatch: true, BeforeElse: true } ``` **BEFORE:** ``` typedef enum { a, b, c } SomeEnum; ``` **AFTER:** ``` typedef enum { a, b, c } SomeEnum; ``` Contributed by @PriMee! Reviewers: krasimir, djasper Reviewed By: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D37143 llvm-svn: 311998
* clang-format: [JS] simplify template string wrapping.Martin Probst2017-08-291-16/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, clang-format would try to wrap template string substitutions by indenting relative to the openening `${`. This helped with indenting structured strings, such as strings containing HTML, as the substitutions would be aligned according to the structure of the string. However it turns out that the overwhelming majority of template string + substitution usages are for substitutions into non-structured strings, e.g. URLs or just plain messages. For these situations, clang-format would often produce very ugly indents, in particular for strings containing no line breaks: return `<a href='http://google3/${file}?l=${row}'>${file}</a>(${ row },${ col }): `; This change makes clang-format indent template string substitutions as if they were string concatenation operations. It wraps +4 on overlong lines and keeps all operands on the same line: return `<a href='http://google3/${file}?l=${row}'>${file}</a>(${ row},${col}): `; While this breaks some lexical continuity between the `${` and `row}` here, the overall effects are still a huge improvement, and users can still manually break the string using `+` if desired. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D37142 llvm-svn: 311988
* Use class to pass information about executable nameSerge Pavlov2017-08-292-0/+97
| | | | | | | | | | | | | Information about clang executable name components, such as target and driver mode, was passes in std::pair. With this change it is passed in a special structure. It improves readability and makes access to this information more convenient. NFC. Differential Revision: https://reviews.llvm.org/D36057 llvm-svn: 311981
* Avoid missing std error code in RefactoringActionRulesTest.cppAlex Lorenz2017-08-281-2/+2
| | | | | | | This should fix this bot: http://bb.pgr.jp/builders/i686-mingw32-RA-on-linux llvm-svn: 311886
* [refactor] initial support for refactoring action rulesAlex Lorenz2017-08-282-0/+166
| | | | | | | | | | | | | | | | | | This patch implements the initial support for refactoring action rules. The first rule that's supported is a "source change" rule that returns a set of atomic changes. This patch is based on the ideas presented in my RFC: http://lists.llvm.org/pipermail/cfe-dev/2017-July/054831.html The following pieces from the RFC are added by this patch: - `createRefactoringRule` (known as `apply` in the RFC) - `requiredSelection` refactoring action rule requirement. - `selection::SourceSelectionRange` selection constraint. Differential Revision: https://reviews.llvm.org/D36075 llvm-svn: 311884
* ClangCodeGenTests: Update libdeps.NAKAMURA Takumi2017-08-271-0/+1
| | | | llvm-svn: 311846
* Add forgotten file in r311844.Vassil Vassilev2017-08-271-0/+174
| | | | llvm-svn: 311845
* D34059: Get the file name for the symbol from the Module, not the SourceManager.Vassil Vassilev2017-08-271-0/+1
| | | | | | | | | This allows multi-module / incremental compilation environments to have unique initializer symbols. Patch by Axel Naumann with minor modifications by me! llvm-svn: 311844
* [Format] Invert nestingAndIndentLevel pair in WhitespaceManager used forDaniel Jasper2017-08-251-0/+10
| | | | | | | | | | | | | alignments Indent should be compared before nesting level to determine if a token is on the same scope as the one we align with. Because it was inverted, clang-format sometimes tried to align tokens with tokens from outer scopes, causing the assert(Shift >= 0) to fire. This fixes bug #33507. Patch by Beren Minor, thank you! llvm-svn: 311792
* [Frontend] Fix printing policy for AST context loaded from fileVedant Kumar2017-08-252-0/+88
| | | | | | | | | | | | | In ASTUnit::LoadFromASTFile, the context object is set up using default-constructed LangOptions (which only later get populated). As the language options are used in the constructor of PrintingPolicy, this needs to be updated explicitly after the language options are available. Patch by Johann Klähn! Differential Revision: https://reviews.llvm.org/D35271 llvm-svn: 311787
* [Basic] Add a DiagnosticError llvm::ErrorInfo subclassAlex Lorenz2017-08-251-0/+22
| | | | | | | | | Clang's DiagnosticError is an llvm::Error payload that stores a partial diagnostic and its location. I'll be using it in the refactoring engine. Differential Revision: https://reviews.llvm.org/D36969 llvm-svn: 311778
* [clang-format] Emit absolute splits before lines for comments, try 2Krasimir Georgiev2017-08-241-0/+18
| | | | | | | | | | | | | | | | Summary: This recommits https://reviews.llvm.org/D36956 with an update to the added test case to not use raw string literals, since this makes gcc unhappy. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D37109 llvm-svn: 311672
* Fix use-after-free in Clang's ASTSelection unittestAlex Lorenz2017-08-241-258/+271
| | | | llvm-svn: 311664
* [refactor] Add the AST source selection componentAlex Lorenz2017-08-243-0/+627
| | | | | | | | | | | | | This commit adds the base AST source selection component to the refactoring library. AST selection is represented using a tree of SelectedASTNode values. Each selected node gets its own selection kind, which can actually be None even in the middle of tree (e.g. statement in a macro whose child is in a macro argument). The initial version constructs a "raw" selection tree, without applying filters and canonicalisation operations to the nodes. Differential Revision: https://reviews.llvm.org/D35012 llvm-svn: 311655
* Revert "[clang-format] Break non-trailing block comments"Krasimir Georgiev2017-08-241-16/+0
| | | | | | | | This reverts commit r311457. It reveals some dormant bugs in comment reflowing, like breaking a single line jsdoc type annotation before a parameter into multiple lines. llvm-svn: 311641
* [analyzer] Make StmtDataCollector customizableJohannes Altmanninger2017-08-232-0/+174
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This moves the data collection macro calls for Stmt nodes to lib/AST/StmtDataCollectors.inc Users can subclass ConstStmtVisitor and include StmtDataCollectors.inc to define visitor methods for each Stmt subclass. This makes it also possible to customize the visit methods as exemplified in lib/Analysis/CloneDetection.cpp. Move helper methods for data collection to a new module, AST/DataCollection. Add data collection for DeclRefExpr, MemberExpr and some literals. Reviewers: arphaman, teemperor! Subscribers: mgorny, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D36664 llvm-svn: 311569
* Revert "[clang-format] Emit absolute splits before lines for comments"Krasimir Georgiev2017-08-231-17/+0
| | | | | | | | This reverts commit r311559, which added a test containing raw string literals in macros, which chokes gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55971 llvm-svn: 311566
* [clang-format] Emit absolute splits before lines for commentsKrasimir Georgiev2017-08-231-0/+17
| | | | | | | | | | | | | | | | | | | Summary: This patch makes the splits emitted for the beginning of comment lines during reformatting absolute. Previously, they were relative to the start of the non-whitespace content of the line, which messes up further TailOffset calculations in breakProtrudingToken. This fixes an assertion failure reported in bug 34236: https://bugs.llvm.org/show_bug.cgi?id=34236. Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D36956 llvm-svn: 311559
* [clang-format] Align trailing comments if ColumnLimit is 0Krasimir Georgiev2017-08-231-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: ColumnLimit = 0 means no limit, so comment should always be aligned if requested. This was broken with https://llvm.org/svn/llvm-project/cfe/trunk@304687 introduced via https://reviews.llvm.org/D33830 and is included in 5.0.0-rc2. This commit fixes it and adds a unittest for this property. Should go into clang-5.0 IMHO. Contributed by @pboettch! Reviewers: djasper, krasimir Reviewed By: djasper, krasimir Subscribers: hans, klimek Differential Revision: https://reviews.llvm.org/D36967 llvm-svn: 311532
* [clang-format] Break non-trailing block commentsKrasimir Georgiev2017-08-221-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch is an alternative to https://reviews.llvm.org/D36614, by resolving a non-idempotency issue by breaking non-trailing comments: Consider formatting the following code with column limit at `V`: ``` V const /* comment comment */ A = B; ``` The comment is not a trailing comment, breaking before it doesn't bring it under the column limit. The formatter breaks after it, resulting in: ``` V const /* comment comment */ A = B; ``` For a next reformat, the formatter considers the comment as a trailing comment, so it is free to break it further, resulting in: ``` V const /* comment comment */ A = B; ``` This patch improves the situation by directly producing the third case. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D37007 llvm-svn: 311457
* PR19668, PR23034: Fix handling of move constructors and deleted copyRichard Smith2017-08-161-20/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | constructors when deciding whether classes should be passed indirectly. This fixes ABI differences between Clang and GCC: * Previously, Clang ignored the move constructor when making this determination. It now takes the move constructor into account, per https://github.com/itanium-cxx-abi/cxx-abi/pull/17 (this change may seem recent, but the ABI change was agreed on the Itanium C++ ABI list a long time ago). * Previously, Clang's behavior when the copy constructor was deleted was unstable -- depending on whether the lazy declaration of the copy constructor had been triggered, you might get different behavior. We now eagerly declare the copy constructor whenever its deletedness is unclear, and ignore deleted copy/move constructors when looking for a trivial such constructor. This also fixes an ABI difference between Clang and MSVC: * If the copy constructor would be implicitly deleted (but has not been lazily declared yet), for instance because the class has an rvalue reference member, we would pass it directly. We now pass such a class indirectly, matching MSVC. Based on a patch by Vassil Vassilev, which was based on a patch by Bernd Schmidt, which was based on a patch by Reid Kleckner! This is a re-commit of r310401, which was reverted in r310464 due to ARM failures (which should now be fixed). llvm-svn: 310983
* clang-format: [JS] wrap optional properties in type aliases.Martin Probst2017-08-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: clang-format wraps object literal keys in an object literal if they are marked as `TT_SelectorName`s and/or the colon is marked as `TT_DictLiteral`. Previously, clang-format would accidentally work because colons in type aliases were marked as `TT_DictLiteral`. r310367 fixed this to assing `TT_JsTypeColon`, which broke wrapping in certain situations. However the root cause was that clang-format incorrectly didn't skip questionmarks when detecting selector name. This change fixes both locations to (1) assign `TT_SelectorName` and (2) treat `TT_JsTypeColon` like `TT_DictLiteral`. Previously: type X = { a: string, b?: string, }; Now: type X = { a: string, b?: string, }; Reviewers: djasper, sammccall Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D36684 llvm-svn: 310852
* clang-format: [JS] do not insert whitespace in call positions.Martin Probst2017-08-141-7/+13
| | | | | | | | | | | | | | | | | | | | Summary: In JavaScript, may keywords can be used in method names and thus call sites: foo.delete(); foo.instanceof(); clang-format would previously insert whitespace after the `instanceof`. This change generically skips inserting whitespace between a keyword and a parenthesis if preceded by a dot, i.e. in a callsite. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D36142 llvm-svn: 310851
* clang-format: Fix left pointer alignment after delctype/typeofKrasimir Georgiev2017-08-141-3/+4
| | | | | | | | | | | | | Change 272124* introduced a regression in spaceRequiredBetween for left aligned pointers to decltype and typeof expressions. This fix adds logic to fix this. The test added is based on a related test in determineStarAmpUsage. Also add test cases for the regression. http://llvm.org/viewvc/llvm-project?view=revision&revision=272124 LLVM bug tracker: https://bugs.llvm.org/show_bug.cgi?id=30407 Differential revision: https://reviews.llvm.org/D35847 Fix contributed by euhlmann! llvm-svn: 310831
* [Lexer] Finding beginning of token with escaped new lineAlexander Kornienko2017-08-101-0/+53
| | | | | | | | | | | | | | | | | | | | Summary: Lexer::GetBeginningOfToken produced invalid location when backtracking across escaped new lines. This fixes PR26228 Reviewers: akyrtzi, alexfh, rsmith, doug.gregor Reviewed By: alexfh Subscribers: alexfh, cfe-commits Patch by Paweł Żukowski! Differential Revision: https://reviews.llvm.org/D30748 llvm-svn: 310576
* [clang-format] let PointerAlignment dictate spacing of function ref qualifiersJacob Bandes-Storch2017-08-101-2/+4
| | | | | | | | | | | | | | Summary: The original changes for ref qualifiers in rL272537 and rL272548 allowed function const+ref qualifier spacing to diverge from the spacing used for variables. It seems more consistent for `T const& x;` to match `void foo() const&;`. Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D34324 llvm-svn: 310544
* clang-format: Fix bug with ENAS_DontAlign and empty linesJacob Bandes-Storch2017-08-101-0/+24
| | | | | | | | This fixes a bug in `ENAS_DontAlign` (introduced in D32733) where blank lines had an EscapedNewlineColumn of 0, causing a subtraction to overflow when converted back to unsigned and leading to runaway memory allocation. Differential Revision: https://reviews.llvm.org/D36019 llvm-svn: 310539
* clang-format: [JS] detect ASI after closing parens.Martin Probst2017-08-091-0/+4
| | | | | | | | | | | | Summary: A closing parenthesis followed by a declaration or statement should always terminate the current statement. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D36491 llvm-svn: 310482
* Revert "PR19668, PR23034: Fix handling of move constructors and deleted copy ↵Diana Picus2017-08-091-29/+20
| | | | | | | | | constructors when deciding whether classes should be passed indirectly." This reverts commit r310401 because it seems to have broken some ARM bot(s). llvm-svn: 310464
* [clang-format] Put '/**' and '*/' on own lines in jsdocs ending in comment ↵Krasimir Georgiev2017-08-091-0/+47
| | | | | | | | | | | | | | | | | | pragmas Summary: This handles a case where the trailing '*/' of a multiline jsdoc eding in a comment pragma wouldn't be put on a new line. Reviewers: mprobst Reviewed By: mprobst Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D36359 llvm-svn: 310458
* Revert "Lexer: always allow imaginary constants in GNU mode."Tim Northover2017-08-081-1/+1
| | | | | | | This reverts r310423. It was committed by mistake, I intended to commit the improved diagnostics for implicit conversions instead. llvm-svn: 310426
* Lexer: always allow imaginary constants in GNU mode.Tim Northover2017-08-081-1/+1
| | | | llvm-svn: 310423
* PR19668, PR23034: Fix handling of move constructors and deleted copyRichard Smith2017-08-081-20/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | constructors when deciding whether classes should be passed indirectly. This fixes ABI differences between Clang and GCC: * Previously, Clang ignored the move constructor when making this determination. It now takes the move constructor into account, per https://github.com/itanium-cxx-abi/cxx-abi/pull/17 (this change may seem recent, but the ABI change was agreed on the Itanium C++ ABI list a long time ago). * Previously, Clang's behavior when the copy constructor was deleted was unstable -- depending on whether the lazy declaration of the copy constructor had been triggered, you might get different behavior. We now eagerly declare the copy constructor whenever its deletedness is unclear, and ignore deleted copy/move constructors when looking for a trivial such constructor. This also fixes an ABI difference between Clang and MSVC: * If the copy constructor would be implicitly deleted (but has not been lazily declared yet), for instance because the class has an rvalue reference member, we would pass it directly. We now pass such a class indirectly, matching MSVC. llvm-svn: 310401
* clang-format: [JS] fix union type spacing in object & array types.Martin Probst2017-08-081-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, clang-format would insert whitespace in union types nested in object and array types, as it wouldn't recognize those as a type operator: const x: {foo: number | null}; const x: [number | null]; While this is correct for actual binary operators, clang-format should not insert whitespace into union and intersection types to mark those: const x: {foo: number|null}; const x: [number|null]; This change propagates that the context is not an expression by inspecting the preceding token and marking as non-expression if it was a type colon. Reviewers: djasper Subscribers: klimek Differential Revision: https://reviews.llvm.org/D36136 llvm-svn: 310367
* clang-format: [JS] handle single lines comments ending in `\\`.Martin Probst2017-08-081-0/+22
| | | | | | | | | | | | | | Summary: Previously, clang-format would consider the following code line to be part of the comment and incorrectly format the rest of the file. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D36159 llvm-svn: 310365
OpenPOWER on IntegriCloud