[LLVMdev] Replacement Function for addRequired<DataLayout>()

Mehdi Amini mehdi.amini at apple.com
Sun Jun 21 14:30:51 PDT 2015


> On Jun 21, 2015, at 11:28 AM, Peter Finn <peterdfinn at icloud.com> wrote:
> 
> I’m debugging SAFECode source code files, trying to get them to compile, and in AllocatorInfo.h, the function addRequired<DataLayout>() 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::addRequired<llvm::DataLayout>' requested here
>       AU.addRequired<DataLayout>();
>          ^
> 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


> 
> Thank you,
> Peter Finn
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150621/78e686f9/attachment.html>


More information about the llvm-dev mailing list