summaryrefslogtreecommitdiffstats
path: root/clang/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* [ASTMatcher] Add handling for DeducedType to HasDeclarationMatcherFlorian Gross2017-08-041-0/+4
| | | | | | | | | | | | | | | | | HasDeclarationMatcher did not handle DeducedType, it always returned false for deduced types. So with code like this: struct X{}; auto x = X{}; This did no longer match: varDecl(hasType(recordDecl(hasName("X")))) Because HasDeclarationMatcher didn't resolve the DeducedType of x. Differential Revision: https://reviews.llvm.org/D36308 llvm-svn: 310095
* clang-format: [JS] support fields with case/switch/default labels.Martin Probst2017-08-041-0/+6
| | | | | | | | | | | | | | | | | | | | | Summary: `case:` and `default:` would normally parse as labels for a `switch` block. However in TypeScript, they can be used in field declarations, e.g.: interface I { case: string; } This change special cases parsing them in declaration lines to avoid wrapping them. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D36148 llvm-svn: 310070
* [clang-format] Fix indent of 'key <...>' and 'key {...}' in text protosKrasimir Georgiev2017-08-032-0/+57
| | | | | | | | | | | | | | | | | Summary: This patch fixes the indentation of the code pattern `key <...>`and `key {...}` in text protos. Previously, such line would be alinged depending on the column of the previous colon, which usually indents too much. I'm gonna go ahead and commit this since it's a straightforward bugfix. Reviewers: djasper, klimek Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D36143 llvm-svn: 309941
* [clang-format] Fix parsing of <>-style proto optionsKrasimir Georgiev2017-08-031-0/+5
| | | | | | | | | | | | | | | | | Summary: This patch fixes the parsing of proto option fields like `option op = <...>`. Previously the parser did not enter the right code path inside the angle braces, causing the contents to be split into several unwrapped lines inside. I'll just go ahead and commit this since it's a straightforward bugfix. Reviewers: djasper, klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D36217 llvm-svn: 309937
* Unify and simplify the behavior of the hasDeclaration matcher.Manuel Klimek2017-08-022-31/+46
| | | | | | | | | | | | | | | | | | | | | | | | | Originally, we weren't able to match on Type nodes themselves (only QualType), so the hasDeclaration matcher was initially written to give what we thought are reasonable results for QualType matches. When we chagned the matchers to allow matching on Type nodes, it turned out that the hasDeclaration matcher was by chance written templated enough to now allow hasDeclaration to also match on (some) Type nodes. This patch change the hasDeclaration matcher to: a) work the same on Type and QualType nodes, b) be completely explicit about what nodes we can match instead of just allowing anything with a getDecl() to match, c) explicitly control desugaring only one level in very specific instances. d) adds hasSpecializedTemplate and tagType matchers to allow migrating existing use cases that now need more explicit matchers Note: This patch breaks clang-tools-extra. The corresponding patch there is approved and will land in a subsequent patch. Differential Revision: https://reviews.llvm.org/D27104 llvm-svn: 309809
* Use VFS operations in FileManager::makeAbsolutePath.Ilya Biryukov2017-08-021-0/+27
| | | | | | | | | | | | | | Summary: It used to call into llvm::sys::fs::make_absolute. Reviewers: akyrtzi, erikjv, bkramer, krasimir, klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D36155 llvm-svn: 309795
* clang-format: [JS] no whitespace between typeof operator and l_paren.Martin Probst2017-08-011-0/+1
| | | | llvm-svn: 309713
* clang-format: [JS] prefer wrapping chains over empty literals.Martin Probst2017-08-011-0/+9
| | | | | | | | | | | | | | | | | | | | | Summary: E.g. don't wrap like this: (foo.bar.baz).and.bam(Blah.of({ })) But rather: (foo.bar.baz) .and.bam(Blah.of({})) Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D36139 llvm-svn: 309712
* clang-format: [JS] whitespace between keywords and parenthesized expressions.Martin Probst2017-08-011-0/+9
| | | | | | | | | | | | Summary: `throw (...)` should have a whitespace following it, as do await and void. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D36146 llvm-svn: 309710
* clang-format: [JS] handle union types in arrow functions.Martin Probst2017-08-011-0/+3
| | | | | | | | | | | | Summary: clang-format would previously fail to detect that an arrow functions parameter block is not an expression, and thus insert whitespace around the `|` and `&` type operators in it. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D36147 llvm-svn: 309707
* clang-format: [JS] consistenly format enums.Martin Probst2017-08-011-0/+8
| | | | | | | | | | | | Summary: Previously, const enums would get formatted differently because the modifier was not recognized. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D36144 llvm-svn: 309703
* clang-format: [JS] support default imports.Martin Probst2017-08-011-0/+8
| | | | | | | | | | | | Summary: Formerly, `import {default as X} from y;` would not be recognized as an import. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D36132 llvm-svn: 309697
* clang-format: [JS] handle object types in extends positions.Martin Probst2017-08-011-0/+11
| | | | | | | | | | | | | | | | | Summary: clang-format would previously drop the whitespace after `extends` in code such as: class Foo extends {} {} Where the first set of curly braces is an inline object literal type. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D36131 llvm-svn: 309695
* [ASTMatchers] Allow forField to match indirect fields.Malcolm Parsons2017-08-011-2/+6
| | | | | | | | This is needed for PR32966. Reviewed by alexfh. llvm-svn: 309667
* Added `applyAtomicChanges` function.Eric Liu2017-07-311-0/+422
| | | | | | | | | | | | | | | | | | This re-commits r298913. o See thread http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20170327/189084.html o Tested with -DLLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY=0. Summary: ... which applies a set of `AtomicChange`s on code. Reviewers: klimek, djasper Reviewed By: djasper Subscribers: arphaman, mgorny, chapuni, cfe-commits Differential Revision: https://reviews.llvm.org/D30777 llvm-svn: 309548
* clang-format: merge short case labels with trailing commentsFrancois Ferrand2017-07-281-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Allow merging short case labels when they actually end with a comment (like a comment after the ``break``) and when followed by switch-level comments (e.g. aligned with next case): switch(a) { case 0: break; // comment at end of case case 1: return value; // comment related to next case // comment related to next case case 2: } Reviewers: krasimir, djasper Reviewed By: krasimir Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D35557 llvm-svn: 309370
* clang-format: fix block OpeningLineIndex around preprocessorFrancois Ferrand2017-07-281-0/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The current code would return an incorrect value when a preprocessor directive is present immediately after the opening brace: this causes the nanespace end comment fixer to break in some places, for exemple it would not add the comment in this case: namespace a { #define FOO } Fixing the computation is simple enough, but it was breaking a feature, as it would cause comments to be added also when the namespace declaration was dependant on conditional compilation. To fix this, a hash of the current preprocessor stack/branches is computed at the beginning of parseBlock(), so that we explicitely do not store the OpeningLineIndex when the beginning and end of the block are not in the same preprocessor conditions. Tthe hash is computed based on the line, but this could propbably be improved by using the actual condition, so that clang-format would be able to match multiple identical #ifdef blocks. Reviewers: krasimir, djasper Reviewed By: krasimir Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D35483 llvm-svn: 309369
* [clang-format] Fix comment levels between '} else {' and PPDirective.Krasimir Georgiev2017-07-241-1/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This fixes a regression exposed by r307795 and rL308725 in which the level of a comment line between '} else {' and a preprocessor directive is incorrectly set as the level of the '} else {' line. For example, this : ``` int f(int i) { if (i) { ++i; } else { // comment #ifdef A --i; #endif } } ``` was formatted as: ``` int f(int i) { if (i) { ++i; } else { // comment #ifdef A --i; #endif } } ``` Reviewers: djasper, klimek Reviewed By: klimek Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D35794 llvm-svn: 308882
* [clang-format] Fix comment levels between '}' and PPDirectiveKrasimir Georgiev2017-07-211-0/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This fixes a regression exposed by r307795 in which the level of a comment line between '}' and a preprocessor directive is incorrectly set as the level of the line before the '}'. In effect, this: ``` int f(int i) { int j = i; return i + j; } // comment #ifdef A #endif ``` was formatted as: ``` int f(int i) { int j = i; return i + j; } // comment #ifdef A #endif ``` Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D35485 llvm-svn: 308725
* [clang-format] Put '/**' and '*/' on own lines in multiline jsdocsKrasimir Georgiev2017-07-202-0/+102
| | | | | | | | | | | | Reviewers: mprobst Reviewed By: mprobst Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D35683 llvm-svn: 308684
* clang-format: [JS] Correctly format JavaScript imports with long module pathsMartin Probst2017-07-182-0/+28
| | | | | | | | | | | | | | | | | | | | | | | Currently the `UnwrappedLineParser` fails to correctly unwrap JavaScript imports where the module path is not on the same line as the `from` keyword. For example: import {A} from 'some/path/longer/than/column/limit/module.js';``` This causes issues when in the middle a list of imports because the formatter thinks it has reached the end of the imports, and therefore will not sort any imports lower in the list. The formatter will, however, split the `from` keyword and the module path if the path exceeds the column limit, which triggers the issue the next time the file is formatted. Patch originally by Jared Neil - thanks! Differential Revision: https://reviews.llvm.org/D34920 llvm-svn: 308306
* [NFC] Refactor the Preprocessor function that handles Macro definitions and ↵Faisal Vali2017-07-171-3/+3
| | | | | | | | | | | | | | | | | rename Arguments to Parameters in Macro Definitions. - Extracted the reading of the tokens out into a separate function. - Replace 'Argument' with 'Parameter' when referring to the identifiers of the macro definition (as opposed to the supplied arguments - MacroArgs - during the macro invocation). This is in preparation for submitting patches for review to implement __VA_OPT__ which will otherwise just keep lengthening the HandleDefineDirective function and making it less comprehensible. I will also directly update some extra clang tooling that is broken by the change from Argument to Parameter. Hopefully the bots will stay appeased. Thanks! llvm-svn: 308190
* Fix dereference of pointers in throw statements.Manuel Klimek2017-07-171-0/+1
| | | | | | | | | | | | Before: throw * x; After: throw *x; Patch by Erik Uhlmann. llvm-svn: 308185
* Revert changes from my previous refactoring - will need to fix dependencies ↵Faisal Vali2017-07-171-3/+3
| | | | | | | | in clang's extra tooling (such as clang-tidy etc.). Sorry about that. llvm-svn: 308158
* [NFC] Refactor the Preprocessor function that handles Macro definitions and ↵Faisal Vali2017-07-171-3/+3
| | | | | | | | | | | | | | rename Arguments to Parameters in Macro Definitions. - Extracted the reading of the tokens out into a separate function. - Replace 'Argument' with 'Parameter' when referring to the identifiers of the macro definition (as opposed to the supplied arguments - MacroArgs - during the macro invocation). This is in preparation for submitting patches for review to implement __VA_OPT__ which will otherwise just keep lengthening the HandleDefineDirective function and making it less comprehensible. Thanks! llvm-svn: 308157
* Try to fix modules buildMatthias Braun2017-07-151-0/+1
| | | | | | | | | | | | Module builds somehow report an ambiguity between clang::Diagnostic and clang::Tooling::Diagnostic. It seems as if one of the additional headers brought in by the module brings the clang namespace to the toplevel. I could not find out the reason for that, so for now I go with the simple fix to bring the build back to green. rdar://33321397 llvm-svn: 308071
* [Clang-Tidy] Preserve Message, FileOffset, FilePath in Clang-Tidy YAML outputAlexander Kornienko2017-07-142-0/+167
| | | | | | | | | | | | | | | | | | | | | | Summary: To get properly integration Clang-Tidy with CLion IDE, next things were implemented: 1) Preserve `Message`, `FileOffset`, `FilePath` in the clang-tidy output. 2) Export all diagnostics, not just the ones with fixes 3) Test-cases Reviewers: klimek, ilya-biryukov, alexfh Reviewed By: alexfh Subscribers: alexfh, JDevlieghere, mgorny, xazax.hun, cfe-commits, klimek Tags: #clang-tools-extra Patch by Vladimir Plyashkun! Differential Revision: https://reviews.llvm.org/D34404 llvm-svn: 308014
* Keep the IdentifierInfo in the Token for alternative operator keywordOlivier Goffart2017-07-141-0/+10
| | | | | | | | | | | | | | | | | | | The goal of this commit is to fix clang-format so it does not merge tokens when using the alternative spelling keywords. (eg: "not foo" should not become "notfoo") The problem is that Preprocessor::HandleIdentifier used to drop the identifier info from the token for these keyword. This means the first condition of TokenAnnotator::spaceRequiredBefore is not met. We could add explicit check for the spelling in that condition, but I think it is better to keep the IdentifierInfo and handle the operator keyword explicitly when needed. That actually leads to simpler code, and probably slightly more efficient as well. Another side effect of this change is that __identifier(and) will now work as one would expect, removing a FIXME from the MicrosoftExtensions.cpp test Differential Revision: https://reviews.llvm.org/D35172 llvm-svn: 308008
* Use EXPECT_TRUE rather than EXPECT_EQ(true, ...) to clean up the code and ↵Eric Christopher2017-07-141-2/+2
| | | | | | silence a null conversion warning. llvm-svn: 307989
* [clang-format] Keep level of comment before an empty lineKrasimir Georgiev2017-07-122-1/+88
| | | | | | | | | | | | | | | | | Summary: This patch fixes bug https://bugs.llvm.org/show_bug.cgi?id=3313: a comment line was aligned with the next #ifdef even in the presence of an empty line between them. Reviewers: djasper, klimek Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D35296 llvm-svn: 307795
* [ASTMatchers][NFC] integerLiteral(): Mention negative integers inClement Courbet2017-07-111-0/+6
| | | | | | | | | | | | | | documentation. Trying to match integerLiteral(-1) will silently fail, because an numeric literal is always positive. - Update the documentation to explain how to match negative numeric literals. - Add a unit test. Differential Revision: https://reviews.llvm.org/D35196 llvm-svn: 307663
* RecursiveASTVisitor should visit the nested name qualifiers inAlex Lorenz2017-07-111-0/+58
| | | | | | | | | | a template specialisation rdar://33123354 Differential Revision: https://reviews.llvm.org/D34981 llvm-svn: 307638
* clang-format: [JS] do not wrap after "readonly".Martin Probst2017-07-071-0/+8
| | | | | | | | | | | | | | Summary: Breaks after "readonly" trigger automatic semicolon insertion in field declarations. Reviewers: krasimir, djasper Subscribers: klimek Differential Revision: https://reviews.llvm.org/D35112 llvm-svn: 307394
* [clang-format] Add space between a message field key and the opening bracket ↵Krasimir Georgiev2017-07-062-47/+46
| | | | | | | | | | | | | | | | | | in proto messages Summary: This patch updates the formatting of message fields of type `a{...}` to `a {...}` for proto messages. Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D35015 llvm-svn: 307261
* clang-format: [JS] space between pseudo keywords and template literals.Martin Probst2017-07-041-0/+1
| | | | | | | | | | | | | | | | | | | | Summary: Before: yield`foo`; After: yield `foo`; This reinstates commit 71d3b5cd91 / r307023 and fixes the logic by introducing an explicit table of JavaScript pseudo keywords. Reviewers: djasper Subscribers: klimek Differential Revision: https://reviews.llvm.org/D34953 llvm-svn: 307087
* Revert "clang-format: [JS] space between pseudo keywords and template literals."Martin Probst2017-07-031-1/+0
| | | | | | This reverts commit 71d3b5cd916106005ef23467e3f6c7fbca7bc499. llvm-svn: 307034
* [clang-format] Support text proto messagesKrasimir Georgiev2017-07-032-0/+252
| | | | | | | | | | | | | | Summary: This patch adds support for textual protocol buffer messages. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits, klimek, mgorny Differential Revision: https://reviews.llvm.org/D34441 llvm-svn: 307029
* clang-format: [JS] space between pseudo keywords and template literals.Martin Probst2017-07-031-0/+1
| | | | | | | | | | | | | | | | | Summary: Before: yield`foo`; After: yield `foo`; Reviewers: djasper Subscribers: klimek Differential Revision: https://reviews.llvm.org/D34938 llvm-svn: 307023
* Fix ODR violations due to abuse of LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTORRichard Smith2017-06-301-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | This is a short-term fix for PR33650 aimed to get the modules build bots green again. Remove all the places where we use the LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR macros to try to locally specialize a global template for a global type. That's not how C++ works. Instead, we now centrally define how to format vectors of fundamental types and of string (std::string and StringRef). We use flow formatting for the former cases, since that's the obvious right thing to do; in the latter case, it's less clear what the right choice is, but flow formatting is really bad for some cases (due to very long strings), so we pick block formatting. (Many of the cases that were using flow formatting for strings are improved by this change.) Other than the flow -> block formatting change for some vectors of strings, this should result in no functionality change. Differential Revision: https://reviews.llvm.org/D34907 Corresponding LLVM change is r306878. llvm-svn: 306881
* clang-format: add options to merge empty record bodyFrancois Ferrand2017-06-301-3/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch introduces a few extra BraceWrapping options, similar to `SplitEmptyFunction`, to allow merging empty 'record' bodies (e.g. class, struct, union and namespace): * SplitEmptyClass * SplitEmptyStruct * SplitEmptyUnion * SplitEmptyNamespace The `SplitEmptyFunction` option name has also been simplified/ shortened (from `SplitEmptyFunctionBody`). These options are helpful when the correspond AfterXXX option is enabled, to allow merging the empty record: class Foo {}; In addition, this fixes an unexpected merging of short records, when the AfterXXXX options are used, which caused to be formatted like this: class Foo { void Foo(); }; This is now properly formatted as: class Foo { void Foo(); }; Reviewers: djasper, krasimir Reviewed By: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D34395 llvm-svn: 306874
* clang-format: Do not binpack initialization listsFrancois Ferrand2017-06-302-5/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch tries to avoid binpacking when initializing lists/arrays, to allow things like: static int types[] = { registerType1(), registerType2(), registerType3(), }; std::map<int, std::string> x = { { 0, "foo fjakfjaklf kljj" }, { 1, "bar fjakfjaklf kljj" }, { 2, "stuff fjakfjaklf kljj" }, }; This is similar to how dictionnaries are formatted, and actually corresponds to the same conditions: when initializing a container (and not just 'calling' a constructor). Such formatting involves 2 things: * Line breaks around the content of the block. This can be forced by adding a comma or comment after the last element * Elements should not be binpacked This patch considers the block is an initializer list if it either ends with a comma, or follows an assignment, which seems to provide a sensible approximation. Reviewers: krasimir, djasper Reviewed By: djasper Subscribers: malcolm.parsons, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D34238 llvm-svn: 306868
* Use add_clang_unittest in the CMakeLists.txt for the moved unittestAlex Lorenz2017-06-301-1/+1
| | | | | | The unittest was moved in r306840 llvm-svn: 306841
* [refactor] Move clang-rename into the clang repositoryAlex Lorenz2017-06-304-0/+819
| | | | | | | | | | | | The core engine of clang-rename will be used for local and global renames in the new refactoring engine, as mentioned in http://lists.llvm.org/pipermail/cfe-dev/2017-June/054286.html. The clang-rename tool is still supported but might get deprecated in the future. Differential Revision: https://reviews.llvm.org/D34696 llvm-svn: 306840
* [Driver] Actually report errors during parsing instead of stopping when ↵Benjamin Kramer2017-06-301-0/+11
| | | | | | | | | | | | | | there's an error somewhere. This is a more principled version of r303756. That change was both very brittle about the state of the Diags object going into the driver and also broke tooling in funny ways. In particular it prevented tools from capturing diagnostics properly and made the compilation database logic fail to provide arguments to the tool, falling back to scanning directories for JSON files. llvm-svn: 306822
* [clang-format] Switch to case-insensitive header matching and use it toChandler Carruth2017-06-291-0/+23
| | | | | | | | | | | | | | | | | | | | | | | improve support for LLVM-style include sorting. This really is a collection of improvements to the rules for LLVM include sorting: - We have gmock headers now, so it adds support for those to one of the categories. - LLVM does use 'FooTest.cpp' files to test 'Foo.h' so it adds that suffix for finding a main header. - At times the test file's case may not match the header file's case, so switch to case-insensitive regex matching of header names. With this set of changes, I can't spot any misbehaviors when re-sorting all of LLVM's unittest '#include' lines. Thanks to Eric and Daniel for help testing and refining the patch during review! Differential Revision: https://reviews.llvm.org/D33932 llvm-svn: 306759
* [clang-format] Fix parsing of msg{field}-style proto optionsKrasimir Georgiev2017-06-291-0/+13
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch makes the `{` in `msg_field{field: OK}` in a proto option scope be treated as an assignment operator. Previosly the added test case was formatted as: ``` option (MyProto.options) = { field_a: OK field_b{field_c: OK} field_d: OKOKOK field_e: OK } ``` Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D34749 llvm-svn: 306672
* [Tooling] FixedCompilationDatabase should be able to strip positionalAlex Lorenz2017-06-291-0/+21
| | | | | | | | | | | | | arguments when `-fsyntax-only` is used Previously, Clang failed to create a fixed compilation database when the compilation arguments use -fsyntax-only instead of -c. This commit fixes the issue by forcing Clang to look at the compilation job when stripping the positional arguments. Differential Revision: https://reviews.llvm.org/D34687 llvm-svn: 306659
* [clang-format] Support <>-style proto message fieldsKrasimir Georgiev2017-06-271-0/+136
| | | | | | | | | | | | | | | | | Summary: This patch adds support for <>-style proto message fields inside proto options. Previously these were wrongly treated as binary operators and as such were working only by chance for a limited number of cases. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D34621 llvm-svn: 306406
* [clang-format] Add a test for associative map proto buffer fieldsKrasimir Georgiev2017-06-271-0/+23
| | | | | | | | | | | | | | | | Summary: The test suite was missing a test about associative maps: https://developers.google.com/protocol-buffers/docs/proto3#maps Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D34623 llvm-svn: 306386
* Make CastExpr::getSubExprAsWritten look through implicit temporary under ↵Stephan Bergmann2017-06-272-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | CK_ConstructorConversion With struct S1 {}; struct S2 { operator S1(); }; S1 f(S2 s) { return static_cast<S1>(s); } the static_cast expr is CXXStaticCastExpr 0x... 'struct S1' static_cast<struct S1> <ConstructorConversion> `-CXXConstructExpr 0x... 'struct S1' 'void (struct S1 &&) noexcept' elidable `-MaterializeTemporaryExpr 0x... 'struct S1' xvalue `-ImplicitCastExpr 0x... 'struct S1' <UserDefinedConversion> `-CXXMemberCallExpr 0x... 'struct S1' `-MemberExpr 0x... '<bound member function type>' .operator S1 0x... `-DeclRefExpr 0x... 'struct S2' lvalue ParmVar 0x... 's' 'struct S2' getSubExprAsWritten used to return the MaterializeTemporaryExpr (of type S1) under the CXXConstructExpr, instead of unwinding further to the DeclRefExpr (of type S2) at the bottom. Differential Revision: https://reviews.llvm.org/D22128 llvm-svn: 306377
OpenPOWER on IntegriCloud