Skip to content

Commit

Permalink
Fixed no-extension STL headers in some cases not being reported as he…
Browse files Browse the repository at this point in the history
…aders
  • Loading branch information
aras-p committed Aug 10, 2023
1 parent afa1337 commit 40b739a
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 98 deletions.
4 changes: 2 additions & 2 deletions projects/xcode/ClangBuildAnalyzer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -403,7 +403,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
Expand Down
3 changes: 2 additions & 1 deletion src/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ bool utils::EndsWith(const std::string_view& str, const std::string& suffix)
}


bool utils::IsHeader(const std::string_view& path)
bool utils::IsHeader(std::string_view path)
{
path = utils::GetFilename(path);
size_t dot = path.rfind('.');
if (dot == std::string::npos)
return true; // no extension is likely a header, e.g. <vector>
Expand Down
2 changes: 1 addition & 1 deletion src/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace utils
[[nodiscard]] std::string GetNicePath(const std::string_view& path);
[[nodiscard]] std::string_view GetFilename(const std::string_view& path);

[[nodiscard]] bool IsHeader(const std::string_view& path);
[[nodiscard]] bool IsHeader(std::string_view path);

void Lowercase(std::string& path);

Expand Down
33 changes: 16 additions & 17 deletions tests/self-win-clang-13.0/_AnalysisOutputExpected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,27 +166,26 @@ Compilation (8 times):
257 ms: src/external/simdjson/simdjson.h (included 1 times, avg 257 ms), included via:
BuildEvents.json (257 ms)

232 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30037/include/algorithm (included 4 times, avg 58 ms), included via:
Arena.json (188 ms)
main.json (14 ms)
BuildEvents.json bytell_hash_map.hpp (14 ms)
Analysis.json bytell_hash_map.hpp (14 ms)

226 ms: src/external/flat_hash_map/bytell_hash_map.hpp (included 2 times, avg 113 ms), included via:
Analysis.json (114 ms)
BuildEvents.json (112 ms)

159 ms: src/external/enkiTS/TaskScheduler.h (included 1 times, avg 159 ms), included via:
main.json (159 ms)

123 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0/ucrt/stdio.h (included 4 times, avg 30 ms), included via:
Analysis.h BuildEvents.h string xstring iosfwd cstdio (31 ms)
algorithm xmemory limits cwchar cstdio (30 ms)
Analysis.h BuildEvents.h string xstring iosfwd cstdio (30 ms)
BuildEvents.h string xstring iosfwd cstdio (30 ms)

64 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0/ucrt/wchar.h (included 4 times, avg 16 ms), included via:
algorithm xmemory limits cwchar (18 ms)
Analysis.h BuildEvents.h string xstring iosfwd cwchar (16 ms)
Analysis.h BuildEvents.h string xstring iosfwd cwchar (14 ms)
BuildEvents.h string xstring iosfwd cwchar (14 ms)

48 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30037/include/xpolymorphic_allocator.h (included 4 times, avg 12 ms), included via:
Analysis.h BuildEvents.h string xstring (12 ms)
vector (12 ms)
BuildEvents.h string xstring (12 ms)
Analysis.h BuildEvents.h string xstring (12 ms)
71 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30037/include/mutex (included 2 times, avg 35 ms), included via:
BuildEvents.json (51 ms)
main.json TaskScheduler.h condition_variable (19 ms)

52 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30037/include/vector (included 4 times, avg 13 ms), included via:
Arena.json (22 ms)
Analysis.json Analysis.h BuildEvents.h (10 ms)
main.json Analysis.h BuildEvents.h (10 ms)
BuildEvents.json BuildEvents.h (10 ms)

34 changes: 14 additions & 20 deletions tests/self-win-clang-cl-10.0rc2/_AnalysisOutputExpected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,30 +158,24 @@ Compilation (6 times):
282 ms: src/Analysis.h (included 1 times, avg 282 ms), included via:
main.json (282 ms)

131 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.18362.0/ucrt/stdio.h (included 3 times, avg 43 ms), included via:
BuildEvents.h string xstring iosfwd cstdio (46 ms)
algorithm xmemory limits cwchar cstdio (42 ms)
Analysis.h BuildEvents.h string xstring iosfwd cstdio (42 ms)
255 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.25.28610/include/algorithm (included 3 times, avg 85 ms), included via:
Allocator.json (233 ms)
BuildEvents.json sajson.h (12 ms)
main.json (10 ms)

70 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.18362.0/ucrt/wchar.h (included 3 times, avg 23 ms), included via:
algorithm xmemory limits cwchar (27 ms)
BuildEvents.h string xstring iosfwd cwchar (22 ms)
Analysis.h BuildEvents.h string xstring iosfwd cwchar (20 ms)
210 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.25.28610/include/iterator (included 1 times, avg 210 ms), included via:
BuildEvents.json (210 ms)

55 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.25.28610/include/unordered_map (included 1 times, avg 55 ms), included via:
BuildEvents.json (55 ms)

52 ms: src/external/sajson.h (included 1 times, avg 52 ms), included via:
BuildEvents.json (52 ms)

46 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.18362.0/ucrt/stdlib.h (included 3 times, avg 15 ms), included via:
algorithm xmemory cstdlib (17 ms)
BuildEvents.h string xstring iosfwd xstddef cstdlib (15 ms)
Analysis.h BuildEvents.h string xstring iosfwd xstddef cstdlib (13 ms)
41 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.25.28610/include/stdexcept (included 2 times, avg 20 ms), included via:
Allocator.json (38 ms)
BuildEvents.json iterator istream ostream ios xlocnum streambuf xiosbase system_error (2 ms)

38 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.18362.0/ucrt/string.h (included 3 times, avg 12 ms), included via:
BuildEvents.h string xstring iosfwd cstring (16 ms)
Analysis.h BuildEvents.h string xstring iosfwd cstring (15 ms)
algorithm xmemory xutility cstring (6 ms)
26 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.25.28610/include/map (included 1 times, avg 26 ms), included via:
main.json (26 ms)

37 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.18362.0/ucrt/math.h (included 3 times, avg 12 ms), included via:
BuildEvents.h string xstring iosfwd xstddef cstdlib (12 ms)
algorithm xmemory cstdlib (12 ms)
Analysis.h BuildEvents.h string xstring iosfwd xstddef cstdlib (12 ms)
35 changes: 4 additions & 31 deletions tests/self-win-clang-cl-9.0rc2/_AnalysisOutputExpected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,36 +140,9 @@ Compilation (3 times):
231 ms: src/Utils.h (included 1 times, avg 231 ms), included via:
Utils.json (231 ms)

77 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/ucrt/stdio.h (included 2 times, avg 38 ms), included via:
algorithm xmemory limits cwchar cstdio (39 ms)
Utils.h string xstring iosfwd cstdio (37 ms)
209 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.22.27905/include/algorithm (included 1 times, avg 209 ms), included via:
Allocator.json (209 ms)

46 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/ucrt/stdlib.h (included 3 times, avg 15 ms), included via:
Colors.json windows.h ole2.h objbase.h combaseapi.h (17 ms)
algorithm xmemory cstdlib (16 ms)
Utils.h string xstring iosfwd xstddef cstdlib (12 ms)
35 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.22.27905/include/stdexcept (included 1 times, avg 35 ms), included via:
Allocator.json (35 ms)

41 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/ucrt/wchar.h (included 2 times, avg 20 ms), included via:
algorithm xmemory limits cwchar (23 ms)
Utils.h string xstring iosfwd cwchar (17 ms)

32 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/ucrt/string.h (included 3 times, avg 10 ms), included via:
Utils.h string xstring iosfwd cstring (13 ms)
Colors.json windows.h windef.h minwindef.h winnt.h guiddef.h (13 ms)
algorithm xmemory xutility cstring (6 ms)

21 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/ucrt/math.h (included 2 times, avg 10 ms), included via:
algorithm xmemory cstdlib (10 ms)
Utils.h string xstring iosfwd xstddef cstdlib (10 ms)

21 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.22.27905/include/yvals.h (included 2 times, avg 10 ms), included via:
algorithm xmemory cstdint (10 ms)
Utils.h string xstring iosfwd (10 ms)

4 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.22.27905/include/vcruntime_exception.h (included 2 times, avg 2 ms), included via:
algorithm xmemory new exception (2 ms)
Utils.h string xstring xmemory new exception (2 ms)

3 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.22.27905/include/xatomic.h (included 2 times, avg 1 ms), included via:
algorithm xmemory (1 ms)
Utils.h string xstring xmemory (1 ms)
32 changes: 6 additions & 26 deletions tests/verylong-symbol-name-38/_AnalysisOutputExpected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,32 +82,12 @@ Compilation (2 times):
0 ms: void __cdecl std::_Deallocate<$>(void *, unsigned __int64) (1 times, avg 0 ms)

**** Expensive headers:
29 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/ucrt/stdio.h (included 1 times, avg 29 ms), included via:
string xstring iosfwd cstdio (29 ms)
191 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.25.28610/include/string (included 1 times, avg 191 ms), included via:
test.json (191 ms)

14 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/ucrt/wchar.h (included 1 times, avg 14 ms), included via:
string xstring iosfwd cwchar (14 ms)
19 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.25.28610/include/map (included 1 times, avg 19 ms), included via:
test.json (19 ms)

10 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/ucrt/string.h (included 1 times, avg 10 ms), included via:
string xstring iosfwd cstring (10 ms)
7 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.25.28610/include/vector (included 1 times, avg 7 ms), included via:
test.json (7 ms)

9 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/ucrt/stdlib.h (included 1 times, avg 9 ms), included via:
string xstring iosfwd xstddef cstdlib (9 ms)

7 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/ucrt/math.h (included 1 times, avg 7 ms), included via:
string xstring iosfwd xstddef cstdlib (7 ms)

6 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.25.28610/include/yvals_core.h (included 1 times, avg 6 ms), included via:
string (6 ms)

4 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.25.28610/include/yvals.h (included 1 times, avg 4 ms), included via:
string xstring iosfwd (4 ms)

1 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.25.28610/include/vcruntime_exception.h (included 1 times, avg 1 ms), included via:
string xstring xmemory new exception (1 ms)

1 ms: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.25.28610/include/xatomic.h (included 1 times, avg 1 ms), included via:
string xstring xmemory (1 ms)

1 ms: C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/ucrt/ctype.h (included 1 times, avg 1 ms), included via:
string cctype (1 ms)

0 comments on commit 40b739a

Please sign in to comment.