Author: Yuanfang Chen Date: 2020-06-16T10:19:36-07:00 New Revision: 4676cf444ea2678660ee48279be99efde4bf60e9
URL: https://github.com/llvm/llvm-project/commit/4676cf444ea2678660ee48279be99efde4bf60e9 DIFF: https://github.com/llvm/llvm-project/commit/4676cf444ea2678660ee48279be99efde4bf60e9.diff LOG: [Clang] Skip adding begin source location for PragmaLoopHint'd loop when the range start is already set The range start could be set already in some invalid cases. Fixes PR46336. Added: Modified: clang/lib/Parse/ParseStmt.cpp Removed: ################################################################################ diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index d00f6b640fb4..773c31ff3aec 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/lib/Parse/ParseStmt.cpp @@ -2195,9 +2195,11 @@ StmtResult Parser::ParsePragmaLoopHint(StmtVector &Stmts, Attrs.takeAllFrom(TempAttrs); - assert(Attrs.Range.getBegin().isInvalid() && - "start of attribute range already set"); - Attrs.Range.setBegin(StartLoc); + // Start of attribute range may already be set for some invalid input. + // See PR46336. + if (Attrs.Range.getBegin().isInvalid()) + Attrs.Range.setBegin(StartLoc); + return S; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits