[cfe-commits] r98021 - in /cfe/trunk/lib/CodeGen: CGDebugInfo.cpp CGDebugInfo.h
Sylvere Teissier
st at invia.fr
Tue Mar 9 07:20:54 PST 2010
Devang Patel a écrit :
> Author: dpatel
> Date: Mon Mar 8 18:44:50 2010
> New Revision: 98021
>
> URL: http://llvm.org/viewvc/llvm-project?rev=98021&view=rev
> Log:
> Start using DIFile. Corresponding llvm patch is r98020.
>
> Modified:
> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> cfe/trunk/lib/CodeGen/CGDebugInfo.h
>
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=98021&r1=98020&r2=98021&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Mar 8 18:44:50 2010
> @@ -36,8 +36,9 @@
> using namespace clang::CodeGen;
>
> CGDebugInfo::CGDebugInfo(CodeGenModule &CGM)
> - : CGM(CGM), isMainCompileUnitCreated(false), DebugFactory(CGM.getModule()),
> + : CGM(CGM), DebugFactory(CGM.getModule()),
> BlockLiteralGenericSet(false) {
> + CreateCompileUnit();
> }
>
> CGDebugInfo::~CGDebugInfo() {
> @@ -85,45 +86,29 @@
> return llvm::StringRef(StrPtr, NS.length());
> }
>
> -/// getOrCreateCompileUnit - Get the compile unit from the cache or create a new
> -/// one if necessary. This returns null for invalid source locations.
> -llvm::DICompileUnit CGDebugInfo::getOrCreateCompileUnit(SourceLocation Loc) {
> - // Get source file information.
> - const char *FileName = "<unknown>";
> +/// getOrCreateFile - Get the file debug info descriptor for the input location.
> +llvm::DIFile CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
> + if (!Loc.isValid())
> + // If Location is not valid then use main input file.
> + return DebugFactory.CreateFile(TheCU.getFilename(), TheCU.getDirectory(),
> + TheCU);
> SourceManager &SM = CGM.getContext().getSourceManager();
> - if (Loc.isValid()) {
> - PresumedLoc PLoc = SM.getPresumedLoc(Loc);
> - FileName = PLoc.getFilename();
> - unsigned FID = PLoc.getIncludeLoc().getRawEncoding();
> -
> - // See if this compile unit has been used before for this valid location.
> - llvm::DICompileUnit &Unit = CompileUnitCache[FID];
> - if (Unit.Verify()) return Unit;
> - }
> + PresumedLoc PLoc = SM.getPresumedLoc(Loc);
> + llvm::sys::Path AbsFileName(PLoc.getFilename());
> + AbsFileName.makeAbsolute();
> +
> + return DebugFactory.CreateFile(AbsFileName.getBasename(),
> + AbsFileName.getDirname(), TheCU);
> +}
Are you sure that you want the filename to be the basename ? (without
suffix)
I think it should be:
return DebugFactory.CreateFile(AbsFileName.getLast(),
AbsFileName.getDirname(), TheCU);
More information about the cfe-commits
mailing list