Tidy up some code of EmitCXXGlobalInitFunc() and EmitCXXGlobalDtorFunc()as the pre-work of [AIX][Frontend] Static init implementation for AIX considering no priority [https://reviews.llvm.org/D74166] patch.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/CodeGen/CGDeclCXX.cpp | ||
---|---|---|
596 | I think this patch is missing what @hubert.reinterpretcast mentioned in https://reviews.llvm.org/D74166?id=269900#inline-751064 if (CXXGlobalInits.empty()) return; |
clang/lib/CodeGen/CGDeclCXX.cpp | ||
---|---|---|
596 | Please double check the above early return is desired though. It seems even when CXXGlobalInits is empty, GenerateCXXGlobalInitFunc is trying to do a lot of things with Fn passed in. Later, we also called AddGlobalCtor(Fn). So a lot of behavior changes here, we want to make sure it's really 'NFC'. |
clang/lib/CodeGen/CGDeclCXX.cpp | ||
---|---|---|
596 | FYI, class test { public: test(); }; test t1 __attribute__((init_priority (300))); Compile with clang -target x86_64-apple-darwin10 -emit-llvm |
Remove early return part;
clang/lib/CodeGen/CGDeclCXX.cpp | ||
---|---|---|
596 | Thanks, I am gonna remove this part and keep it as a NFC patch. |
clang/lib/CodeGen/CGDeclCXX.cpp | ||
---|---|---|
600 | In the less complex context of this patch, it seems this should just initialize FileName with getTransformedFileName(getModule()) by having getTransformedFileName return a SmallString<128> directly instead of a StringRef backed by a SmallString<128>. I think this would still translate well to D74166. |
I think this patch is missing what @hubert.reinterpretcast mentioned in https://reviews.llvm.org/D74166?id=269900#inline-751064
which is an early return like this: