1 //===-- llvm/MC/MCObjectFileInfo.h - Object File Info -----------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file describes common object file formats.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_MC_MCOBJECTFILEINFO_H
14 #define LLVM_MC_MCOBJECTFILEINFO_H
15 
16 #include "llvm/BinaryFormat/Swift.h"
17 #include "llvm/MC/MCSection.h"
18 #include "llvm/Support/VersionTuple.h"
19 #include "llvm/TargetParser/Triple.h"
20 
21 #include <array>
22 #include <optional>
23 
24 namespace llvm {
25 class MCContext;
26 class MCSection;
27 
28 class MCObjectFileInfo {
29 protected:
30   /// True if target object file supports a weak_definition of constant 0 for an
31   /// omitted EH frame.
32   bool SupportsWeakOmittedEHFrame = false;
33 
34   /// True if the target object file supports emitting a compact unwind section
35   /// without an associated EH frame section.
36   bool SupportsCompactUnwindWithoutEHFrame = false;
37 
38   /// OmitDwarfIfHaveCompactUnwind - True if the target object file
39   /// supports having some functions with compact unwind and other with
40   /// dwarf unwind.
41   bool OmitDwarfIfHaveCompactUnwind = false;
42 
43   /// FDE CFI encoding. Controls the encoding of the begin label in the
44   /// .eh_frame section. Unlike the LSDA encoding, personality encoding, and
45   /// type encodings, this is something that the assembler just "knows" about
46   /// its target
47   unsigned FDECFIEncoding = 0;
48 
49   /// Compact unwind encoding indicating that we should emit only an EH frame.
50   unsigned CompactUnwindDwarfEHFrameOnly = 0;
51 
52   /// Section directive for standard text.
53   MCSection *TextSection = nullptr;
54 
55   /// Section directive for standard data.
56   MCSection *DataSection = nullptr;
57 
58   /// Section that is default initialized to zero.
59   MCSection *BSSSection = nullptr;
60 
61   /// Section that is readonly and can contain arbitrary initialized data.
62   /// Targets are not required to have a readonly section. If they don't,
63   /// various bits of code will fall back to using the data section for
64   /// constants.
65   MCSection *ReadOnlySection = nullptr;
66 
67   /// If exception handling is supported by the target, this is the section the
68   /// Language Specific Data Area information is emitted to.
69   MCSection *LSDASection = nullptr;
70 
71   /// If exception handling is supported by the target and the target can
72   /// support a compact representation of the CIE and FDE, this is the section
73   /// to emit them into.
74   MCSection *CompactUnwindSection = nullptr;
75 
76   // Dwarf sections for debug info.  If a target supports debug info, these must
77   // be set.
78   MCSection *DwarfAbbrevSection = nullptr;
79   MCSection *DwarfInfoSection = nullptr;
80   MCSection *DwarfLineSection = nullptr;
81   MCSection *DwarfLineStrSection = nullptr;
82   MCSection *DwarfFrameSection = nullptr;
83   MCSection *DwarfPubTypesSection = nullptr;
84   const MCSection *DwarfDebugInlineSection = nullptr;
85   MCSection *DwarfStrSection = nullptr;
86   MCSection *DwarfLocSection = nullptr;
87   MCSection *DwarfARangesSection = nullptr;
88   MCSection *DwarfRangesSection = nullptr;
89   MCSection *DwarfMacinfoSection = nullptr;
90   MCSection *DwarfMacroSection = nullptr;
91   // The pubnames section is no longer generated by default.  The generation
92   // can be enabled by a compiler flag.
93   MCSection *DwarfPubNamesSection = nullptr;
94 
95   /// Accelerator table sections. DwarfDebugNamesSection is the DWARF v5
96   /// accelerator table, while DwarfAccelNamesSection, DwarfAccelObjCSection,
97   /// DwarfAccelNamespaceSection, DwarfAccelTypesSection are pre-DWARF v5
98   /// extensions.
99   MCSection *DwarfDebugNamesSection = nullptr;
100   MCSection *DwarfAccelNamesSection = nullptr;
101   MCSection *DwarfAccelObjCSection = nullptr;
102   MCSection *DwarfAccelNamespaceSection = nullptr;
103   MCSection *DwarfAccelTypesSection = nullptr;
104 
105   // These are used for the Fission separate debug information files.
106   MCSection *DwarfInfoDWOSection = nullptr;
107   MCSection *DwarfTypesDWOSection = nullptr;
108   MCSection *DwarfAbbrevDWOSection = nullptr;
109   MCSection *DwarfStrDWOSection = nullptr;
110   MCSection *DwarfLineDWOSection = nullptr;
111   MCSection *DwarfLocDWOSection = nullptr;
112   MCSection *DwarfStrOffDWOSection = nullptr;
113   MCSection *DwarfMacinfoDWOSection = nullptr;
114   MCSection *DwarfMacroDWOSection = nullptr;
115 
116   /// The DWARF v5 string offset and address table sections.
117   MCSection *DwarfStrOffSection = nullptr;
118   MCSection *DwarfAddrSection = nullptr;
119   /// The DWARF v5 range list section.
120   MCSection *DwarfRnglistsSection = nullptr;
121   /// The DWARF v5 locations list section.
122   MCSection *DwarfLoclistsSection = nullptr;
123 
124   /// The DWARF v5 range and location list sections for fission.
125   MCSection *DwarfRnglistsDWOSection = nullptr;
126   MCSection *DwarfLoclistsDWOSection = nullptr;
127 
128   // These are for Fission DWP files.
129   MCSection *DwarfCUIndexSection = nullptr;
130   MCSection *DwarfTUIndexSection = nullptr;
131 
132   /// Section for newer gnu pubnames.
133   MCSection *DwarfGnuPubNamesSection = nullptr;
134   /// Section for newer gnu pubtypes.
135   MCSection *DwarfGnuPubTypesSection = nullptr;
136 
137   // Section for Swift AST
138   MCSection *DwarfSwiftASTSection = nullptr;
139 
140   MCSection *COFFDebugSymbolsSection = nullptr;
141   MCSection *COFFDebugTypesSection = nullptr;
142   MCSection *COFFGlobalTypeHashesSection = nullptr;
143 
144   /// Extra TLS Variable Data section.
145   ///
146   /// If the target needs to put additional information for a TLS variable,
147   /// it'll go here.
148   MCSection *TLSExtraDataSection = nullptr;
149 
150   /// Section directive for Thread Local data. ELF, MachO, COFF, and Wasm.
151   MCSection *TLSDataSection = nullptr; // Defaults to ".tdata".
152 
153   /// Section directive for Thread Local uninitialized data.
154   ///
155   /// Null if this target doesn't support a BSS section. ELF and MachO only.
156   MCSection *TLSBSSSection = nullptr; // Defaults to ".tbss".
157 
158   /// StackMap section.
159   MCSection *StackMapSection = nullptr;
160 
161   /// FaultMap section.
162   MCSection *FaultMapSection = nullptr;
163 
164   /// Remarks section.
165   MCSection *RemarksSection = nullptr;
166 
167   /// EH frame section.
168   ///
169   /// It is initialized on demand so it can be overwritten (with uniquing).
170   MCSection *EHFrameSection = nullptr;
171 
172   /// Section containing metadata on function stack sizes.
173   MCSection *StackSizesSection = nullptr;
174 
175   /// Section for pseudo probe information used by AutoFDO
176   MCSection *PseudoProbeSection = nullptr;
177   MCSection *PseudoProbeDescSection = nullptr;
178 
179   // Section for metadata of llvm statistics.
180   MCSection *LLVMStatsSection = nullptr;
181 
182   // ELF specific sections.
183   MCSection *DataRelROSection = nullptr;
184   MCSection *MergeableConst4Section = nullptr;
185   MCSection *MergeableConst8Section = nullptr;
186   MCSection *MergeableConst16Section = nullptr;
187   MCSection *MergeableConst32Section = nullptr;
188 
189   // MachO specific sections.
190 
191   /// Section for thread local structure information.
192   ///
193   /// Contains the source code name of the variable, visibility and a pointer to
194   /// the initial value (.tdata or .tbss).
195   MCSection *TLSTLVSection = nullptr; // Defaults to ".tlv".
196 
197   /// Section for thread local data initialization functions.
198    // Defaults to ".thread_init_func".
199   const MCSection *TLSThreadInitSection = nullptr;
200 
201   MCSection *CStringSection = nullptr;
202   MCSection *UStringSection = nullptr;
203   MCSection *TextCoalSection = nullptr;
204   MCSection *ConstTextCoalSection = nullptr;
205   MCSection *ConstDataSection = nullptr;
206   MCSection *DataCoalSection = nullptr;
207   MCSection *ConstDataCoalSection = nullptr;
208   MCSection *DataCommonSection = nullptr;
209   MCSection *DataBSSSection = nullptr;
210   MCSection *FourByteConstantSection = nullptr;
211   MCSection *EightByteConstantSection = nullptr;
212   MCSection *SixteenByteConstantSection = nullptr;
213   MCSection *LazySymbolPointerSection = nullptr;
214   MCSection *NonLazySymbolPointerSection = nullptr;
215   MCSection *ThreadLocalPointerSection = nullptr;
216   MCSection *AddrSigSection = nullptr;
217 
218   /// COFF specific sections.
219   MCSection *DrectveSection = nullptr;
220   MCSection *PDataSection = nullptr;
221   MCSection *XDataSection = nullptr;
222   MCSection *SXDataSection = nullptr;
223   MCSection *GEHContSection = nullptr;
224   MCSection *GFIDsSection = nullptr;
225   MCSection *GIATsSection = nullptr;
226   MCSection *GLJMPSection = nullptr;
227 
228   // GOFF specific sections.
229   MCSection *PPA1Section = nullptr;
230   MCSection *PPA2Section = nullptr;
231   MCSection *ADASection = nullptr;
232   MCSection *IDRLSection = nullptr;
233 
234   // XCOFF specific sections
235   MCSection *TOCBaseSection = nullptr;
236   MCSection *ReadOnly8Section = nullptr;
237   MCSection *ReadOnly16Section = nullptr;
238 
239   // Swift5 Reflection Data Sections
240   std::array<MCSection *, binaryformat::Swift5ReflectionSectionKind::last>
241       Swift5ReflectionSections = {};
242 
243 public:
244   void initMCObjectFileInfo(MCContext &MCCtx, bool PIC,
245                             bool LargeCodeModel = false);
246   virtual ~MCObjectFileInfo();
getContext()247   MCContext &getContext() const { return *Ctx; }
248 
getSupportsWeakOmittedEHFrame()249   bool getSupportsWeakOmittedEHFrame() const {
250     return SupportsWeakOmittedEHFrame;
251   }
getSupportsCompactUnwindWithoutEHFrame()252   bool getSupportsCompactUnwindWithoutEHFrame() const {
253     return SupportsCompactUnwindWithoutEHFrame;
254   }
getOmitDwarfIfHaveCompactUnwind()255   bool getOmitDwarfIfHaveCompactUnwind() const {
256     return OmitDwarfIfHaveCompactUnwind;
257   }
258 
getFDEEncoding()259   unsigned getFDEEncoding() const { return FDECFIEncoding; }
260 
getCompactUnwindDwarfEHFrameOnly()261   unsigned getCompactUnwindDwarfEHFrameOnly() const {
262     return CompactUnwindDwarfEHFrameOnly;
263   }
264 
getTextSectionAlignment()265   virtual unsigned getTextSectionAlignment() const { return 4; }
getTextSection()266   MCSection *getTextSection() const { return TextSection; }
getDataSection()267   MCSection *getDataSection() const { return DataSection; }
getBSSSection()268   MCSection *getBSSSection() const { return BSSSection; }
getReadOnlySection()269   MCSection *getReadOnlySection() const { return ReadOnlySection; }
getLSDASection()270   MCSection *getLSDASection() const { return LSDASection; }
getCompactUnwindSection()271   MCSection *getCompactUnwindSection() const { return CompactUnwindSection; }
getDwarfAbbrevSection()272   MCSection *getDwarfAbbrevSection() const { return DwarfAbbrevSection; }
getDwarfInfoSection()273   MCSection *getDwarfInfoSection() const { return DwarfInfoSection; }
getDwarfInfoSection(uint64_t Hash)274   MCSection *getDwarfInfoSection(uint64_t Hash) const {
275     return getDwarfComdatSection(".debug_info", Hash);
276   }
getDwarfLineSection()277   MCSection *getDwarfLineSection() const { return DwarfLineSection; }
getDwarfLineStrSection()278   MCSection *getDwarfLineStrSection() const { return DwarfLineStrSection; }
getDwarfFrameSection()279   MCSection *getDwarfFrameSection() const { return DwarfFrameSection; }
getDwarfPubNamesSection()280   MCSection *getDwarfPubNamesSection() const { return DwarfPubNamesSection; }
getDwarfPubTypesSection()281   MCSection *getDwarfPubTypesSection() const { return DwarfPubTypesSection; }
getDwarfGnuPubNamesSection()282   MCSection *getDwarfGnuPubNamesSection() const {
283     return DwarfGnuPubNamesSection;
284   }
getDwarfGnuPubTypesSection()285   MCSection *getDwarfGnuPubTypesSection() const {
286     return DwarfGnuPubTypesSection;
287   }
getDwarfDebugInlineSection()288   const MCSection *getDwarfDebugInlineSection() const {
289     return DwarfDebugInlineSection;
290   }
getDwarfStrSection()291   MCSection *getDwarfStrSection() const { return DwarfStrSection; }
getDwarfLocSection()292   MCSection *getDwarfLocSection() const { return DwarfLocSection; }
getDwarfARangesSection()293   MCSection *getDwarfARangesSection() const { return DwarfARangesSection; }
getDwarfRangesSection()294   MCSection *getDwarfRangesSection() const { return DwarfRangesSection; }
getDwarfRnglistsSection()295   MCSection *getDwarfRnglistsSection() const { return DwarfRnglistsSection; }
getDwarfLoclistsSection()296   MCSection *getDwarfLoclistsSection() const { return DwarfLoclistsSection; }
getDwarfMacinfoSection()297   MCSection *getDwarfMacinfoSection() const { return DwarfMacinfoSection; }
getDwarfMacroSection()298   MCSection *getDwarfMacroSection() const { return DwarfMacroSection; }
299 
getDwarfDebugNamesSection()300   MCSection *getDwarfDebugNamesSection() const {
301     return DwarfDebugNamesSection;
302   }
getDwarfAccelNamesSection()303   MCSection *getDwarfAccelNamesSection() const {
304     return DwarfAccelNamesSection;
305   }
getDwarfAccelObjCSection()306   MCSection *getDwarfAccelObjCSection() const { return DwarfAccelObjCSection; }
getDwarfAccelNamespaceSection()307   MCSection *getDwarfAccelNamespaceSection() const {
308     return DwarfAccelNamespaceSection;
309   }
getDwarfAccelTypesSection()310   MCSection *getDwarfAccelTypesSection() const {
311     return DwarfAccelTypesSection;
312   }
getDwarfInfoDWOSection()313   MCSection *getDwarfInfoDWOSection() const { return DwarfInfoDWOSection; }
getDwarfTypesSection(uint64_t Hash)314   MCSection *getDwarfTypesSection(uint64_t Hash) const {
315     return getDwarfComdatSection(".debug_types", Hash);
316   }
getDwarfTypesDWOSection()317   MCSection *getDwarfTypesDWOSection() const { return DwarfTypesDWOSection; }
getDwarfAbbrevDWOSection()318   MCSection *getDwarfAbbrevDWOSection() const { return DwarfAbbrevDWOSection; }
getDwarfStrDWOSection()319   MCSection *getDwarfStrDWOSection() const { return DwarfStrDWOSection; }
getDwarfLineDWOSection()320   MCSection *getDwarfLineDWOSection() const { return DwarfLineDWOSection; }
getDwarfLocDWOSection()321   MCSection *getDwarfLocDWOSection() const { return DwarfLocDWOSection; }
getDwarfStrOffDWOSection()322   MCSection *getDwarfStrOffDWOSection() const { return DwarfStrOffDWOSection; }
getDwarfStrOffSection()323   MCSection *getDwarfStrOffSection() const { return DwarfStrOffSection; }
getDwarfAddrSection()324   MCSection *getDwarfAddrSection() const { return DwarfAddrSection; }
getDwarfRnglistsDWOSection()325   MCSection *getDwarfRnglistsDWOSection() const {
326     return DwarfRnglistsDWOSection;
327   }
getDwarfLoclistsDWOSection()328   MCSection *getDwarfLoclistsDWOSection() const {
329     return DwarfLoclistsDWOSection;
330   }
getDwarfMacroDWOSection()331   MCSection *getDwarfMacroDWOSection() const { return DwarfMacroDWOSection; }
getDwarfMacinfoDWOSection()332   MCSection *getDwarfMacinfoDWOSection() const {
333     return DwarfMacinfoDWOSection;
334   }
getDwarfCUIndexSection()335   MCSection *getDwarfCUIndexSection() const { return DwarfCUIndexSection; }
getDwarfTUIndexSection()336   MCSection *getDwarfTUIndexSection() const { return DwarfTUIndexSection; }
getDwarfSwiftASTSection()337   MCSection *getDwarfSwiftASTSection() const { return DwarfSwiftASTSection; }
338 
getCOFFDebugSymbolsSection()339   MCSection *getCOFFDebugSymbolsSection() const {
340     return COFFDebugSymbolsSection;
341   }
getCOFFDebugTypesSection()342   MCSection *getCOFFDebugTypesSection() const {
343     return COFFDebugTypesSection;
344   }
getCOFFGlobalTypeHashesSection()345   MCSection *getCOFFGlobalTypeHashesSection() const {
346     return COFFGlobalTypeHashesSection;
347   }
348 
getTLSExtraDataSection()349   MCSection *getTLSExtraDataSection() const { return TLSExtraDataSection; }
getTLSDataSection()350   const MCSection *getTLSDataSection() const { return TLSDataSection; }
getTLSBSSSection()351   MCSection *getTLSBSSSection() const { return TLSBSSSection; }
352 
getStackMapSection()353   MCSection *getStackMapSection() const { return StackMapSection; }
getFaultMapSection()354   MCSection *getFaultMapSection() const { return FaultMapSection; }
getRemarksSection()355   MCSection *getRemarksSection() const { return RemarksSection; }
356 
357   MCSection *getStackSizesSection(const MCSection &TextSec) const;
358 
359   MCSection *getBBAddrMapSection(const MCSection &TextSec) const;
360 
361   MCSection *getKCFITrapSection(const MCSection &TextSec) const;
362 
363   MCSection *getPseudoProbeSection(const MCSection &TextSec) const;
364 
365   MCSection *getPseudoProbeDescSection(StringRef FuncName) const;
366 
367   MCSection *getLLVMStatsSection() const;
368 
369   MCSection *getPCSection(StringRef Name, const MCSection *TextSec) const;
370 
371   // ELF specific sections.
getDataRelROSection()372   MCSection *getDataRelROSection() const { return DataRelROSection; }
getMergeableConst4Section()373   const MCSection *getMergeableConst4Section() const {
374     return MergeableConst4Section;
375   }
getMergeableConst8Section()376   const MCSection *getMergeableConst8Section() const {
377     return MergeableConst8Section;
378   }
getMergeableConst16Section()379   const MCSection *getMergeableConst16Section() const {
380     return MergeableConst16Section;
381   }
getMergeableConst32Section()382   const MCSection *getMergeableConst32Section() const {
383     return MergeableConst32Section;
384   }
385 
386   // MachO specific sections.
getTLSTLVSection()387   const MCSection *getTLSTLVSection() const { return TLSTLVSection; }
getTLSThreadInitSection()388   const MCSection *getTLSThreadInitSection() const {
389     return TLSThreadInitSection;
390   }
getCStringSection()391   const MCSection *getCStringSection() const { return CStringSection; }
getUStringSection()392   const MCSection *getUStringSection() const { return UStringSection; }
getTextCoalSection()393   MCSection *getTextCoalSection() const { return TextCoalSection; }
getConstTextCoalSection()394   const MCSection *getConstTextCoalSection() const {
395     return ConstTextCoalSection;
396   }
getConstDataSection()397   const MCSection *getConstDataSection() const { return ConstDataSection; }
getDataCoalSection()398   const MCSection *getDataCoalSection() const { return DataCoalSection; }
getConstDataCoalSection()399   const MCSection *getConstDataCoalSection() const {
400     return ConstDataCoalSection;
401   }
getDataCommonSection()402   const MCSection *getDataCommonSection() const { return DataCommonSection; }
getDataBSSSection()403   MCSection *getDataBSSSection() const { return DataBSSSection; }
getFourByteConstantSection()404   const MCSection *getFourByteConstantSection() const {
405     return FourByteConstantSection;
406   }
getEightByteConstantSection()407   const MCSection *getEightByteConstantSection() const {
408     return EightByteConstantSection;
409   }
getSixteenByteConstantSection()410   const MCSection *getSixteenByteConstantSection() const {
411     return SixteenByteConstantSection;
412   }
getLazySymbolPointerSection()413   MCSection *getLazySymbolPointerSection() const {
414     return LazySymbolPointerSection;
415   }
getNonLazySymbolPointerSection()416   MCSection *getNonLazySymbolPointerSection() const {
417     return NonLazySymbolPointerSection;
418   }
getThreadLocalPointerSection()419   MCSection *getThreadLocalPointerSection() const {
420     return ThreadLocalPointerSection;
421   }
getAddrSigSection()422   MCSection *getAddrSigSection() const { return AddrSigSection; }
423 
424   // COFF specific sections.
getDrectveSection()425   MCSection *getDrectveSection() const { return DrectveSection; }
getPDataSection()426   MCSection *getPDataSection() const { return PDataSection; }
getXDataSection()427   MCSection *getXDataSection() const { return XDataSection; }
getSXDataSection()428   MCSection *getSXDataSection() const { return SXDataSection; }
getGEHContSection()429   MCSection *getGEHContSection() const { return GEHContSection; }
getGFIDsSection()430   MCSection *getGFIDsSection() const { return GFIDsSection; }
getGIATsSection()431   MCSection *getGIATsSection() const { return GIATsSection; }
getGLJMPSection()432   MCSection *getGLJMPSection() const { return GLJMPSection; }
433 
434   // GOFF specific sections.
getPPA1Section()435   MCSection *getPPA1Section() const { return PPA1Section; }
getPPA2Section()436   MCSection *getPPA2Section() const { return PPA2Section; }
getADASection()437   MCSection *getADASection() const { return ADASection; }
getIDRLSection()438   MCSection *getIDRLSection() const { return IDRLSection; }
439 
440   // XCOFF specific sections
getTOCBaseSection()441   MCSection *getTOCBaseSection() const { return TOCBaseSection; }
442 
getEHFrameSection()443   MCSection *getEHFrameSection() const { return EHFrameSection; }
444 
isPositionIndependent()445   bool isPositionIndependent() const { return PositionIndependent; }
446 
447   // Swift5 Reflection Data Sections
getSwift5ReflectionSection(llvm::binaryformat::Swift5ReflectionSectionKind ReflSectionKind)448   MCSection *getSwift5ReflectionSection(
449       llvm::binaryformat::Swift5ReflectionSectionKind ReflSectionKind) {
450     return ReflSectionKind !=
451                    llvm::binaryformat::Swift5ReflectionSectionKind::unknown
452                ? Swift5ReflectionSections[ReflSectionKind]
453                : nullptr;
454   }
455 
456 private:
457   bool PositionIndependent = false;
458   MCContext *Ctx = nullptr;
459   VersionTuple SDKVersion;
460   std::optional<Triple> DarwinTargetVariantTriple;
461   VersionTuple DarwinTargetVariantSDKVersion;
462 
463   void initMachOMCObjectFileInfo(const Triple &T);
464   void initELFMCObjectFileInfo(const Triple &T, bool Large);
465   void initGOFFMCObjectFileInfo(const Triple &T);
466   void initCOFFMCObjectFileInfo(const Triple &T);
467   void initSPIRVMCObjectFileInfo(const Triple &T);
468   void initWasmMCObjectFileInfo(const Triple &T);
469   void initXCOFFMCObjectFileInfo(const Triple &T);
470   void initDXContainerObjectFileInfo(const Triple &T);
471   MCSection *getDwarfComdatSection(const char *Name, uint64_t Hash) const;
472 
473 public:
setSDKVersion(const VersionTuple & TheSDKVersion)474   void setSDKVersion(const VersionTuple &TheSDKVersion) {
475     SDKVersion = TheSDKVersion;
476   }
477 
getSDKVersion()478   const VersionTuple &getSDKVersion() const { return SDKVersion; }
479 
setDarwinTargetVariantTriple(const Triple & T)480   void setDarwinTargetVariantTriple(const Triple &T) {
481     DarwinTargetVariantTriple = T;
482   }
483 
getDarwinTargetVariantTriple()484   const Triple *getDarwinTargetVariantTriple() const {
485     return DarwinTargetVariantTriple ? &*DarwinTargetVariantTriple : nullptr;
486   }
487 
setDarwinTargetVariantSDKVersion(const VersionTuple & TheSDKVersion)488   void setDarwinTargetVariantSDKVersion(const VersionTuple &TheSDKVersion) {
489     DarwinTargetVariantSDKVersion = TheSDKVersion;
490   }
491 
getDarwinTargetVariantSDKVersion()492   const VersionTuple &getDarwinTargetVariantSDKVersion() const {
493     return DarwinTargetVariantSDKVersion;
494   }
495 };
496 
497 } // end namespace llvm
498 
499 #endif
500