Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. //===- SymbolVisitorCallbackPipeline.h --------------------------*- 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. #ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H
  10. #define LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H
  11.  
  12. #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
  13. #include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h"
  14. #include "llvm/Support/Error.h"
  15. #include <vector>
  16.  
  17. namespace llvm {
  18. namespace codeview {
  19.  
  20. class SymbolVisitorCallbackPipeline : public SymbolVisitorCallbacks {
  21. public:
  22.   SymbolVisitorCallbackPipeline() = default;
  23.  
  24.   Error visitUnknownSymbol(CVSymbol &Record) override {
  25.     for (auto *Visitor : Pipeline) {
  26.       if (auto EC = Visitor->visitUnknownSymbol(Record))
  27.         return EC;
  28.     }
  29.     return Error::success();
  30.   }
  31.  
  32.   Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) override {
  33.     for (auto *Visitor : Pipeline) {
  34.       if (auto EC = Visitor->visitSymbolBegin(Record, Offset))
  35.         return EC;
  36.     }
  37.     return Error::success();
  38.   }
  39.  
  40.   Error visitSymbolBegin(CVSymbol &Record) override {
  41.     for (auto *Visitor : Pipeline) {
  42.       if (auto EC = Visitor->visitSymbolBegin(Record))
  43.         return EC;
  44.     }
  45.     return Error::success();
  46.   }
  47.  
  48.   Error visitSymbolEnd(CVSymbol &Record) override {
  49.     for (auto *Visitor : Pipeline) {
  50.       if (auto EC = Visitor->visitSymbolEnd(Record))
  51.         return EC;
  52.     }
  53.     return Error::success();
  54.   }
  55.  
  56.   void addCallbackToPipeline(SymbolVisitorCallbacks &Callbacks) {
  57.     Pipeline.push_back(&Callbacks);
  58.   }
  59.  
  60. #define SYMBOL_RECORD(EnumName, EnumVal, Name)                                 \
  61.   Error visitKnownRecord(CVSymbol &CVR, Name &Record) override {               \
  62.     for (auto Visitor : Pipeline) {                                            \
  63.       if (auto EC = Visitor->visitKnownRecord(CVR, Record))                    \
  64.         return EC;                                                             \
  65.     }                                                                          \
  66.     return Error::success();                                                   \
  67.   }
  68. #define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
  69. #include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
  70.  
  71. private:
  72.   std::vector<SymbolVisitorCallbacks *> Pipeline;
  73. };
  74.  
  75. } // end namespace codeview
  76. } // end namespace llvm
  77.  
  78. #endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H
  79.