use of com.oracle.truffle.llvm.parser.metadata.MDFile in project sulong by graalvm.
the class MDUpgrade method visit.
@Override
public void visit(MDCompileUnit md) {
currentCU = md;
if (md.getFile() instanceof MDString) {
final MDFile fileRef = MDFile.create(md.getFile(), md.getDirectory());
md.replace(md.getFile(), fileRef);
}
md.getSubprograms().accept(this);
md.getGlobalVariables().accept(this);
currentCU = null;
}
use of com.oracle.truffle.llvm.parser.metadata.MDFile in project sulong by graalvm.
the class DIScopeBuilder method asSource.
private Source asSource(MDFile mdFile) {
if (sources.containsKey(mdFile)) {
return sources.get(mdFile);
}
final Path path = getPath(mdFile);
if (path == null) {
sources.put(mdFile, null);
return null;
}
final String mimeType = getMimeType(path.toString());
Source source = null;
try {
final File file = path.toFile();
if (file.exists() && file.canRead()) {
source = Source.newBuilder(file).mimeType(mimeType).name(file.getName()).build();
}
} catch (Throwable ignored) {
}
sources.put(mdFile, source);
return source;
}
Aggregations