rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

OK, let's go ahead with this approach for now; we can investigate replacing the 
implementation with a `PrintingPolicy` flag later.


================
Comment at: lib/Tooling/Core/QualTypeNames.cpp:308-312
@@ +307,7 @@
+  Decl *Decl = nullptr;
+  if (const TypedefType *TDT = llvm::dyn_cast<TypedefType>(TypePtr)) {
+    Decl = TDT->getDecl();
+  } else {
+    // There are probably other cases ...
+    if (const TagType *TagDeclType = llvm::dyn_cast<TagType>(TypePtr))
+      Decl = TagDeclType->getDecl();
----------------
You don't need `llvm::` on `dyn_cast`. It's more idiomatic to use `const auto 
*TDT = dyn_cast<TypedefType>(TypePtr)` rather than repeating the type on both 
sides of the `=`.

================
Comment at: lib/Tooling/Core/QualTypeNames.cpp:310-316
@@ +309,9 @@
+    Decl = TDT->getDecl();
+  } else {
+    // There are probably other cases ...
+    if (const TagType *TagDeclType = llvm::dyn_cast<TagType>(TypePtr))
+      Decl = TagDeclType->getDecl();
+    else
+      Decl = TypePtr->getAsCXXRecordDecl();
+  }
+
----------------
Maybe drop the braces around this to form an `if`/`else if` chain.


http://reviews.llvm.org/D15861



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

Reply via email to