leonardchan added inline comments.
================ Comment at: clang-tools-extra/clang-doc/Representation.cpp:193-216 +llvm::SmallString<16> Info::extractFileName() { + switch (IT) { + case InfoType::IT_namespace: + // The case of anonymous namespaces is taken care of in serialization, so + // here we can safely assume an unnamed namespace is the global one. + return Name.empty() ? llvm::SmallString<16>("GlobalNamespace") : Name; + case InfoType::IT_record: ---------------- Nit: Check for `Name.empty()` early and return `Name` if it is empty, then have the switch stmt to avoid the repeated conditional expressions. ``` if (!Name.empty()) return Name switch () { case InfoType::IT_namespace: return llvm::SmallString<16>("GlobalNamespace"); ... } ``` ================ Comment at: clang-tools-extra/clang-doc/Serialize.cpp:280 + } else + N->getNameAsString(); + Namespaces.emplace_back(getUSRForDecl(N), Namespace, ---------------- Should this line be `Namespace = N->getNameAsString()`? https://reviews.llvm.org/D52847 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits