Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
llvm/include/llvm/MC/MCInstPrinter.h | ||
---|---|---|
12 | Can this be a forward reference? |
llvm/include/llvm/MC/MCInstPrinter.h | ||
---|---|---|
12 | Nope, it is passed by value in printRegName below (and also in generated getRegisterName). |
llvm/include/llvm/MC/MCInstPrinter.h | ||
---|---|---|
12 | I thought the forward reference would be ok since only the declaration of printRegName is here. Isn’t it only needed for the definition and the call sites? It’s late here so I might not be thinking clearly. |
llvm/include/llvm/MC/MCInstPrinter.h | ||
---|---|---|
12 | You're right. This code compiles without errors: class MCRegister; class MCInstPrinter { public: virtual void printRegName(MCRegister Reg); }; class MCRegister { public: MCRegister(unsigned); }; int main() { MCInstPrinter P; P.printRegName(MCRegister(0)); } That's a surprise to me. I thought it is only possible to do this with references and pointers. |
@craig.topper I've forward declared MCRegister and included MCRegister.h where absence of it caused compilation errors. This is not strictly IWYU; should I include it in other places too (it is sometimes transitively included by MCRegisterInfo.h / MCInstrInfo.h)?
llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.cpp | ||
---|---|---|
46 | Good idea, will do. |
Can this be a forward reference?