aras-p / ClangBuildAnalyzer

Clang build analysis tool using -ftime-trace
The Unlicense
969 stars 60 forks source link

Warning spam when there are completely unrelated JSON files in build folder #91

Open anthonyalayo opened 8 months ago

anthonyalayo commented 8 months ago

Hey there,

Is there support for Clang 14/15/16? I noticed your previous history of adding support for new Clang versions, and I'm noticing a lot of errors and a missing trace.json at the top level.

aras-p commented 8 months ago

Can you attach example of json file, and what kind of errors you get?

anthonyalayo commented 8 months ago

@aras-p thanks for the quick response, I'll be back at my computer in an hour and I'll get a dump for you.

anthonyalayo commented 8 months ago

@aras-p, came back home and tried a few things, and I realized this happens even with Clang 13.

❯ clang --version
Homebrew clang version 13.0.1
Target: arm64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /opt/homebrew/bin

❯ ninja --version
1.11.1

❯ cmake --version
cmake version 3.27.7

I added this to my library target (before the executable):

target_compile_options(${PROJECT_LIB_NAME} PRIVATE -ftime-trace)

Then I ran the following:

ClangBuildAnalyzer --all build output.bin

And I get this:

Processing all files and saving to 'output.bin'...
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error NUMBER_ERROR: Problem while parsing a number.
WARN: JSON parse error NUMBER_ERROR: Problem while parsing a number.
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error NUMBER_ERROR: Problem while parsing a number.
WARN: JSON parse error NUMBER_ERROR: Problem while parsing a number.
WARN: JSON parse error STRING_ERROR: Problem while parsing a string.
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error STRING_ERROR: Problem while parsing a string.
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error T_ATOM_ERROR: Problem while parsing an atom starting with the letter 't'.
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error UNESCAPED_CHARS: Within strings, some characters must be escaped, we found unescaped characters.
WARN: JSON parse error STRING_ERROR: Problem while parsing a string.
WARN: JSON parse error UNESCAPED_CHARS: Within strings, some characters must be escaped, we found unescaped characters.
WARN: JSON parse error UNESCAPED_CHARS: Within strings, some characters must be escaped, we found unescaped characters.
WARN: JSON parse error NUMBER_ERROR: Problem while parsing a number.
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error NUMBER_ERROR: Problem while parsing a number.
WARN: JSON parse error NUMBER_ERROR: Problem while parsing a number.
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error UNESCAPED_CHARS: Within strings, some characters must be escaped, we found unescaped characters.
WARN: JSON parse error UNESCAPED_CHARS: Within strings, some characters must be escaped, we found unescaped characters.
WARN: JSON parse error UNESCAPED_CHARS: Within strings, some characters must be escaped, we found unescaped characters.
WARN: JSON parse error UNESCAPED_CHARS: Within strings, some characters must be escaped, we found unescaped characters.
WARN: JSON parse error UNESCAPED_CHARS: Within strings, some characters must be escaped, we found unescaped characters.
WARN: JSON parse error UNESCAPED_CHARS: Within strings, some characters must be escaped, we found unescaped characters.
WARN: JSON parse error UNESCAPED_CHARS: Within strings, some characters must be escaped, we found unescaped characters.
WARN: JSON parse error UNESCAPED_CHARS: Within strings, some characters must be escaped, we found unescaped characters.
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error NUMBER_ERROR: Problem while parsing a number.
WARN: JSON parse error STRING_ERROR: Problem while parsing a string.
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error STRING_ERROR: Problem while parsing a string.
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error T_ATOM_ERROR: Problem while parsing an atom starting with the letter 't'.
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error DEPTH_ERROR: The JSON document was too deep (too many nested objects and arrays).
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error UNESCAPED_CHARS: Within strings, some characters must be escaped, we found unescaped characters.
WARN: JSON parse error STRING_ERROR: Problem while parsing a string.
WARN: JSON parse error UNESCAPED_CHARS: Within strings, some characters must be escaped, we found unescaped characters.
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error UNESCAPED_CHARS: Within strings, some characters must be escaped, we found unescaped characters.
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error NUMBER_ERROR: Problem while parsing a number.
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error NUMBER_ERROR: Problem while parsing a number.
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error NUMBER_ERROR: Problem while parsing a number.
WARN: JSON parse error NUMBER_ERROR: Problem while parsing a number.
WARN: JSON parse error NUMBER_ERROR: Problem while parsing a number.
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error NUMBER_ERROR: Problem while parsing a number.
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc..
  done in 3.6s. Run 'ClangBuildAnalyzer --analyze output.bin' to analyze it.

Am I perhaps doing something wrong? I noticed there is no top level JSON trace file.

anthonyalayo commented 8 months ago

Any idea what causes those @aras-p ?

aras-p commented 8 months ago

I just tested locally with clang 14 and clang 16, and everything seems to work as expected. Hard to say what goes wrong without seeing at least some of the json files that would be produced next to object files under your build folder.

e4lam commented 8 months ago

For the record, I get these too.

Processing all files and saving to 'buildAnalyze.bin'...
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure:
missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure:
missing or superfluous commas, braces, missing keys, etc..
WARN: JSON parse error F_ATOM_ERROR: Problem while parsing an atom starting with
 the letter 'f'.
WARN: JSON parse error TAPE_ERROR: The JSON document has an improper structure:
missing or superfluous commas, braces, missing keys, etc..
  done in 86.6s. Run 'ClangBuildAnalyzer --analyze buildAnalyze.bin' to analyze
it.
aras-p commented 8 months ago

And again, without knowing what is in these json files, it's hard to say what's going on

e4lam commented 8 months ago

So I updated to the latest code. It's because it's processing random json files part of my project that are not from clang :( Is there a way to specify a pattern to match when it does things recursively? I think something like *.C.json would work well for me.

anthonyalayo commented 8 months ago

nice find @e4lam , i think thats my problem too

alecazam commented 4 months ago

There are a whole bunch of json files, that Xcode dumps out to the build directories. clang is on all platforms now, so you didn't really state what platform you were building on.