[PATCH] D25065: [change-namespace] Fixed a bug in getShortestQualifiedNameInNamespace.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 4 04:53:39 PDT 2016


hokein added inline comments.


> ChangeNamespace.cpp:176
> +// \param DeclName A fully qualified name, "::a::b::X" or "a::b::X".
> +// \param NsName A fully qualified name, "::a::b" or "a::b".
>  std::string getShortestQualifiedNameInNamespace(llvm::StringRef DeclName,

Mightbe add a small doc saying `NsName` is a global namespace if it is empty. (If I misunderstand the code).

> ChangeNamespace.cpp:187
>    while (true) {
> +    if (DeclName.consume_front((NsName + "::").str()))
> +      return DeclName.str();

I think the statement doesn't compile here, since `consume_front` return a `bool`. It should be `if (DeclName.consume_front((NsName + "::")))`?

Looks like we can also put this judge into the above `while` statement?

https://reviews.llvm.org/D25065





More information about the cfe-commits mailing list