breyerml
breyerml

Reputation: 268

Wrong call/caller graph with Doxygen and GraphViz in C++

So I started to document a C++ project with Doxygen 1.8.13 (Windows 10, 64-bit) and encountered a problem with GraphViz's call/caller graph generation.

If a generate a documentation with the following code, Doxygen will generate a call graph that looks like:

call graph

But as the code shows, Path() doesn't call any function (empty body).

struct Path {
  Path(const Node* source_node, const Node* target_node, 
       const unsigned long cost, const std::vector<const Node*> path)
      : source_node(source_node), target_node(target_node), 
      cost(cost), path(path), length(path.size()) { };

  void printCompletePath(std::ostream& = std::cout) const;

  const Node* source_node = nullptr;
  const Node* target_node = nullptr;
  const unsigned long cost = 0;
  const std::vector<const Node*> path{};
  const std::vector<const Node*>::size_type length = 0;
};

But if I reorderd the code as follows, the call graph disappears (as intended):

struct Path {
  Path(const Node* source_node, const Node* target_node, 
       const unsigned long cost, const std::vector<const Node*> path)
      : source_node(source_node), target_node(target_node), 
      cost(cost), path(path), length(path.size()) { };

  const Node* source_node = nullptr;
  const Node* target_node = nullptr;
  const unsigned long cost = 0;
  const std::vector<const Node*> path{};
  const std::vector<const Node*>::size_type length = 0;

  void printCompletePath(std::ostream& = std::cout) const;
};

So is that a Doxygen and/or GraphViz bug? Or am I missing something? (I don't wanna reorder my source code just for Doxygen to work.)

Upvotes: 4

Views: 1067

Answers (1)

albert
albert

Reputation: 9077

With version 1.8.13 I could reproduce the problem regarding the call graph. With version 1.8.14 this wrong call graph is gone.

From the doxygen change log: Function declaration following a function definition incorrectly listed as calling dependencing [ https://github.com/doxygen/doxygen/commit/436fc7ed1158d517dd6f6d25aa3e05568f8c3d94 ]

Upvotes: 2

Related Questions