[cfe-dev] Why is TargetInfo.TargetOpts private?

Thomas Karos via cfe-dev cfe-dev at lists.llvm.org
Tue Apr 18 07:42:29 PDT 2017


Hi everybody,

I plan to use clang for some code analysis. Because of that, I was looking on how one can make clang use a custom ABI (overwrite some sizes, keep reasonable defaults for everything else).
But then I found Targets.cpp and now I got stuck.

The issue is as follows:
To get some instance of TargetInfo in which I can change things (lets say IntWidth), I need to derive from it. But then, I still cannot set the private member TargetOpts which is only set in CreateTargetInfo(). But this function I cannot use because I want to access protected fields. Not settings the pointer at all doesn't seem to be an option as well (asserts).

Is this intended and I am overseeing something? Or is there a way to do this?
Why is the TargetInfo stuff encapsulated that much anyway?

Thanks
Thomas

--------------------------------------------------------------------
Thomas Karos
AbsInt Angewandte Informatik GmbH
Science Park 1                   
66123 Saarbrücken                
GERMANY                          
--------------------------------------------------------------------
Geschäftsführung: Dr.-Ing. Christian Ferdinand
Eingetragen im Handelsregister des Amtsgerichts Saarbrücken, HRB 11234



More information about the cfe-dev mailing list