}
+/// getOrCreateMainFile - Get the file info for main compile unit.
+llvm::DIFile CGDebugInfo::getOrCreateMainFile() {
+ return DebugFactory.CreateFile(TheCU.getFilename(), TheCU.getDirectory(),
+ TheCU);
+}
+
/// getLineNumber - Get line number for the location. If location is invalid
/// then use current location.
unsigned CGDebugInfo::getLineNumber(SourceLocation Loc) {
uint64_t Size = CGM.getContext().getTypeSize(BT);
uint64_t Align = CGM.getContext().getTypeAlign(BT);
uint64_t Offset = 0;
-
llvm::DIType DbgTy =
- DebugFactory.CreateBasicType(Unit, BTName,
- Unit, 0, Size, Align,
+ DebugFactory.CreateBasicType(TheCU, BTName, getOrCreateMainFile(),
+ 0, Size, Align,
Offset, /*flags*/ 0, Encoding);
return DbgTy;
}
uint64_t Offset = 0;
llvm::DIType DbgTy =
- DebugFactory.CreateBasicType(Unit, "complex",
- Unit, 0, Size, Align,
- Offset, /*flags*/ 0, Encoding);
+ DebugFactory.CreateBasicType(TheCU, "complex", getOrCreateMainFile(),
+ 0, Size, Align, Offset, /*flags*/ 0, Encoding);
return DbgTy;
}
/// location.
llvm::DIFile getOrCreateFile(SourceLocation Loc);
+ /// getOrCreateMainFile - Get the file info for main compile unit.
+ llvm::DIFile getOrCreateMainFile();
+
/// getOrCreateType - Get the type from the cache or create a new type if
/// necessary.
llvm::DIType getOrCreateType(QualType Ty, llvm::DIFile F);