Replacement Function for addRequired<DataLayout>()

I’m debugging SAFECode source code files, trying to get them to compile, and in AllocatorInfo.h, the function addRequired() is preventing compilation and giving me the following error message:

In file included from /Users/peterfinn/Desktop/llvm_trunk_2/projects/safecode/lib/Support/AllocatorInfo.cpp:26:
In file included from /Users/peterfinn/Desktop/build/projects/safecode/…/…/…/llvm_trunk_2/projects/safecode/include/safecode/AllocatorInfo.h:21:
In file included from /Users/peterfinn/Desktop/llvm_trunk_2/include/llvm/IR/Module.h:20:
In file included from /Users/peterfinn/Desktop/llvm_trunk_2/include/llvm/IR/DataLayout.h:27:
In file included from /Users/peterfinn/Desktop/llvm_trunk_2/include/llvm/Pass.h:378:
/Users/peterfinn/Desktop/llvm_trunk_2/include/llvm/PassAnalysisSupport.h:56:37: error:
no member named ‘ID’ in 'llvm::DataLayout’
return addRequiredID(PassClass::ID);
^
/Users/peterfinn/Desktop/build/projects/safecode/…/…/…/llvm_trunk_2/projects/safecode/include/safecode/AllocatorInfo.h:219:10: note:
in instantiation of function template specialization
‘llvm::AnalysisUsage::addRequiredllvm::DataLayout’ requested here
AU.addRequired();
^
2 errors generated.
make[2]: *** [/Users/peterfinn/Desktop/build/projects/safecode/lib/Support/Debug+Asserts/AllocatorInfo.o] Error 1
make[1]: *** [Support/.makeall] Error 2
make: *** [all] Error 1

I understand this has something to do with the fact that DataLayout is no longer a Pass, and that it’s now just a class of its own. Is there a way I can fix the code so that it accomplishes what it’s supposed to? Is there a function I can call instead of what’s there?

Thank you,
Peter Finn

Remove the line.
It's no longer needed.
Anywhere that wants datalayout can just grab it (IE any like that has
DL = getAnalysis<DataLayout> can now just be DL =
F->getParent()->getDataLayout()" or something similar.

I’m debugging SAFECode source code files, trying to get them to compile, and in AllocatorInfo.h, the function addRequired() is preventing compilation and giving me the following error message:

In file included from /Users/peterfinn/Desktop/llvm_trunk_2/projects/safecode/lib/Support/AllocatorInfo.cpp:26:
In file included from /Users/peterfinn/Desktop/build/projects/safecode/…/…/…/llvm_trunk_2/projects/safecode/include/safecode/AllocatorInfo.h:21:
In file included from /Users/peterfinn/Desktop/llvm_trunk_2/include/llvm/IR/Module.h:20:
In file included from /Users/peterfinn/Desktop/llvm_trunk_2/include/llvm/IR/DataLayout.h:27:
In file included from /Users/peterfinn/Desktop/llvm_trunk_2/include/llvm/Pass.h:378:
/Users/peterfinn/Desktop/llvm_trunk_2/include/llvm/PassAnalysisSupport.h:56:37: error:
no member named ‘ID’ in 'llvm::DataLayout’
return addRequiredID(PassClass::ID);
^
/Users/peterfinn/Desktop/build/projects/safecode/…/…/…/llvm_trunk_2/projects/safecode/include/safecode/AllocatorInfo.h:219:10: note:
in instantiation of function template specialization
‘llvm::AnalysisUsage::addRequiredllvm::DataLayout’ requested here
AU.addRequired();
^
2 errors generated.
make[2]: *** [/Users/peterfinn/Desktop/build/projects/safecode/lib/Support/Debug+Asserts/AllocatorInfo.o] Error 1
make[1]: *** [Support/.makeall] Error 2
make: *** [all] Error 1

I understand this has something to do with the fact that DataLayout is no longer a Pass, and that it’s now just a class of its own. Is there a way I can fix the code so that it accomplishes what it’s supposed to? Is there a function I can call instead of what’s there?

DataLayout has never been a Pass AFAIK. There use to be a “DataLayoutPass”, but it has been removed since the Module owns the DataLayout, which is no longer optional. So wherever you have a handle to a Module you always have an associated DataLayout.

Best,

Mehdi