HomePhabricator

Move llvm/Analysis/ObjCARCUtil.h to IR to fix layering.

Authored by dblaikie on Mar 4 2021, 4:14 PM.

Description

Move llvm/Analysis/ObjCARCUtil.h to IR to fix layering.

This is included from IR files, and IR doesn't/can't depend on Analysis
(because Analysis depends on IR).

Also fix the implementation - don't use non-member static in headers, as
it leads to ODR violations, inaccurate "unused function" warnings, etc.
And fix the header protection macro name (we don't generally include
"LIB" in the names, so far as I can tell).

Details

Committed
dblaikieMar 4 2021, 4:14 PM
Parents
rGecdae5df7da0: [gn build] port b973e2e2f27e
Branches
Unknown
Tags
Unknown

Event Timeline

Is it possible that this broke module build?

ct/llvm/tools/llvm-pdbutil/PrettyCompilandDumper.cpp
While building module 'LLVM_DebugInfo_PDB' imported from /Users/teemperor/3llvm/llvm-project/llvm/tools/llvm-pdbutil/PrettyCompilandDumper.h:12:
While building module 'LLVM_DebugInfo' imported from /Users/teemperor/3llvm/llvm-project/llvm/include/llvm/DebugInfo/PDB/PDBContext.h:12:
While building module 'LLVM_Object' imported from /Users/teemperor/3llvm/llvm-project/llvm/include/llvm/DebugInfo/DIContext.h:18:
While building module 'LLVM_IR' imported from /Users/teemperor/3llvm/llvm-project/llvm/include/llvm/Object/ModuleSymbolTable.h:20:
While building module 'LLVM_intrinsic_gen' imported from /Users/teemperor/3llvm/llvm-project/llvm/include/llvm/IR/ObjCARCUtil.h:17:
In file included from <module-includes>:1:
/Users/teemperor/3llvm/llvm-project/llvm/include/llvm/IR/Argument.h:19:10: fatal error: cyclic dependency in module 'LLVM_IR': LLVM_IR -> LLVM_intrinsic_gen -> LLVM_IR
#include "llvm/IR/Value.h"
         ^
While building module 'LLVM_DebugInfo_PDB' imported from /Users/teemperor/3llvm/llvm-project/llvm/tools/llvm-pdbutil/PrettyCompilandDumper.h:12:
While building module 'LLVM_DebugInfo' imported from /Users/teemperor/3llvm/llvm-project/llvm/include/llvm/DebugInfo/PDB/PDBContext.h:12:
While building module 'LLVM_Object' imported from /Users/teemperor/3llvm/llvm-project/llvm/include/llvm/DebugInfo/DIContext.h:18:
While building module 'LLVM_IR' imported from /Users/teemperor/3llvm/llvm-project/llvm/include/llvm/Object/ModuleSymbolTable.h:20:
In file included from <module-includes>:23:
/Users/teemperor/3llvm/llvm-project/llvm/include/llvm/IR/ObjCARCUtil.h:17:10: fatal error: could not build module 'LLVM_intrinsic_gen'
#include "llvm/IR/InstrTypes.h"
 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

Is it possible that this broke module build?

ct/llvm/tools/llvm-pdbutil/PrettyCompilandDumper.cpp
While building module 'LLVM_DebugInfo_PDB' imported from /Users/teemperor/3llvm/llvm-project/llvm/tools/llvm-pdbutil/PrettyCompilandDumper.h:12:
While building module 'LLVM_DebugInfo' imported from /Users/teemperor/3llvm/llvm-project/llvm/include/llvm/DebugInfo/PDB/PDBContext.h:12:
While building module 'LLVM_Object' imported from /Users/teemperor/3llvm/llvm-project/llvm/include/llvm/DebugInfo/DIContext.h:18:
While building module 'LLVM_IR' imported from /Users/teemperor/3llvm/llvm-project/llvm/include/llvm/Object/ModuleSymbolTable.h:20:
While building module 'LLVM_intrinsic_gen' imported from /Users/teemperor/3llvm/llvm-project/llvm/include/llvm/IR/ObjCARCUtil.h:17:
In file included from <module-includes>:1:
/Users/teemperor/3llvm/llvm-project/llvm/include/llvm/IR/Argument.h:19:10: fatal error: cyclic dependency in module 'LLVM_IR': LLVM_IR -> LLVM_intrinsic_gen -> LLVM_IR
#include "llvm/IR/Value.h"
         ^
While building module 'LLVM_DebugInfo_PDB' imported from /Users/teemperor/3llvm/llvm-project/llvm/tools/llvm-pdbutil/PrettyCompilandDumper.h:12:
While building module 'LLVM_DebugInfo' imported from /Users/teemperor/3llvm/llvm-project/llvm/include/llvm/DebugInfo/PDB/PDBContext.h:12:
While building module 'LLVM_Object' imported from /Users/teemperor/3llvm/llvm-project/llvm/include/llvm/DebugInfo/DIContext.h:18:
While building module 'LLVM_IR' imported from /Users/teemperor/3llvm/llvm-project/llvm/include/llvm/Object/ModuleSymbolTable.h:20:
In file included from <module-includes>:23:
/Users/teemperor/3llvm/llvm-project/llvm/include/llvm/IR/ObjCARCUtil.h:17:10: fatal error: could not build module 'LLVM_intrinsic_gen'
#include "llvm/IR/InstrTypes.h"
 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

(+@ahatanak, the original author of ObjCARCUtil.h)

Possible this could've broken the modules build - I think @ahatanak was planning on moving the header back to Analysis anyway (& breaking the dependency on it) so that might address the modules build issue?

I'll move the header back to Analysis.