#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/PointerLikeTypeTraits.h"
/// ensure a stable ABI for this, we choose the DW_LANG_ encodings
/// from the dwarf standard.
enum LanguageIDs {
- lang_c = /* DW_LANG_C */ 0x0002,
- lang_cxx = /* DW_LANG_C_plus_plus */ 0x0004
+ lang_c = llvm::dwarf::DW_LANG_C,
+ lang_cxx = llvm::dwarf::DW_LANG_C_plus_plus,
+ lang_cxx_11 = llvm::dwarf::DW_LANG_C_plus_plus_11,
+ lang_cxx_14 = llvm::dwarf::DW_LANG_C_plus_plus_14
};
private:
void DeclPrinter::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
const char *l;
- if (D->getLanguage() == LinkageSpecDecl::lang_c)
+ switch (D->getLanguage()) {
+ case LinkageSpecDecl::lang_c:
l = "C";
- else {
- assert(D->getLanguage() == LinkageSpecDecl::lang_cxx &&
- "unknown language in linkage specification");
+ break;
+ case LinkageSpecDecl::lang_cxx_14:
+ l = "C++14";
+ break;
+ case LinkageSpecDecl::lang_cxx_11:
+ l = "C++11";
+ break;
+ case LinkageSpecDecl::lang_cxx:
l = "C++";
+ break;
}
Out << "extern \"" << l << "\" ";
switch (LSD->getLanguage()) {
case LinkageSpecDecl::lang_c: Lang = "C"; break;
case LinkageSpecDecl::lang_cxx: Lang = "C++"; break;
+ case LinkageSpecDecl::lang_cxx_11:
+ Lang = "C++11";
+ break;
+ case LinkageSpecDecl::lang_cxx_14:
+ Lang = "C++14";
+ break;
}
JOS.attribute("language", Lang);
attributeOnlyIfTrue("hasBraces", LSD->hasBraces());
case LinkageSpecDecl::lang_cxx:
OS << " C++";
break;
+ case LinkageSpecDecl::lang_cxx_11:
+ OS << " C++11";
+ break;
+ case LinkageSpecDecl::lang_cxx_14:
+ OS << " C++14";
+ break;
}
}
if (LO.CPlusPlus) {
if (LO.ObjC)
LangTag = llvm::dwarf::DW_LANG_ObjC_plus_plus;
+ else if (LO.CPlusPlus14)
+ LangTag = llvm::dwarf::DW_LANG_C_plus_plus_14;
+ else if (LO.CPlusPlus11)
+ LangTag = llvm::dwarf::DW_LANG_C_plus_plus_11;
else
LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
} else if (LO.ObjC) {
static bool hasCXXMangling(const TagDecl *TD, llvm::DICompileUnit *TheCU) {
switch (TheCU->getSourceLanguage()) {
case llvm::dwarf::DW_LANG_C_plus_plus:
+ case llvm::dwarf::DW_LANG_C_plus_plus_11:
+ case llvm::dwarf::DW_LANG_C_plus_plus_14:
return true;
case llvm::dwarf::DW_LANG_ObjC_plus_plus:
return isa<CXXRecordDecl>(TD) || isa<EnumDecl>(TD);
// EmitLinkageSpec - Emit all declarations in a linkage spec.
void CodeGenModule::EmitLinkageSpec(const LinkageSpecDecl *LSD) {
if (LSD->getLanguage() != LinkageSpecDecl::lang_c &&
- LSD->getLanguage() != LinkageSpecDecl::lang_cxx) {
+ LSD->getLanguage() != LinkageSpecDecl::lang_cxx &&
+ LSD->getLanguage() != LinkageSpecDecl::lang_cxx_11 &&
+ LSD->getLanguage() != LinkageSpecDecl::lang_cxx_14) {
ErrorUnsupported(LSD, "linkage spec");
return;
}
Language = LinkageSpecDecl::lang_c;
else if (Lang == "C++")
Language = LinkageSpecDecl::lang_cxx;
+ else if (Lang == "C++11")
+ Language = LinkageSpecDecl::lang_cxx_11;
+ else if (Lang == "C++14")
+ Language = LinkageSpecDecl::lang_cxx_14;
else {
Diag(LangStr->getExprLoc(), diag::err_language_linkage_spec_unknown)
<< LangStr->getSourceRange();
ExternCLoc = LSD->getBeginLoc();
break;
case LinkageSpecDecl::lang_cxx:
+ case LinkageSpecDecl::lang_cxx_11:
+ case LinkageSpecDecl::lang_cxx_14:
break;
}
DC = LSD->getParent();
// PCH:
// RUN: %clang_cc1 -triple %itanium_abi_triple -x c++ -std=c++11 -debugger-tuning=lldb -emit-pch -fmodule-format=obj -I %S/Inputs -o %t.pch %S/Inputs/DebugCXX.h -mllvm -debug-only=pchcontainer &>%t-pch.ll
-// RUN: cat %t-pch.ll | FileCheck %s
+// RUN: cat %t-pch.ll | FileCheck --check-prefix=CHECK-CXX %s
// RUN: cat %t-pch.ll | FileCheck --check-prefix=CHECK-NEG %s
#ifdef MODULES
// CHECK-MOD: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus,
// CHECK: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus,
+// CHECK-CXX: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_11,
// CHECK-SAME: isOptimized: false,
// CHECK-NOT: splitDebugFilename:
// CHECK-SAME: dwoId: