8e4b4e0caff72119cfd0862881dec4e56957d453
[oota-llvm.git] / lib / Debugger / SourceLanguage.cpp
1 //===-- SourceLanguage.cpp - Implement the SourceLanguage class -----------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the SourceLanguage class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "llvm/Debugger/SourceLanguage.h"
15 #include "llvm/Debugger/ProgramInfo.h"
16 using namespace llvm;
17
18 const SourceLanguage &SourceLanguage::get(unsigned ID) {
19   switch (ID) {
20   case 1:  // DW_LANG_C89
21   case 2:  // DW_LANG_C
22   case 12: // DW_LANG_C99
23     return getCFamilyInstance();
24
25   case 4:  // DW_LANG_C_plus_plus
26     return getCPlusPlusInstance();
27
28   case 3:  // DW_LANG_Ada83
29   case 5:  // DW_LANG_Cobol74
30   case 6:  // DW_LANG_Cobol85
31   case 7:  // DW_LANG_Fortran77
32   case 8:  // DW_LANG_Fortran90
33   case 9:  // DW_LANG_Pascal83
34   case 10: // DW_LANG_Modula2
35   case 11: // DW_LANG_Java
36   case 13: // DW_LANG_Ada95
37   case 14: // DW_LANG_Fortran95
38   default:
39     return getUnknownLanguageInstance();
40   }
41 }
42
43
44 SourceFileInfo *
45 SourceLanguage::createSourceFileInfo(const GlobalVariable *Desc,
46                                      ProgramInfo &PI) const {
47   return new SourceFileInfo(Desc, *this);
48 }
49
50 SourceFunctionInfo *
51 SourceLanguage::createSourceFunctionInfo(const GlobalVariable *Desc,
52                                          ProgramInfo &PI) const {
53   return new SourceFunctionInfo(PI, Desc);
54 }