================
@@ -494,6 +501,54 @@ static void profileIntValue(llvm::FoldingSetNodeID &ID, 
const llvm::APInt &V) {
     ID.AddInteger((uint32_t)V.extractBitsAsZExtValue(std::min(32u, N - I), I));
 }
 
+static bool isTypeAliasAsReflectionName(QualType QT) {
+  /// [expr.reflect] p5, if a reflect-expression R matches the form
+  /// ^^reflection-name it is interpreted as such; the identifier is looked up
+  /// and the representation of R is determined as follows:
+  /// - if lookup finds a type alias A, R represents the type the underlying
+  ///   entity of A if A was introduced by the declaration of a template 
parameter;
+  ///   otherwise, R represents A.
+
+  /// [expr.reflect] p6, Given reflect-expression R of the form ^^type-id,
+  /// if type-id is neither a placeholder type nor
+  /// in the form of nested-name-specifier_opt template_opt simple-template-id
+  /// then R represents the type denoted by the type-id
+
+  return QT.getLocalQualifiers() == Qualifiers{};
+}
+
+/// Unwrap reflected type for profiling
+static void unwrapReflectedTypeForProfile(llvm::FoldingSetNodeID &ID,
+                                          QualType QT) {
+  // TODO(Reflection)
+
+  if (isTypeAliasAsReflectionName(QT)) {
+    if (const auto *TDT = QT->getAs<TypedefType>()) {
+      ID.AddBoolean(true);
----------------
changkhothuychung wrote:

I don't think it has been discussed before. From the most recent discussions 
regarding how many `ReflectionKind`'s we will have, there are `Type`, 
`NamespaceReference`, `TemplateReference` and `DeclRefExpr`. 

With your suggestion, wherever applicable, we can check to see if we should 
treat it as an alias or a type.

https://github.com/llvm/llvm-project/pull/190356
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to