| 38 | } |
| 39 | |
| 40 | static inline llvm::StringRef |
| 41 | getFileContent(const clang::FileID &ID, |
| 42 | const clang::SourceManager &SrcManager) { |
| 43 | #if LLVM_VERSION_MAJOR >= 12 |
| 44 | auto MemRef = SrcManager.getBufferOrNone(ID); |
| 45 | if (!MemRef) |
| 46 | return llvm::StringRef(); |
| 47 | |
| 48 | return MemRef->getBuffer(); |
| 49 | #else |
| 50 | const auto *FE = SrcManager.getFileEntryForID(ID); |
| 51 | if (!FE) |
| 52 | return llvm::StringRef(); |
| 53 | |
| 54 | bool Invalidity = false; |
| 55 | auto *MemBuffer = const_cast<clang::SourceManager *>(&SrcManager) |
| 56 | ->getMemoryBufferForFile(FE, &Invalidity); |
| 57 | if (!MemBuffer || Invalidity) |
| 58 | return llvm::StringRef(); |
| 59 | |
| 60 | return MemBuffer->getBuffer(); |
| 61 | #endif |
| 62 | } |
| 63 | |
| 64 | static inline std::vector<std::string> |
| 65 | getMangledNames(const clang::NamedDecl &D) { |
no outgoing calls
no test coverage detected