IRToDWARF and IRForTarget current are subclasses of ModulePass. The constructors of these two methods look like the following:

/// Constructor
/// @param[in] pid
/// A unique identifier for this pass. I’m not sure what this does;
/// it just gets passed down to ModulePass’s constructor.
/// @param[in] decl_map
/// The list of externally-referenced variables for the expression,
/// for use in looking up globals and allocating the argument
/// struct. See the documentation for ClangExpressionDeclMap.
/// @param[in] target_data
/// The data layout information for the target. This information is
/// used to determine the sizes of types that have been lowered into
/// IR types.
IRForTarget(lldb_private::ClangExpressionDeclMap *decl_map, const llvm::TargetData *target_data) : ModulePass(pid);

Judging from ModulePasses from LLVM, the pid parameter should actually be the same char over all instances of this Pass. It’s basically a unique spot in memory. The following two patches implement this.

As an aside, I’m compiling LLDB against LLVM trunk (not the zip file), so this might need an update of that as well.

Bill Lynch

patch1.patch (1.37 KB)

patch2.patch (2.88 KB)


thanks! I applied your patch.