li.zhe.hua added inline comments.

================
Comment at: clang/lib/AST/TypePrinter.cpp:1570
 
+  if (Policy.IgnoreElaboratedQualifiers) {
+    printBefore(T->getNamedType(), OS);
----------------
aaron.ballman wrote:
> So, effectively, the idea here is: you want the ability to skip printing the 
> elaborated keyword and nested name specifier, and you additionally want to 
> skip use of `ElaboratedTypePolicyRAII` when calling 
> `printBefore()`/`printAfter()` because that forces suppression of tags and 
> scopes?
> 
> I think what I'm struggling with a bit is that this is doing three things at 
> once; one is the elaboration keyword (so we no longer print `typename` or 
> `struct` when `IncludeTagDefinition` is false), another is the nested name 
> specifier (we no longer print the leading foo::bar), and the third is that we 
> no longer suppress tags and scopes when printing the underlying type. That 
> makes it tricky to figure out how to name this thing, but the best I could 
> come up with is: `SuppressElaboration` which isn't really different from 
> `IgnoreElaboration` at all. So I think either of those names is "fine", but 
> I'm still a bit uncomfortable about how complex the interactions are becoming.
> another is the nested name specifier (we no longer print the leading 
> foo::bar), and the third is that we no longer suppress tags and scopes when 
> printing the underlying type

I would say that this is the primary desired behavior of the option. More 
specifically, it's //not// that we don't print the nested name specifier and no 
longer suppress those options, but rather, we print the underlying type with 
the options as specified by the policy. `SuppressTagKeyword`, `SuppressScope`, 
and `FullyQualifiedName` work as expected (from my perspective). The 
interaction with `IncludeTagDefinition` dropping the keyword wasn't explicitly 
intended, but it is still consistent with printing the canonical type (which 
would also drop the keyword).

One last name idea to throw out there, in case it seems worth discussing: 
`DesugarElaboratedTypes`. In that case, I'd probably also move the check up 
above L1559 and we treat the entire `ElaboratedType` as if it did not exist.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149677/new/

https://reviews.llvm.org/D149677

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to