zturner added inline comments.

================
Comment at: clang-tidy-vs/ClangTidy/CheckTree.cs:67
@@ +66,3 @@
+                if (ParentPath == null)
+                    return Name_;
+                return ParentPath + "-" + Name_;
----------------
amccarth wrote:
> This seems overly complicated so I assume I'm missing some nuance.  Why not:
> 
>     if (Parent_ == null)
>         return Name_;
>     string ParentPath = Parent_.Path;
> 
> Is there a case where Parent_.Path could return null besides the one that you 
> created?
> 
> 
If `Parent_ == null`, that is the root note, or default node.  It doesn't 
represent any particualr check, it's just the node at the top of the tree 
containing all the branches.  So we have to return `null` in that case.  We 
could probably return `Name_` as it would probably be equal to `null`, but it 
seems more clear to just return a constant.

Even if `Parent_` is not `null` though, `Parent_.Path` could equal `null`.  
This would happen for any node immediately under the root, because the parent 
would be the root, and by the previous explanation, `Parent_.Path` would then 
return `null`.  So, for top-level check nodes we just want to return the name, 
because there is nothing before it to prepend a `-` to.

For deeper nodes though, we want to get the path from the parent, then join it 
with a `-`.  


https://reviews.llvm.org/D23848



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

Reply via email to