This is an archive of the discontinued LLVM Phabricator instance.

[SyntaxTree][NFC] Append "get" to syntax Nodes accessor names
ClosedPublic

Authored by eduucaldas on Aug 26 2020, 10:43 PM.

Diff Detail

Event Timeline

eduucaldas created this revision.Aug 26 2020, 10:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 26 2020, 10:43 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
eduucaldas requested review of this revision.Aug 26 2020, 10:43 PM

It's worth noting that accessors in the base APIs don't follow this rule. Should we refactor them as well? In this patch?
Examples:

class Arena {
public:
  const SourceManager &sourceManager() const { return SourceMgr; }
  const LangOptions &langOptions() const { return LangOpts; }
  const TokenBuffer &tokenBuffer() const;
  std::pair<FileID, ArrayRef<Token>>
  lexBuffer(std::unique_ptr<llvm::MemoryBuffer> Buffer);
class Node {
public:
  NodeKind kind() const { return static_cast<NodeKind>(Kind); }
  NodeRole role() const { return static_cast<NodeRole>(Role); }
  Tree *parent() { return Parent; }
  Node *nextSibling() { return NextSibling; }
class Leaf final : public Node {
public:
  const Token *token() const { return Tok; }
};
class Tree : public Node {
public:
  Node *firstChild() { return FirstChild; }
  Leaf *firstLeaf();
  Leaf *lastLeaf();
gribozavr2 accepted this revision.Aug 27 2020, 4:06 AM

It's worth noting that accessors in the base APIs don't follow this rule. Should we refactor them as well?

I'd say yes.

In this patch?

Up to you.

This revision is now accepted and ready to land.Aug 27 2020, 4:06 AM
This revision was landed with ongoing or failed builds.Aug 27 2020, 5:55 AM
This revision was automatically updated to reflect the committed changes.