Skip to content

Commit 80c1e82

Browse files
committed
Improve graph printing.
This patch forces DynamicGraph::dump to be used and thus present in the binary where we can use it from a debugger.
1 parent 584eb31 commit 80c1e82

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

lib/Differentiator/DiffPlanner.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,10 @@ namespace clad {
608608

609609
void DiffRequest::print(llvm::raw_ostream& Out) const {
610610
Out << '<';
611-
PrintingPolicy Policy(Function->getASTContext().getLangOpts());
612-
Function->getNameForDiagnostic(Out, Policy, /*Qualified=*/true);
611+
PrintingPolicy P(Function->getASTContext().getLangOpts());
612+
P.TerseOutput = true;
613+
P.FullyQualifiedName = true;
614+
Function->print(Out, P, /*Indentation=*/0, /*PrintInstantiation=*/true);
613615
Out << ">[name=" << BaseFunctionName << ", "
614616
<< "order=" << CurrentDerivativeOrder << ", "
615617
<< "mode=" << DiffModeToString(Mode);

test/Misc/TimingsReport.C

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
#include "clad/Differentiator/Differentiator.h"
66
// CHECK: Timers for Clad Funcs
77
// CHECK_STATS: *** INFORMATION ABOUT THE DIFF REQUESTS
8-
// CHECK_STATS-NEXT: <test1>[name=test1, order=1, mode=forward]: #0 (source), (done)
9-
// CHECK_STATS-NEXT: <test2>[name=test2, order=1, mode=reverse]: #1 (source), (done)
10-
// CHECK_STATS-NEXT: <nested1>[name=nested1, order=1, mode=pushforward]: #2, (done)
11-
// CHECK_STATS-NEXT: <nested2>[name=nested2, order=1, mode=pullback]: #3, (done)
8+
// CHECK_STATS-NEXT: <double test1(double x, double y)>[name=test1, order=1, mode=forward]: #0 (source), (done)
9+
// CHECK_STATS-NEXT: <double test2(double a, double b)>[name=test2, order=1, mode=reverse]: #1 (source), (done)
10+
// CHECK_STATS-NEXT: <double nested1(double c)>[name=nested1, order=1, mode=pushforward]: #2, (done)
11+
// CHECK_STATS-NEXT: <double nested2(double z)>[name=nested2, order=1, mode=pullback]: #3, (done)
1212
// CHECK_STATS-NEXT: 0 -> 2
1313
// CHECK_STATS-NEXT: 1 -> 3
1414

15-
// CHECK_STATS_TBR: <test1>[name=test1, order=1, mode=forward, tbr]: #0 (source), (done)
15+
// CHECK_STATS_TBR: <double test1(double x, double y)>[name=test1, order=1, mode=forward, tbr]: #0 (source), (done)
1616

1717
double nested1(double c){
1818
return c*3*c;

tools/ClangPlugin.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ namespace clad {
527527

528528
// Print the graph of the diff requests.
529529
llvm::errs() << "\n*** INFORMATION ABOUT THE DIFF REQUESTS\n";
530-
m_DiffRequestGraph.print(std::cerr);
530+
m_DiffRequestGraph.dump();
531531

532532
m_Multiplexer->PrintStats();
533533
}

0 commit comments

Comments
 (0)