MCPcopy Create free account
hub / github.com/Samsung/UTopia / getFileContent

Function getFileContent

include/ftg/utils/LLVMUtil.h:40–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40static inline llvm::StringRef
41getFileContent(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
64static inline std::vector<std::string>
65getMangledNames(const clang::NamedDecl &D) {

Callers 3

checkMethod · 0.85
getDeclTypeInfoMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected