[LLVMdev] Incomplete X86MachineFunctionInfo type
Howard Hinnant
hhinnant at apple.com
Sat Nov 14 15:23:38 PST 2009
In lib/Target/X86/X86COFFMachineModuleInfo.h we have:
class X86MachineFunctionInfo;
...
class X86COFFMachineModuleInfo : public MachineModuleInfoImpl {
...
typedef std::map<const Function*, X86MachineFunctionInfo>
FMFInfoMap;
FMFInfoMap FunctionInfoMap;
...
};
At this point in the translation unit X86MachineFunctionInfo is an
incomplete type, yet it is being used to instantiate std::map. This
is undefined behavior in C++03 (and C++0X) according to:
17.4.3.6 - Other functions [lib.res.on.functions], p2, b5
Unfortunately I am not familiar enough with this code to recommend a
fix. However I do know that this will create portability problems
with llvm. X86MachineFunctionInfo must not be incomplete at the point
it is used to instantiate std::map.
-Howard
More information about the llvm-dev
mailing list