Issue 55378
Summary Assertion failed: ExprToLoc.find(&CanonE) == ExprToLoc.end(), file F:/llvm/llvm/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp, line 369
Labels
Assignees
Reporter zufuliu
    ```log
Assertion failed: ExprToLoc.find(&CanonE) == ExprToLoc.end(), file F:/llvm/llvm/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp, line 369
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: clang-tidy src\\Document.cxx -- -m64 -std=c++20 -D_WIN64 -DNOMINMAX -DNDEBUG -DSTRICT_TYPED_ITEMIDS -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0600 -DWINVER=0x0600 -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -Iinclude -Isrc -Ilexlib -Wall -Wextra -Wshadow -Wimplicit-fallthrough -Wformat=2 -Wundef -Wcomma
1.      <eof> parser at end of file
2.      ASTMatcher: Processing 'bugprone-unchecked-optional-access' against:
        CXXMethodDecl Scintilla::Internal::Document::GetLastChild : <D:\notepad2\notepad2\scintilla\src\Document.cxx:543:1, line:565:1>
--- Bound Nodes Begin ---
    T - { EnumType : Scintilla::FoldLevel }
    fun - { CXXMethodDecl Scintilla::Internal::Document::GetLastChild : <D:\notepad2\notepad2\scintilla\src\Document.cxx:543:1, line:565:1> }
--- Bound Nodes End ---
```

clang-tidy built (with MSVC 2022 17.2.0) from today main 34b6f206cbab8471abf29739dab981bd8b868a65, configuration file is at
https://github.com/zufuliu/notepad2/blob/main/.clang-tidy

The source code for `Document::GetLastChild()` is available at 
https://github.com/zufuliu/notepad2/blob/main/scintilla/src/Document.cxx#L543

```cpp
Sci::Line Document::GetLastChild(Sci::Line lineParent, std::optional<FoldLevel> level, Sci::Line lastLine) {
	const FoldLevel levelStart = LevelNumberPart(level ? *level : GetFoldLevel(lineParent));
	const Sci::Line maxLine = LinesTotal();
	const Sci::Line lookLastLine = (lastLine != -1) ? std::min(LinesTotal() - 1, lastLine) : -1;
	Sci::Line lineMaxSubord = lineParent;
	while (lineMaxSubord < maxLine - 1) {
		EnsureStyledTo(LineStart(lineMaxSubord + 2));
		if (!IsSubordinate(levelStart, GetFoldLevel(lineMaxSubord + 1)))
			break;
		if ((lookLastLine != -1) && (lineMaxSubord >= lookLastLine) && !LevelIsWhitespace(GetFoldLevel(lineMaxSubord)))
			break;
		lineMaxSubord++;
	}
	if (lineMaxSubord > lineParent) {
		if (levelStart > LevelNumberPart(GetFoldLevel(lineMaxSubord + 1))) {
			// Have chewed up some whitespace that belongs to a parent so seek back
			if (LevelIsWhitespace(GetFoldLevel(lineMaxSubord))) {
				lineMaxSubord--;
			}
		}
	}
	return lineMaxSubord;
}
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to