summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-03-24 20:35:51 +0000
committerDevang Patel <dpatel@apple.com>2009-03-24 20:35:51 +0000
commit94406c954f6081a60c4561324d257e1ae829e15e (patch)
treef2e75176bb3a113668ba37662c91cbe55b628042 /clang/lib/CodeGen/CGDebugInfo.cpp
parentf413a888398ca28fb69bb02a104cf7e60420db12 (diff)
downloadbcm5719-llvm-94406c954f6081a60c4561324d257e1ae829e15e.tar.gz
bcm5719-llvm-94406c954f6081a60c4561324d257e1ae829e15e.zip
Encode language.
llvm-svn: 67650
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index c349e4863a6..7014fa839ef 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -70,14 +70,25 @@ llvm::DICompileUnit CGDebugInfo::getOrCreateCompileUnit(SourceLocation Loc) {
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
OpenPOWER on IntegriCloud