@@ -162,6 +162,7 @@ LLVMRustHasFeature(LLVMTargetMachineRef TM,
162
162
return (Bits & FeatureEntry->Value ) == FeatureEntry->Value ;
163
163
}
164
164
165
+ #if LLVM_RUSTLLVM
165
166
// / getLongestEntryLength - Return the length of the longest entry in the table.
166
167
// /
167
168
static size_t getLongestEntryLength (ArrayRef<SubtargetFeatureKV> Table) {
@@ -178,7 +179,7 @@ LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM) {
178
179
const ArrayRef<SubtargetFeatureKV> CPUTable = MCInfo->getCPUTable ();
179
180
unsigned MaxCPULen = getLongestEntryLength (CPUTable);
180
181
181
- printf (" Available CPUs for this target:\n\n " );
182
+ printf (" Available CPUs for this target:\n " );
182
183
for (auto &CPU : CPUTable)
183
184
printf (" %-*s - %s.\n " , MaxCPULen, CPU.Key , CPU.Desc );
184
185
printf (" \n " );
@@ -191,15 +192,28 @@ LLVMRustPrintTargetFeatures(LLVMTargetMachineRef TM) {
191
192
const ArrayRef<SubtargetFeatureKV> FeatTable = MCInfo->getFeatureTable ();
192
193
unsigned MaxFeatLen = getLongestEntryLength (FeatTable);
193
194
194
- printf (" Available features for this target:\n\n " );
195
+ printf (" Available features for this target:\n " );
195
196
for (auto &Feature : FeatTable)
196
197
printf (" %-*s - %s.\n " , MaxFeatLen, Feature.Key , Feature.Desc );
197
198
printf (" \n " );
198
199
199
200
printf (" Use +feature to enable a feature, or -feature to disable it.\n "
200
- " For example, rustc -C -target-cpu=mycpu -C target-feature=+feature1,-feature2\n " );
201
+ " For example, rustc -C -target-cpu=mycpu -C target-feature=+feature1,-feature2\n\n " );
201
202
}
202
203
204
+ #else
205
+
206
+ extern " C" void
207
+ LLVMRustPrintTargetCPUs (LLVMTargetMachineRef) {
208
+ printf (" Target CPU help is not supported by this LLVM version.\n\n " );
209
+ }
210
+
211
+ extern " C" void
212
+ LLVMRustPrintTargetFeatures (LLVMTargetMachineRef) {
213
+ printf (" Target features help is not supported by this LLVM version.\n\n " );
214
+ }
215
+ #endif
216
+
203
217
extern " C" LLVMTargetMachineRef
204
218
LLVMRustCreateTargetMachine (const char *triple,
205
219
const char *cpu,
0 commit comments