[llvm-branch-commits] [clang] [clang-tools-extra] [libcxx] [clang] improved preservation of template keyword (PR #133610)
Younan Zhang via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Mar 31 23:47:45 PDT 2025
================
@@ -544,6 +545,35 @@ class QualifiedTemplateName : public llvm::FoldingSetNode {
}
};
+struct IdentifierOrOverloadedOperator {
+ IdentifierOrOverloadedOperator() = default;
+ IdentifierOrOverloadedOperator(const IdentifierInfo *II);
+ IdentifierOrOverloadedOperator(OverloadedOperatorKind OOK);
+
+ /// Returns the identifier to which this template name refers.
+ const IdentifierInfo *getIdentifier() const {
+ if (getOperator() != OO_None)
+ return nullptr;
+ return reinterpret_cast<const IdentifierInfo *>(PtrOrOp);
+ }
+
+ /// Return the overloaded operator to which this template name refers.
+ OverloadedOperatorKind getOperator() const {
+ uintptr_t OOK = -PtrOrOp;
+ return OOK < NUM_OVERLOADED_OPERATORS ? OverloadedOperatorKind(OOK)
+ : OO_None;
----------------
zyn0217 wrote:
IIRC this pointer/integer mechanism is also used in that lambda patch. We probably want to extract a generic implementation of it.
https://github.com/llvm/llvm-project/pull/133610
More information about the llvm-branch-commits
mailing list