llvm-project
e44fff5d - [clang-repl] Undo the enumerators of an unscoped enumeration (#228370)

Commit
1 day ago
[clang-repl] Undo the enumerators of an unscoped enumeration (#228370) The enumerators of an unscoped enumeration are in the lookup table of the enclosing context. Undoing the input that declared the enumeration removed the enumeration, but its enumerators stayed visible: ``` clang-repl> enum E { Red }; clang-repl> %undo clang-repl> int Red = 5; error: redefinition of 'Red' as different kind of symbol ``` `ASTDeclUnmerger` now also visits the declarations of an undone enumeration definition. **Test:** new lit test `code-undo-enumerators.cpp` with three cases: an enumerator reused as a variable, an enumeration redefined, and an enumeration in a namespace. It checks printed values only, not `printf()` output, whose order isn't reliable when stdout is a pipe (#228358). Context: these patches come from moving [ROOT](https://root.cern) from Cling to clang-repl. ROOT builds a Cling-compatible layer on `clang::Interpreter`, and its test suite found the issues below. Assisted-by: Claude Opus 5.5
Author
Parents
Loading