1 //===- NativeRawSymbol.cpp - Native implementation of IPDBRawSymbol -*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
11 #include "llvm/ADT/ArrayRef.h"
12 #include "llvm/ADT/STLExtras.h"
13 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
14 #include "llvm/DebugInfo/PDB/Native/DbiStream.h"
15 #include "llvm/DebugInfo/PDB/Native/InfoStream.h"
16 #include "llvm/DebugInfo/PDB/Native/NativeEnumModules.h"
17 #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
18 #include "llvm/DebugInfo/PDB/Native/PDBFile.h"
19 #include "llvm/DebugInfo/PDB/PDBExtras.h"
20 #include "llvm/Support/ConvertUTF.h"
21 #include "llvm/Support/raw_ostream.h"
22 
23 using namespace llvm;
24 using namespace llvm::pdb;
25 
26 NativeRawSymbol::NativeRawSymbol(NativeSession &PDBSession)
27   : Session(PDBSession) {}
28 
29 void NativeRawSymbol::dump(raw_ostream &OS, int Indent) const {}
30 
31 std::unique_ptr<IPDBEnumSymbols>
32 NativeRawSymbol::findChildren(PDB_SymType Type) const {
33   switch (Type) {
34   case PDB_SymType::Compiland: {
35     auto &File = Session.getPDBFile();
36     auto Dbi = File.getPDBDbiStream();
37     if (Dbi) {
38       const auto Modules = Dbi->modules();
39       return std::unique_ptr<IPDBEnumSymbols>(
40           new NativeEnumModules(Session, Modules));
41     }
42     consumeError(Dbi.takeError());
43     break;
44   }
45   default:
46     break;
47   }
48   return nullptr;
49 }
50 
51 std::unique_ptr<IPDBEnumSymbols>
52 NativeRawSymbol::findChildren(PDB_SymType Type, StringRef Name,
53     PDB_NameSearchFlags Flags) const {
54   return nullptr;
55 }
56 
57 std::unique_ptr<IPDBEnumSymbols>
58 NativeRawSymbol::findChildrenByRVA(PDB_SymType Type, StringRef Name,
59     PDB_NameSearchFlags Flags, uint32_t RVA) const {
60   return nullptr;
61 }
62 
63 std::unique_ptr<IPDBEnumSymbols>
64 NativeRawSymbol::findInlineFramesByRVA(uint32_t RVA) const {
65   return nullptr;
66 }
67 
68 void NativeRawSymbol::getDataBytes(llvm::SmallVector<uint8_t, 32> &bytes) const {
69   bytes.clear();
70 }
71 
72 PDB_MemberAccess NativeRawSymbol::getAccess() const {
73   return PDB_MemberAccess::Private;
74 }
75 
76 uint32_t NativeRawSymbol::getAddressOffset() const {
77   return 0;
78 }
79 
80 uint32_t NativeRawSymbol::getAddressSection() const {
81   return 0;
82 }
83 
84 uint32_t NativeRawSymbol::getAge() const {
85   auto &File = Session.getPDBFile();
86   auto IS = File.getPDBInfoStream();
87   if (IS)
88     return IS->getAge();
89   consumeError(IS.takeError());
90   return 0;
91 }
92 
93 uint32_t NativeRawSymbol::getArrayIndexTypeId() const {
94   return 0;
95 }
96 
97 void NativeRawSymbol::getBackEndVersion(VersionInfo &Version) const {
98   Version.Major = 0;
99   Version.Minor = 0;
100   Version.Build = 0;
101   Version.QFE = 0;
102 }
103 
104 uint32_t NativeRawSymbol::getBaseDataOffset() const {
105   return 0;
106 }
107 
108 uint32_t NativeRawSymbol::getBaseDataSlot() const {
109   return 0;
110 }
111 
112 uint32_t NativeRawSymbol::getBaseSymbolId() const {
113   return 0;
114 }
115 
116 PDB_BuiltinType NativeRawSymbol::getBuiltinType() const {
117   return PDB_BuiltinType::None;
118 }
119 
120 uint32_t NativeRawSymbol::getBitPosition() const {
121   return 0;
122 }
123 
124 PDB_CallingConv NativeRawSymbol::getCallingConvention() const {
125   return PDB_CallingConv::FarStdCall;
126 }
127 
128 uint32_t NativeRawSymbol::getClassParentId() const {
129   return 0;
130 }
131 
132 std::string NativeRawSymbol::getCompilerName() const {
133   return 0;
134 }
135 
136 uint32_t NativeRawSymbol::getCount() const {
137   return 0;
138 }
139 
140 uint32_t NativeRawSymbol::getCountLiveRanges() const {
141   return 0;
142 }
143 
144 void NativeRawSymbol::getFrontEndVersion(VersionInfo &Version) const {
145   Version.Major = 0;
146   Version.Minor = 0;
147   Version.Build = 0;
148   Version.QFE = 0;
149 }
150 
151 PDB_Lang NativeRawSymbol::getLanguage() const {
152   return PDB_Lang::Cobol;
153 }
154 
155 uint32_t NativeRawSymbol::getLexicalParentId() const {
156   return 0;
157 }
158 
159 std::string NativeRawSymbol::getLibraryName() const {
160   return "";
161 }
162 
163 uint32_t NativeRawSymbol::getLiveRangeStartAddressOffset() const {
164   return 0;
165 }
166 
167 uint32_t NativeRawSymbol::getLiveRangeStartAddressSection() const {
168   return 0;
169 }
170 
171 uint32_t NativeRawSymbol::getLiveRangeStartRelativeVirtualAddress() const {
172   return 0;
173 }
174 
175 codeview::RegisterId NativeRawSymbol::getLocalBasePointerRegisterId() const {
176   return codeview::RegisterId::EAX;
177 }
178 
179 uint32_t NativeRawSymbol::getLowerBoundId() const {
180   return 0;
181 }
182 
183 uint32_t NativeRawSymbol::getMemorySpaceKind() const {
184   return 0;
185 }
186 
187 std::string NativeRawSymbol::getName() const {
188   return 0;
189 }
190 
191 uint32_t NativeRawSymbol::getNumberOfAcceleratorPointerTags() const {
192   return 0;
193 }
194 
195 uint32_t NativeRawSymbol::getNumberOfColumns() const {
196   return 0;
197 }
198 
199 uint32_t NativeRawSymbol::getNumberOfModifiers() const {
200   return 0;
201 }
202 
203 uint32_t NativeRawSymbol::getNumberOfRegisterIndices() const {
204   return 0;
205 }
206 
207 uint32_t NativeRawSymbol::getNumberOfRows() const {
208   return 0;
209 }
210 
211 std::string NativeRawSymbol::getObjectFileName() const {
212   return "";
213 }
214 
215 uint32_t NativeRawSymbol::getOemId() const {
216   return 0;
217 }
218 
219 uint32_t NativeRawSymbol::getOemSymbolId() const {
220   return 0;
221 }
222 
223 uint32_t NativeRawSymbol::getOffsetInUdt() const {
224   return 0;
225 }
226 
227 PDB_Cpu NativeRawSymbol::getPlatform() const {
228   return PDB_Cpu::Intel8080;
229 }
230 
231 uint32_t NativeRawSymbol::getRank() const {
232   return 0;
233 }
234 
235 codeview::RegisterId NativeRawSymbol::getRegisterId() const {
236   return codeview::RegisterId::EAX;
237 }
238 
239 uint32_t NativeRawSymbol::getRegisterType() const {
240   return 0;
241 }
242 
243 uint32_t NativeRawSymbol::getRelativeVirtualAddress() const {
244   return 0;
245 }
246 
247 uint32_t NativeRawSymbol::getSamplerSlot() const {
248   return 0;
249 }
250 
251 uint32_t NativeRawSymbol::getSignature() const {
252   return 0;
253 }
254 
255 uint32_t NativeRawSymbol::getSizeInUdt() const {
256   return 0;
257 }
258 
259 uint32_t NativeRawSymbol::getSlot() const {
260   return 0;
261 }
262 
263 std::string NativeRawSymbol::getSourceFileName() const {
264   return 0;
265 }
266 
267 uint32_t NativeRawSymbol::getStride() const {
268   return 0;
269 }
270 
271 uint32_t NativeRawSymbol::getSubTypeId() const {
272   return 0;
273 }
274 
275 std::string NativeRawSymbol::getSymbolsFileName() const {
276   return Session.getPDBFile().getFilePath();
277 }
278 
279 uint32_t NativeRawSymbol::getSymIndexId() const {
280   return 0;
281 }
282 
283 uint32_t NativeRawSymbol::getTargetOffset() const {
284   return 0;
285 }
286 
287 uint32_t NativeRawSymbol::getTargetRelativeVirtualAddress() const {
288   return 0;
289 }
290 
291 uint64_t NativeRawSymbol::getTargetVirtualAddress() const {
292   return 0;
293 }
294 
295 uint32_t NativeRawSymbol::getTargetSection() const {
296   return 0;
297 }
298 
299 uint32_t NativeRawSymbol::getTextureSlot() const {
300   return 0;
301 }
302 
303 uint32_t NativeRawSymbol::getTimeStamp() const {
304   return 0;
305 }
306 
307 uint32_t NativeRawSymbol::getToken() const {
308   return 0;
309 }
310 
311 uint32_t NativeRawSymbol::getTypeId() const {
312   return 0;
313 }
314 
315 uint32_t NativeRawSymbol::getUavSlot() const {
316   return 0;
317 }
318 
319 std::string NativeRawSymbol::getUndecoratedName() const {
320   return 0;
321 }
322 
323 uint32_t NativeRawSymbol::getUnmodifiedTypeId() const {
324   return 0;
325 }
326 
327 uint32_t NativeRawSymbol::getUpperBoundId() const {
328   return 0;
329 }
330 
331 Variant NativeRawSymbol::getValue() const {
332   return Variant();
333 }
334 
335 uint32_t NativeRawSymbol::getVirtualBaseDispIndex() const {
336   return 0;
337 }
338 
339 uint32_t NativeRawSymbol::getVirtualBaseOffset() const {
340   return 0;
341 }
342 
343 uint32_t NativeRawSymbol::getVirtualTableShapeId() const {
344   return 0;
345 }
346 
347 PDB_DataKind NativeRawSymbol::getDataKind() const {
348   return PDB_DataKind::Unknown;
349 }
350 
351 PDB_SymType NativeRawSymbol::getSymTag() const {
352   return PDB_SymType::None;
353 }
354 
355 PDB_UniqueId NativeRawSymbol::getGuid() const {
356   auto &File = Session.getPDBFile();
357   auto IS = File.getPDBInfoStream();
358   if (IS)
359     return IS->getGuid();
360   consumeError(IS.takeError());
361   return PDB_UniqueId{{0}};
362 }
363 
364 int32_t NativeRawSymbol::getOffset() const {
365   return 0;
366 }
367 
368 int32_t NativeRawSymbol::getThisAdjust() const {
369   return 0;
370 }
371 
372 int32_t NativeRawSymbol::getVirtualBasePointerOffset() const {
373   return 0;
374 }
375 
376 PDB_LocType NativeRawSymbol::getLocationType() const {
377   return PDB_LocType::Null;
378 }
379 
380 PDB_Machine NativeRawSymbol::getMachineType() const {
381   return PDB_Machine::Invalid;
382 }
383 
384 codeview::ThunkOrdinal NativeRawSymbol::getThunkOrdinal() const {
385   return codeview::ThunkOrdinal::Standard;
386 }
387 
388 uint64_t NativeRawSymbol::getLength() const {
389   return 0;
390 }
391 
392 uint64_t NativeRawSymbol::getLiveRangeLength() const {
393   return 0;
394 }
395 
396 uint64_t NativeRawSymbol::getVirtualAddress() const {
397   return 0;
398 }
399 
400 PDB_UdtType NativeRawSymbol::getUdtKind() const {
401   return PDB_UdtType::Struct;
402 }
403 
404 bool NativeRawSymbol::hasConstructor() const {
405   return false;
406 }
407 
408 bool NativeRawSymbol::hasCustomCallingConvention() const {
409   return false;
410 }
411 
412 bool NativeRawSymbol::hasFarReturn() const {
413   return false;
414 }
415 
416 bool NativeRawSymbol::isCode() const {
417   return false;
418 }
419 
420 bool NativeRawSymbol::isCompilerGenerated() const {
421   return false;
422 }
423 
424 bool NativeRawSymbol::isConstType() const {
425   return false;
426 }
427 
428 bool NativeRawSymbol::isEditAndContinueEnabled() const {
429   return false;
430 }
431 
432 bool NativeRawSymbol::isFunction() const {
433   return false;
434 }
435 
436 bool NativeRawSymbol::getAddressTaken() const {
437   return false;
438 }
439 
440 bool NativeRawSymbol::getNoStackOrdering() const {
441   return false;
442 }
443 
444 bool NativeRawSymbol::hasAlloca() const {
445   return false;
446 }
447 
448 bool NativeRawSymbol::hasAssignmentOperator() const {
449   return false;
450 }
451 
452 bool NativeRawSymbol::hasCTypes() const {
453   return false;
454 }
455 
456 bool NativeRawSymbol::hasCastOperator() const {
457   return false;
458 }
459 
460 bool NativeRawSymbol::hasDebugInfo() const {
461   return false;
462 }
463 
464 bool NativeRawSymbol::hasEH() const {
465   return false;
466 }
467 
468 bool NativeRawSymbol::hasEHa() const {
469   return false;
470 }
471 
472 bool NativeRawSymbol::hasInlAsm() const {
473   return false;
474 }
475 
476 bool NativeRawSymbol::hasInlineAttribute() const {
477   return false;
478 }
479 
480 bool NativeRawSymbol::hasInterruptReturn() const {
481   return false;
482 }
483 
484 bool NativeRawSymbol::hasFramePointer() const {
485   return false;
486 }
487 
488 bool NativeRawSymbol::hasLongJump() const {
489   return false;
490 }
491 
492 bool NativeRawSymbol::hasManagedCode() const {
493   return false;
494 }
495 
496 bool NativeRawSymbol::hasNestedTypes() const {
497   return false;
498 }
499 
500 bool NativeRawSymbol::hasNoInlineAttribute() const {
501   return false;
502 }
503 
504 bool NativeRawSymbol::hasNoReturnAttribute() const {
505   return false;
506 }
507 
508 bool NativeRawSymbol::hasOptimizedCodeDebugInfo() const {
509   return false;
510 }
511 
512 bool NativeRawSymbol::hasOverloadedOperator() const {
513   return false;
514 }
515 
516 bool NativeRawSymbol::hasSEH() const {
517   return false;
518 }
519 
520 bool NativeRawSymbol::hasSecurityChecks() const {
521   return false;
522 }
523 
524 bool NativeRawSymbol::hasSetJump() const {
525   return false;
526 }
527 
528 bool NativeRawSymbol::hasStrictGSCheck() const {
529   return false;
530 }
531 
532 bool NativeRawSymbol::isAcceleratorGroupSharedLocal() const {
533   return false;
534 }
535 
536 bool NativeRawSymbol::isAcceleratorPointerTagLiveRange() const {
537   return false;
538 }
539 
540 bool NativeRawSymbol::isAcceleratorStubFunction() const {
541   return false;
542 }
543 
544 bool NativeRawSymbol::isAggregated() const {
545   return false;
546 }
547 
548 bool NativeRawSymbol::isIntroVirtualFunction() const {
549   return false;
550 }
551 
552 bool NativeRawSymbol::isCVTCIL() const {
553   return false;
554 }
555 
556 bool NativeRawSymbol::isConstructorVirtualBase() const {
557   return false;
558 }
559 
560 bool NativeRawSymbol::isCxxReturnUdt() const {
561   return false;
562 }
563 
564 bool NativeRawSymbol::isDataAligned() const {
565   return false;
566 }
567 
568 bool NativeRawSymbol::isHLSLData() const {
569   return false;
570 }
571 
572 bool NativeRawSymbol::isHotpatchable() const {
573   return false;
574 }
575 
576 bool NativeRawSymbol::isIndirectVirtualBaseClass() const {
577   return false;
578 }
579 
580 bool NativeRawSymbol::isInterfaceUdt() const {
581   return false;
582 }
583 
584 bool NativeRawSymbol::isIntrinsic() const {
585   return false;
586 }
587 
588 bool NativeRawSymbol::isLTCG() const {
589   return false;
590 }
591 
592 bool NativeRawSymbol::isLocationControlFlowDependent() const {
593   return false;
594 }
595 
596 bool NativeRawSymbol::isMSILNetmodule() const {
597   return false;
598 }
599 
600 bool NativeRawSymbol::isMatrixRowMajor() const {
601   return false;
602 }
603 
604 bool NativeRawSymbol::isManagedCode() const {
605   return false;
606 }
607 
608 bool NativeRawSymbol::isMSILCode() const {
609   return false;
610 }
611 
612 bool NativeRawSymbol::isMultipleInheritance() const {
613   return false;
614 }
615 
616 bool NativeRawSymbol::isNaked() const {
617   return false;
618 }
619 
620 bool NativeRawSymbol::isNested() const {
621   return false;
622 }
623 
624 bool NativeRawSymbol::isOptimizedAway() const {
625   return false;
626 }
627 
628 bool NativeRawSymbol::isPacked() const {
629   return false;
630 }
631 
632 bool NativeRawSymbol::isPointerBasedOnSymbolValue() const {
633   return false;
634 }
635 
636 bool NativeRawSymbol::isPointerToDataMember() const {
637   return false;
638 }
639 
640 bool NativeRawSymbol::isPointerToMemberFunction() const {
641   return false;
642 }
643 
644 bool NativeRawSymbol::isPureVirtual() const {
645   return false;
646 }
647 
648 bool NativeRawSymbol::isRValueReference() const {
649   return false;
650 }
651 
652 bool NativeRawSymbol::isRefUdt() const {
653   return false;
654 }
655 
656 bool NativeRawSymbol::isReference() const {
657   return false;
658 }
659 
660 bool NativeRawSymbol::isRestrictedType() const {
661   return false;
662 }
663 
664 bool NativeRawSymbol::isReturnValue() const {
665   return false;
666 }
667 
668 bool NativeRawSymbol::isSafeBuffers() const {
669   return false;
670 }
671 
672 bool NativeRawSymbol::isScoped() const {
673   return false;
674 }
675 
676 bool NativeRawSymbol::isSdl() const {
677   return false;
678 }
679 
680 bool NativeRawSymbol::isSingleInheritance() const {
681   return false;
682 }
683 
684 bool NativeRawSymbol::isSplitted() const {
685   return false;
686 }
687 
688 bool NativeRawSymbol::isStatic() const {
689   return false;
690 }
691 
692 bool NativeRawSymbol::hasPrivateSymbols() const {
693   return false;
694 }
695 
696 bool NativeRawSymbol::isUnalignedType() const {
697   return false;
698 }
699 
700 bool NativeRawSymbol::isUnreached() const {
701   return false;
702 }
703 
704 bool NativeRawSymbol::isValueUdt() const {
705   return false;
706 }
707 
708 bool NativeRawSymbol::isVirtual() const {
709   return false;
710 }
711 
712 bool NativeRawSymbol::isVirtualBaseClass() const {
713   return false;
714 }
715 
716 bool NativeRawSymbol::isVirtualInheritance() const {
717   return false;
718 }
719 
720 bool NativeRawSymbol::isVolatileType() const {
721   return false;
722 }
723 
724 bool NativeRawSymbol::wasInlined() const {
725   return false;
726 }
727 
728 std::string NativeRawSymbol::getUnused() const {
729   return "";
730 }
731