summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorNathan Lanza <nathan@lanza.io>2019-03-11 23:27:59 +0000
committerNathan Lanza <nathan@lanza.io>2019-03-11 23:27:59 +0000
commitcc51dc649abac6a5404eae91dc9be56eeda4d611 (patch)
tree457fc9c751022007582c33ca77c984c110b82805 /llvm/lib
parenteae78b5157dc0582cf32710d2ade9bbcd7f0fc94 (diff)
downloadbcm5719-llvm-cc51dc649abac6a5404eae91dc9be56eeda4d611.tar.gz
bcm5719-llvm-cc51dc649abac6a5404eae91dc9be56eeda4d611.zip
Add Swift enumerator value for CodeView::SourceLanguage
Summary: Swift now generates PDBs for debugging on Windows. llvm and lldb need a language enumerator value too properly handle the output emitted by swiftc. Subscribers: jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59231 llvm-svn: 355882
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp2
-rw-r--r--llvm/lib/DebugInfo/CodeView/EnumTables.cpp1
-rw-r--r--llvm/lib/DebugInfo/PDB/PDBExtras.cpp1
-rw-r--r--llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp10
4 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index d33708a8833..9bce1c42757 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -699,6 +699,8 @@ static SourceLanguage MapDWLangToCVLang(unsigned DWLang) {
return SourceLanguage::Java;
case dwarf::DW_LANG_D:
return SourceLanguage::D;
+ case dwarf::DW_LANG_Swift:
+ return SourceLanguage::Swift;
default:
// There's no CodeView representation for this language, and CV doesn't
// have an "unknown" option for the language field, so we'll use MASM,
diff --git a/llvm/lib/DebugInfo/CodeView/EnumTables.cpp b/llvm/lib/DebugInfo/CodeView/EnumTables.cpp
index 2308c355136..4f3ddc442ae 100644
--- a/llvm/lib/DebugInfo/CodeView/EnumTables.cpp
+++ b/llvm/lib/DebugInfo/CodeView/EnumTables.cpp
@@ -86,6 +86,7 @@ static const EnumEntry<codeview::SourceLanguage> SourceLanguages[] = {
CV_ENUM_ENT(SourceLanguage, ILAsm), CV_ENUM_ENT(SourceLanguage, Java),
CV_ENUM_ENT(SourceLanguage, JScript), CV_ENUM_ENT(SourceLanguage, MSIL),
CV_ENUM_ENT(SourceLanguage, HLSL), CV_ENUM_ENT(SourceLanguage, D),
+ CV_ENUM_ENT(SourceLanguage, Swift),
};
static const EnumEntry<uint32_t> CompileSym2FlagNames[] = {
diff --git a/llvm/lib/DebugInfo/PDB/PDBExtras.cpp b/llvm/lib/DebugInfo/PDB/PDBExtras.cpp
index c67ad0b3b98..71552276153 100644
--- a/llvm/lib/DebugInfo/PDB/PDBExtras.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDBExtras.cpp
@@ -192,6 +192,7 @@ raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const PDB_Lang &Lang) {
CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, MSIL, OS)
CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, HLSL, OS)
CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, D, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Swift, OS)
}
return OS;
}
diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
index f7819b8e5d0..9b288354630 100644
--- a/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
@@ -90,16 +90,16 @@ std::string PDBSymbolCompiland::getSourceFileFullPath() const {
PDB_Lang Lang = Details ? Details->getLanguage() : PDB_Lang::Cpp;
auto SrcFiles = Session.getSourceFilesForCompiland(*this);
if (SrcFiles) {
- bool LangC = (Lang == PDB_Lang::Cpp || Lang == PDB_Lang::C);
while (auto File = SrcFiles->getNext()) {
std::string FileName = File->getFileName();
auto file_extension = sys::path::extension(FileName);
if (StringSwitch<bool>(file_extension.lower())
- .Case(".cpp", LangC)
- .Case(".c", LangC)
- .Case(".cc", LangC)
- .Case(".cxx", LangC)
+ .Case(".cpp", Lang == PDB_Lang::Cpp)
+ .Case(".cc", Lang == PDB_Lang::Cpp)
+ .Case(".cxx", Lang == PDB_Lang::Cpp)
+ .Case(".c", Lang == PDB_Lang::C)
.Case(".asm", Lang == PDB_Lang::Masm)
+ .Case(".swift", Lang == PDB_Lang::Swift)
.Default(false))
return File->getFileName();
}
OpenPOWER on IntegriCloud