[cfe-commits] r98959 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Douglas Gregor dgregor at apple.com
Mon Mar 22 14:29:19 PDT 2010


On Mar 19, 2010, at 1:26 PM, Daniel Dunbar wrote:

> Hi Doug,
> 
> A well-placed comment on why we need to do this might be worthwhile,
> its not totally obvious.

r99215 well-placed enough?

	-Doug

> - Daniel
> 
> On Fri, Mar 19, 2010 at 7:49 AM, Douglas Gregor <dgregor at apple.com> wrote:
>> Author: dgregor
>> Date: Fri Mar 19 09:49:09 2010
>> New Revision: 98959
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=98959&view=rev
>> Log:
>> Try to improve computation of the main file name for debug
>> information, to address recent gdb failures.
>> 
>> Modified:
>>    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> 
>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=98959&r1=98958&r2=98959&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Mar 19 09:49:09 2010
>> @@ -105,16 +105,19 @@
>> 
>>   // Get absolute path name.
>>   SourceManager &SM = CGM.getContext().getSourceManager();
>> -  std::string MainFileName;
>> -  if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID()))
>> -    MainFileName = MainFile->getName();
>> -  else if (CGM.getCodeGenOpts().MainFileName.empty())
>> +  std::string MainFileName = CGM.getCodeGenOpts().MainFileName;
>> +  if (MainFileName.empty())
>>     MainFileName = "<unknown>";
>> -  else
>> -    MainFileName = CGM.getCodeGenOpts().MainFileName;
>> +
>>   llvm::sys::Path AbsFileName(MainFileName);
>>   AbsFileName.makeAbsolute();
>> 
>> +  std::string MainFileDir;
>> +  if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID()))
>> +    MainFileDir = MainFile->getDir()->getName();
>> +  else
>> +    MainFileDir = AbsFileName.getDirname();
>> +
>>   unsigned LangTag;
>>   const LangOptions &LO = CGM.getLangOptions();
>>   if (LO.CPlusPlus) {
>> @@ -143,7 +146,7 @@
>> 
>>   // Create new compile unit.
>>   TheCU = DebugFactory.CreateCompileUnit(
>> -    LangTag, AbsFileName.getLast(), AbsFileName.getDirname(), Producer, true,
>> +    LangTag, AbsFileName.getLast(), MainFileDir, Producer, true,
>>     LO.Optimize, CGM.getCodeGenOpts().DwarfDebugFlags, RuntimeVers);
>>  }
>> 
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>> 





More information about the cfe-commits mailing list