summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse
Commit message (Collapse)AuthorAgeFilesLines
...
* [Parser] Emit descriptive diagnostic for misplaced pragmaSerge Pavlov2019-08-042-0/+15
| | | | | | | | | | | If a class or struct or union declaration contains a pragma that is not valid in this context, compiler issues generic error like "expected member name or ';' after declaration specifiers". With this change the error tells that this pragma cannot appear in this declaration. Differential Revision: https://reviews.llvm.org/D64932 llvm-svn: 367779
* Remove a dead diagnostic, NFCErik Pilkington2019-08-021-4/+0
| | | | | | | This was issued in Objective-C 1 mode, but we not longer support that, so this is just unreachable. llvm-svn: 367708
* [Parser] Change parameter type from int to enumSerge Pavlov2019-08-013-4/+4
| | | | | | | | | Some parser functions accept argument of type unsigned while it is actually of type DeclSpec::TST. No functional changes. Differential Revision: https://reviews.llvm.org/D65406 llvm-svn: 367545
* [Parser] Lambda capture lists can start with '*'Erik Pilkington2019-07-301-0/+1
| | | | | | Fixes llvm.org/PR42778 llvm-svn: 367346
* Add lifetime categories attributesMatthias Gehre2019-07-251-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is the first part of work announced in "[RFC] Adding lifetime analysis to clang" [0], i.e. the addition of the [[gsl::Owner(T)]] and [[gsl::Pointer(T)]] attributes, which will enable user-defined types to participate in the lifetime analysis (which will be part of the next PR). The type `T` here is called "DerefType" in the paper, and denotes the type that an Owner owns and a Pointer points to. E.g. `std::vector<int>` should be annotated with `[[gsl::Owner(int)]]` and a `std::vector<int>::iterator` with `[[gsl::Pointer(int)]]`. [0] http://lists.llvm.org/pipermail/cfe-dev/2018-November/060355.html Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63954 llvm-svn: 367040
* [Clang] New loop pragma vectorize_predicateSjoerd Meijer2019-07-251-0/+3
| | | | | | | | | | | | | | | | | | | This adds a new vectorize predication loop hint: #pragma clang loop vectorize_predicate(enable) that can be used to indicate to the vectoriser that all (load/store) instructions should be predicated (masked). This allows, for example, folding of the remainder loop into the main loop. This patch will be followed up with D64916 and D65197. The former is a refactoring in the loopvectorizer and the groundwork to make tail loop folding a more general concept, and in the latter the actual tail loop folding transformation will be implemented. Differential Revision: https://reviews.llvm.org/D64744 llvm-svn: 366989
* [OpenCL] Update comments/diagnostics to refer to C++ for OpenCLAnastasia Stulova2019-07-181-1/+2
| | | | | | | | | Clang doesn't implement OpenCL C++, change the comments to reflect that. Differential Revision: https://reviews.llvm.org/D64867 llvm-svn: 366421
* Fix parameter name comments using clang-tidy. NFC.Rui Ueyama2019-07-168-26/+26
| | | | | | | | | | | | | | | | | | | | | This patch applies clang-tidy's bugprone-argument-comment tool to LLVM, clang and lld source trees. Here is how I created this patch: $ git clone https://github.com/llvm/llvm-project.git $ cd llvm-project $ mkdir build $ cd build $ cmake -GNinja -DCMAKE_BUILD_TYPE=Debug \ -DLLVM_ENABLE_PROJECTS='clang;lld;clang-tools-extra' \ -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DLLVM_ENABLE_LLD=On \ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../llvm $ ninja $ parallel clang-tidy -checks='-*,bugprone-argument-comment' \ -config='{CheckOptions: [{key: StrictMode, value: 1}]}' -fix \ ::: ../llvm/lib/**/*.{cpp,h} ../clang/lib/**/*.{cpp,h} ../lld/**/*.{cpp,h} llvm-svn: 366177
* [Concepts] Concept definitions (D40381)Saar Raz2019-07-101-0/+94
| | | | | | | First in a series of patches to land C++2a Concepts support. This patch adds AST and parsing support for concept-declarations. llvm-svn: 365699
* Ignore trailing NullStmts in StmtExprs for GCC compatibility.Aaron Ballman2019-07-091-4/+10
| | | | | | | | Ignore trailing NullStmts in compound expressions when determining the result type and value. This is to match the GCC behavior which ignores semicolons at the end of compound expressions. Patch by Dominic Ferreira. llvm-svn: 365498
* Change std::{lower,upper}_bound to llvm::{lower,upper}_bound or ↵Fangrui Song2019-07-031-4/+3
| | | | | | llvm::partition_point. NFC llvm-svn: 365006
* [C++2a] Add __builtin_bit_cast, used to implement std::bit_castErik Pilkington2019-07-022-0/+37
| | | | | | | | | | | | | | | | | | This commit adds a new builtin, __builtin_bit_cast(T, v), which performs a bit_cast from a value v to a type T. This expression can be evaluated at compile time under specific circumstances. The compile time evaluation currently doesn't support bit-fields, but I'm planning on fixing this in a follow up (some of the logic for figuring this out is in CodeGen). I'm also planning follow-ups for supporting some more esoteric types that the constexpr evaluator supports, as well as extending __builtin_memcpy constexpr evaluation to use the same infrastructure. rdar://44987528 Differential revision: https://reviews.llvm.org/D62825 llvm-svn: 364954
* [ObjC] Improve error message for a malformed objc-type-nameErik Pilkington2019-06-261-1/+1
| | | | | | | | | | | | If the type didn't exist, we used to emit a really bad error: t.m:3:12: error: expected ')' -(nullable NoSuchType)foo3; ^ rdar://50925632 llvm-svn: 364489
* P0840R2: support for [[no_unique_address]] attributeRichard Smith2019-06-201-0/+1
| | | | | | | | | | | | | | | | | Summary: Add support for the C++2a [[no_unique_address]] attribute for targets using the Itanium C++ ABI. This depends on D63371. Reviewers: rjmccall, aaron.ballman Subscribers: dschuff, aheejin, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63451 llvm-svn: 363976
* Require commas to separate multiple GNU-style attributes in the same ↵Aaron Ballman2019-06-181-5/+5
| | | | | | | | attribute list. Fixes PR38352. llvm-svn: 363676
* [C++20] add Basic consteval specifierGauthier Harnisch2019-06-144-15/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: this revision adds Lexing, Parsing and Basic Semantic for the consteval specifier as specified by http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1073r3.html with this patch, the consteval specifier is treated as constexpr but can only be applied to function declaration. Changes: - add the consteval keyword. - add parsing of consteval specifier for normal declarations and lambdas expressions. - add the whether a declaration is constexpr is now represented by and enum everywhere except for variable because they can't be consteval. - adapt diagnostic about constexpr to print constexpr or consteval depending on the case. - add tests for basic semantic. Reviewers: rsmith, martong, shafik Reviewed By: rsmith Subscribers: eraman, efriedma, rnkovacs, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61790 llvm-svn: 363362
* Re-check in clang support gun asm goto after fixing tests.Jennifer Yu2019-06-031-10/+58
| | | | llvm-svn: 362410
* Revert "clang support gnu asm goto."Erich Keane2019-05-301-58/+10
| | | | | | | | | | | This reverts commit 954ec09aed4f2be04bb5f4e10dbb4ea8bd19ef9a. Reverting due to test failures as requested by Jennifer Yu. Conflicts: clang/test/CodeGen/asm-goto.c llvm-svn: 362106
* Revert "asm goto: fix out-of-bounds read of Constraints after rC362045"Fangrui Song2019-05-301-1/+0
| | | | | | It was fixed by rC362062. llvm-svn: 362079
* asm goto: fix out-of-bounds read of Constraints after rC362045Fangrui Song2019-05-301-0/+1
| | | | | | | | | | | | When parsing goto labels, Names and Exprs are expanded but Constraints is not, this may cause a out-of-bounds read later in: // GCCAsmStmt::GCCAsmStmt // `constraints` has only `NumExprs - NumLabels` elements Constraints = new (C) StringLiteral*[NumExprs]; std::copy(constraints, constraints + NumExprs, Constraints); llvm-svn: 362067
* clang support gnu asm goto.Jennifer Yu2019-05-301-10/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Syntax: asm [volatile] goto ( AssemblerTemplate : : InputOperands : Clobbers : GotoLabels) https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html New llvm IR is "callbr" for inline asm goto instead "call" for inline asm For: asm goto("testl %0, %0; jne %l1;" :: "r"(cond)::label_true, loop); IR: callbr void asm sideeffect "testl $0, $0; jne ${1:l};", "r,X,X,~{dirflag},~{fpsr},~{flags}"(i32 %0, i8* blockaddress(@foo, %label_true), i8* blockaddress(@foo, %loop)) #1 to label %asm.fallthrough [label %label_true, label %loop], !srcloc !3 asm.fallthrough: Compiler need to generate: 1> a dummy constarint 'X' for each label. 2> an unique fallthrough label for each asm goto stmt " asm.fallthrough%number". Diagnostic 1> duplicate asm operand name are used in output, input and label. 2> goto out of scope. llvm-svn: 362045
* [OpenMP] Set pragma start loc to `#pragma` locJoel E. Denny2019-05-281-1/+1
| | | | | | | | | | | | | | | This patch adjusts `PragmaOpenMPHandler` to set the location of `tok::annot_pragma_openmp` to the `#pragma` location instead of the `omp` location so that the former becomes the start location of the OpenMP AST node. This can be useful when, for example, rewriting a directive using Clang's Rewrite facility. Most of this patch updates tests for changes to locations in diagnostics and `-ast-dump` output. Reviewed By: ABataev, lebedev.ri, Meinersbur, aaron.ballman Differential Revision: https://reviews.llvm.org/D61509 llvm-svn: 361867
* [CodeComplete] Set preferred type for qualified-idIlya Biryukov2019-05-281-1/+4
| | | | | | | | | | | | | | Reviewers: kadircet Reviewed By: kadircet Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62514 llvm-svn: 361838
* [OpenCL] Support pipe keyword in C++ modeSven van Haastregt2019-05-222-3/+13
| | | | | | | | | | | | Support the OpenCL C pipe feature in C++ for OpenCL mode, to preserve backwards compatibility with OpenCL C. Various changes had to be made in Parse and Sema to enable pipe-specific diagnostics, so enable a SemaOpenCL test for C++. Differential Revision: https://reviews.llvm.org/D62181 llvm-svn: 361382
* [PragmaHandler] Expose `#pragma` locationJoel E. Denny2019-05-211-72/+69
| | | | | | | | | | | | | | | | | | | | | | | Currently, a pragma AST node's recorded location starts at the namespace token (such as `omp` in the case of OpenMP) after the `#pragma` token, and the `#pragma` location isn't available. However, the `#pragma` location can be useful when, for example, rewriting a directive using Clang's Rewrite facility. This patch makes `#pragma` locations available in any `PragmaHandler` but it doesn't yet make use of them. This patch also uses the new `struct PragmaIntroducer` to simplify `Preprocessor::HandlePragmaDirective`. It doesn't do the same for `PPCallbacks::PragmaDirective` because that changes the API documented in `clang-tools-extra/docs/pp-trace.rst`, and I'm not sure about backward compatibility guarantees there. Reviewed By: ABataev, lebedev.ri, aaron.ballman Differential Revision: https://reviews.llvm.org/D61643 llvm-svn: 361335
* [c++20] P0780R2: Support pack-expansion of init-captures.Richard Smith2019-05-211-51/+87
| | | | | | | | | | | This permits an init-capture to introduce a new pack: template<typename ...T> auto x = [...a = T()] { /* a is a pack */ }; To support this, the mechanism for allowing ParmVarDecls to be packs has been extended to support arbitrary local VarDecls. llvm-svn: 361300
* Rearrange and clean up how we disambiguate lambda-introducers from ObjCRichard Smith2019-05-203-110/+167
| | | | | | | | | | | | | | | | message sends, designators, and attributes. Instead of having the tentative parsing phase sometimes return an indicator to say what diagnostic to produce if parsing fails and sometimes ask the caller to run it again, consistently ask the caller to try parsing again if tentative parsing would fail or is otherwise unable to completely parse the lambda-introducer without producing an irreversible semantic effect. Mostly NFC, but we should recover marginally better in some error cases (avoiding duplicate diagnostics). llvm-svn: 361182
* Fix buildbot: Use correct Consume*() for braces.Nicolas Lesser2019-05-191-1/+2
| | | | llvm-svn: 361120
* Added a better diagnostic when using the delete operator with lambdasNicolas Lesser2019-05-191-2/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This adds a new error for missing parentheses around lambdas in delete operators. ``` int main() { delete []() { return new int(); }(); } ``` This will result in: ``` test.cpp:2:3: error: '[]' after delete interpreted as 'delete[]' delete []() { return new int(); }(); ^~~~~~~~~ test.cpp:2:9: note: add parentheses around the lambda delete []() { return new int(); }(); ^ ( ) ``` Reviewers: rsmith Reviewed By: rsmith Subscribers: riccibruno, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D36357 llvm-svn: 361119
* [Lex] Allow to consume tokens while preprocessingIlya Biryukov2019-05-1711-56/+74
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: By adding a hook to consume all tokens produced by the preprocessor. The intention of this change is to make it possible to consume the expanded tokens without re-runnig the preprocessor with minimal changes to the preprocessor and minimal performance penalty when preprocessing without recording the tokens. The added hook is very low-level and reconstructing the expanded token stream requires more work in the client code, the actual algorithm to collect the tokens using this hook can be found in the follow-up change. Reviewers: rsmith Reviewed By: rsmith Subscribers: eraman, nemanjai, kbarton, jsji, riccibruno, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59885 llvm-svn: 361007
* Implement __builtin_LINE() et. al. to support source location capture.Eric Fiselier2019-05-161-0/+39
| | | | | | | | | | | | | | | | | Summary: This patch implements the source location builtins `__builtin_LINE(), `__builtin_FUNCTION()`, `__builtin_FILE()` and `__builtin_COLUMN()`. These builtins are needed to implement [`std::experimental::source_location`](https://rawgit.com/cplusplus/fundamentals-ts/v2/main.html#reflection.src_loc.creation). With the exception of `__builtin_COLUMN`, GCC also implements these builtins, and Clangs behavior is intended to match as closely as possible. Reviewers: rsmith, joerg, aaron.ballman, bogner, majnemer, shafik, martong Reviewed By: rsmith Subscribers: rnkovacs, loskutov, riccibruno, mgorny, kunitoki, alexr, majnemer, hfinkel, cfe-commits Differential Revision: https://reviews.llvm.org/D37035 llvm-svn: 360937
* Make tentative parsing to detect template-argument-lists less aggressiveRichard Smith2019-05-151-26/+24
| | | | | | | | | | | | | | | | | | (and less wrong). It's not correct to assume that X<something, Type> is always a template-id; there are a few cases where the comma takes us into a non-expression syntactic context in which 'Type' might be permissible. Stop doing that. This slightly regresses our error recovery on the cases where the construct is intended to be a template-id. We typically do still manage to diagnose a missing 'template' keyword, but we realize this too late to properly recover from the error. This fixes a regression introduced by r360308. llvm-svn: 360827
* Fix for P41852 where builtin attributes were being caught by ↵Leonard Chan2019-05-121-2/+3
| | | | | | FindLocsWithCommonFileID(). llvm-svn: 360544
* Simplify tracking of end of consumed decl-specifier sequence.Richard Smith2019-05-091-11/+7
| | | | | | | | Patch by Tyker! Differential Revision: https://reviews.llvm.org/D60934 llvm-svn: 360369
* Fix gcc compilation warning in an assert [NFC]Mikael Holmen2019-05-091-1/+1
| | | | | | | | | | | | | | Without this, gcc (7.4) complains with ../tools/clang/lib/Parse/ParseDecl.cpp:3937:63: error: suggest parentheses around '&&' within '||' [-Werror=parentheses] assert(!isAlreadyConsumed || RangeEnd != SourceLocation() && ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ "both or neither of isAlreadyConsumed and " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "RangeEnd needs to be set"); ~ llvm-svn: 360333
* [c++20] Add support for explicit(bool), as described in P0892R2.Richard Smith2019-05-091-13/+49
| | | | | | | | Patch by Tyker! Differential Revision: https://reviews.llvm.org/D60934 llvm-svn: 360311
* [c++20] Implement P0846R0: allow (ADL-only) calls to template-ids whoseRichard Smith2019-05-096-106/+218
| | | | | | | | | | | | | | | | | | | | | | | | | template name is not visible to unqualified lookup. In order to support this without a severe degradation in our ability to diagnose typos in template names, this change significantly restructures the way we handle template-id-shaped syntax for which lookup of the template name finds nothing. Instead of eagerly diagnosing an undeclared template name, we now form a placeholder template-name representing a name that is known to not find any templates. When the parser sees such a name, it attempts to disambiguate whether we have a less-than comparison or a template-id. Any diagnostics or typo-correction for the name are delayed until its point of use. The upshot should be a small improvement of our diagostic quality overall: we now take more syntactic context into account when trying to resolve an undeclared identifier on the left hand side of a '<'. In fact, this works well enough that the backwards-compatible portion (for an undeclared identifier rather than a lookup that finds functions but no function templates) is enabled in all language modes. llvm-svn: 360308
* [hip] Fix ambiguity from `>>>` of CUDA.Michael Liao2019-05-081-1/+3
| | | | | | | | | | | | | | | | | Summary: - For template arguments ending with `>>>`, we should cease lookahead and treat it as type-id firstly, so that deduction could work properly. Reviewers: tra, yaxunl Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61396 llvm-svn: 360214
* Improve function / variable disambiguation.Richard Smith2019-05-072-23/+23
| | | | | | | | Keep looking for decl-specifiers after an unknown identifier. Don't issue diagnostics about an error type specifier conflicting with later type specifiers. llvm-svn: 360117
* Recommit r359859 "[Attribute/Diagnostics] Print macro if definition is an ↵Leonard Chan2019-05-071-1/+39
| | | | | | | | attribute declaration" Updated with fix for read of uninitialized memory. llvm-svn: 360109
* Revert r359949 "[clang] adding explicit(bool) from c++2a"Hans Wennborg2019-05-061-49/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This caused Clang to start erroring on the following: struct S {   template <typename = int> explicit S(); }; struct T : S {}; struct U : T {   U(); }; U::U() {} $ clang -c /tmp/x.cc /tmp/x.cc:10:4: error: call to implicitly-deleted default constructor of 'T' U::U() {}    ^ /tmp/x.cc:5:12: note: default constructor of 'T' is implicitly deleted because base class 'S' has no default constructor struct T : S {};            ^ 1 error generated. See discussion on the cfe-commits email thread. This also reverts the follow-ups r359966 and r359968. > this patch adds support for the explicit bool specifier. > > Changes: > - The parsing for the explicit(bool) specifier was added in ParseDecl.cpp. > - The storage of the explicit specifier was changed. the explicit specifier was stored as a boolean value in the FunctionDeclBitfields and in the DeclSpec class. now it is stored as a PointerIntPair<Expr*, 2> with a flag and a potential expression in CXXConstructorDecl, CXXDeductionGuideDecl, CXXConversionDecl and in the DeclSpec class. > - Following the AST change, Serialization, ASTMatchers, ASTComparator and ASTPrinter were adapted. > - Template instantiation was adapted to instantiate the potential expressions of the explicit(bool) specifier When instantiating their associated declaration. > - The Add*Candidate functions were adapted, they now take a Boolean indicating if the context allowing explicit constructor or conversion function and this boolean is used to remove invalid overloads that required template instantiation to be detected. > - Test for Semantic and Serialization were added. > > This patch is not yet complete. I still need to check that interaction with CTAD and deduction guides is correct. and add more tests for AST operations. But I wanted first feedback. > Perhaps this patch should be spited in smaller patches, but making each patch testable as a standalone may be tricky. > > Patch by Tyker > > Differential Revision: https://reviews.llvm.org/D60934 llvm-svn: 360024
* [c++20] Implement P1009R2: allow omitting the array bound in an arrayRichard Smith2019-05-061-5/+6
| | | | | | | | | | new expression. This was voted into C++20 as a defect report resolution, so we retroactively apply it to all prior language modes (though it can never actually be used before C++11 mode). llvm-svn: 360006
* [C++] Interpret unknown identifier in parameter clause as unknown typeNicolas Lesser2019-05-051-0/+3
| | | | | | instead of as parameter name without a type. llvm-svn: 359979
* [NFC] Add parentheses to avoid -Wparentheses.Nicolas Lesser2019-05-041-1/+1
| | | | llvm-svn: 359968
* [c++20] Implement P0428R2 - Familiar template syntax for generic lambdasHamza Sood2019-05-041-2/+39
| | | | | | Differential Revision: https://reviews.llvm.org/D36527 llvm-svn: 359967
* [clang] adding explicit(bool) from c++2aNicolas Lesser2019-05-041-13/+49
| | | | | | | | | | | | | | | | | | | | | this patch adds support for the explicit bool specifier. Changes: - The parsing for the explicit(bool) specifier was added in ParseDecl.cpp. - The storage of the explicit specifier was changed. the explicit specifier was stored as a boolean value in the FunctionDeclBitfields and in the DeclSpec class. now it is stored as a PointerIntPair<Expr*, 2> with a flag and a potential expression in CXXConstructorDecl, CXXDeductionGuideDecl, CXXConversionDecl and in the DeclSpec class. - Following the AST change, Serialization, ASTMatchers, ASTComparator and ASTPrinter were adapted. - Template instantiation was adapted to instantiate the potential expressions of the explicit(bool) specifier When instantiating their associated declaration. - The Add*Candidate functions were adapted, they now take a Boolean indicating if the context allowing explicit constructor or conversion function and this boolean is used to remove invalid overloads that required template instantiation to be detected. - Test for Semantic and Serialization were added. This patch is not yet complete. I still need to check that interaction with CTAD and deduction guides is correct. and add more tests for AST operations. But I wanted first feedback. Perhaps this patch should be spited in smaller patches, but making each patch testable as a standalone may be tricky. Patch by Tyker Differential Revision: https://reviews.llvm.org/D60934 llvm-svn: 359949
* Revert "[Attribute/Diagnostics] Print macro if definition is an attribute ↵Leonard Chan2019-05-031-39/+1
| | | | | | | | declaration" This reverts commit fc40cbd9d8c63e65eed3590ba925321afe782e1d. llvm-svn: 359859
* [Attribute/Diagnostics] Print macro if definition is an attribute declarationLeonard Chan2019-05-021-1/+39
| | | | | | | | | | | | | If an address_space attribute is defined in a macro, print the macro instead when diagnosing a warning or error for incompatible pointers with different address_spaces. We allow this for all attributes (not just address_space), and for multiple attributes declared in the same macro. Differential Revision: https://reviews.llvm.org/D51329 llvm-svn: 359826
* Consume unexpected "template" keywords after "using"Richard Trieu2019-05-011-0/+14
| | | | | | | | | | The parser was dealing with unexpected "template" keywords after "using" keywords too late and putting the parser into the wrong state, which could lead to a crash down the line. This change allows the parser to consume the bad "template" keywords earlier, and continue parsing as if "template" was never there to begin with for better error recovery. llvm-svn: 359740
* [Parser] Avoid correcting delayed typos in array subscript multiple times.Volodymyr Sapsai2019-05-011-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | We correct some typos in `ActOnArraySubscriptExpr` and `ActOnOMPArraySectionExpr`, so when their result is `ExprError`, we can end up correcting delayed typos in the same expressions again. In general it is OK but when `NumTypos` is incorrect, we can hit the assertion > Assertion failed: (Entry != DelayedTypos.end() && "Failed to get the state for a TypoExpr!"), function getTypoExprState, file clang/lib/Sema/SemaLookup.cpp, line 5219. Fix by replacing some subscript `ExprResult` with typo-corrected expressions instead of keeping the original expressions. Thus if original expressions contained `TypoExpr`, we'll use corrected expressions instead of trying to correct them again. rdar://problem/47403222 Reviewers: rsmith, erik.pilkington, majnemer Reviewed By: erik.pilkington Subscribers: jkorous, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D60848 llvm-svn: 359713
OpenPOWER on IntegriCloud