From: Devang Patel Date: Tue, 24 Mar 2009 20:35:51 +0000 (+0000) Subject: Encode language. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8d9aefcb479cf2d1a5e397114ed3e22429ab9ac0;p=clang Encode language. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67650 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index c349e4863a..7014fa839e 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -70,14 +70,25 @@ llvm::DICompileUnit CGDebugInfo::getOrCreateCompileUnit(SourceLocation Loc) { const char *DirName = FE ? FE->getDir()->getName() : ""; 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