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

Devang Patel dpatel at apple.com
Tue Mar 24 13:35:52 PDT 2009


Author: dpatel
Date: Tue Mar 24 15:35:51 2009
New Revision: 67650

URL: http://llvm.org/viewvc/llvm-project?rev=67650&view=rev
Log:
Encode language.

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=67650&r1=67649&r2=67650&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Mar 24 15:35:51 2009
@@ -70,14 +70,25 @@
   const char *DirName = FE ? FE->getDir()->getName() : "<unknown>";
   
   bool isMain = (FE == SM.getFileEntryForID(SM.getMainFileID()));
+  unsigned LangTag = llvm::dwarf::DW_LANG_C89;
+  
+  LangOptions LO =  M->getLangOptions();
+  if (LO.CPlusPlus
+      && (LO.ObjC1 || LO.ObjC2 || LO.ObjCNonFragileABI || LO.NeXTRuntime))
+    LangTag = llvm::dwarf::DW_LANG_ObjC_plus_plus;
+  else if (LO.CPlusPlus)
+    LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
+  else if (LO.ObjC1 || LO.ObjC2 || LO.ObjCNonFragileABI || LO.NeXTRuntime)
+    LangTag = llvm::dwarf::DW_LANG_ObjC;
+  else if (LO.C99)
+    LangTag = llvm::dwarf::DW_LANG_C99;
+    
   // Create new compile unit.
-  // FIXME: Handle other language IDs as well.
   // FIXME: Do not know how to get clang version yet.
   // FIXME: Encode command line options.
   // FIXME: Encode optimization level.
-  return Unit = DebugFactory.CreateCompileUnit(llvm::dwarf::DW_LANG_C89,
-                                               FileName, DirName, "clang",
-                                               isMain);
+  return Unit = DebugFactory.CreateCompileUnit(LangTag, FileName, DirName, 
+                                               "clang", isMain);
 }
 
 /// CreateType - Get the Basic type from the cache or create a new





More information about the cfe-commits mailing list