================ @@ -711,11 +712,54 @@ void APValue::printPretty(raw_ostream &Out, const PrintingPolicy &Policy, case APValue::Indeterminate: Out << "<uninitialized>"; return; - case APValue::Int: + case APValue::Int: { + const APSInt &Val = getInt(); + if (const EnumType *ET = Ty->getAs<EnumType>()) { + // print the enumerator name if requested (and one exists) + if (Policy.UseEnumerators) { + for (const EnumConstantDecl *ECD : ET->getDecl()->enumerators()) { + if (APSInt::isSameValue(ECD->getInitVal(), Val)) { + if (ECD->isCXXClassMember()) + ECD->printQualifiedName(Out, Policy); + else + ECD->printName(Out, Policy); ---------------- sethp wrote:
This is a weird heuristic: without it, we were trying to print a function-local enum constant as `fn_name()::Constant`. It might be better to go back to just always using the QualifiedName though, I'm not sure. https://github.com/llvm/llvm-project/pull/74852 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits