You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the repro case below, you will observe in the traces that 2.h shows up as an inclusion under 1.h instead of being an inclusion of main/cpp. The addition of a dummy forward declaration at the end of 1.h is a workaround to the problem and will yield the correct result with 2.h being under main.cpp. In both case, 3.h remains under 2.h accordingly.
main.cpp
#include"1.h"
#include"2.h"intfoo();
1.h
#pragma once
#include<vector>structLARGE {};
template <typename T> autoZero() -> T { return T{}; }
#if defined GUARD
structguard;
#endif
2.h
#pragma once
#include"3.h"
#include<map>structBla {};
3.h
#pragma once
#include<algorithm>structFoo {};
To produce the incorrect time trace : clang -ftime-trace main.cpp -c -o main-wrong.o
To produce the correct time trace : clang -DGUARD -ftime-trace main.cpp -c -o main-right.o