Skip to content

Commit e549c91

Browse files
Fix json syntax in TotalConstraintStats.json (#605)
* Fix json syntax in TotalConstraintStats.json An extra comma was added in this file when running 3c without -alltypes. Also adds a test case that checks the syntax in all generated json files.
1 parent e240faa commit e549c91

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

clang/lib/3C/ProgramInfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,11 @@ void ProgramInfo::printStats(const std::set<std::string> &F, raw_ostream &O,
353353
O << "\"BoundsStats\":";
354354
}
355355
ArrBInfo.printStats(O, InSrcCVars, JsonFormat);
356+
if (JsonFormat)
357+
O << ",";
356358
}
357359

358360
if (JsonFormat) {
359-
O << ",";
360361
O << "\"PerformanceStats\":";
361362
}
362363

clang/test/3C/json_formating.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: 3c -base-dir=%S -alltypes -dump-stats -dump-intermediate -debug-solver %s
2+
// RUN: python -c "import json, glob; [json.load(open(f)) for f in glob.glob('*.json')]"
3+
// RUN: 3c -base-dir=%S -dump-stats -dump-intermediate -debug-solver %s
4+
// RUN: python -c "import json, glob; [json.load(open(f)) for f in glob.glob('*.json')]"
5+
6+
// Testing that json files output for statistics logging are well formed
7+
8+
int *a;
9+
int *b(int *c);
10+
static int *d() { return 0; }
11+
void e(int *f, int len) { f[0]; }

0 commit comments

Comments
 (0)