Add first pieces of support for parsing and representing
extern "C" in C++ mode. Patch by Mike Stump!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45904 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/Decl.cpp b/AST/Decl.cpp
index f67d712..bf1ffee 100644
--- a/AST/Decl.cpp
+++ b/AST/Decl.cpp
@@ -37,6 +37,7 @@
static unsigned nObjCCategoryImpl = 0;
static unsigned nObjCCompatibleAlias = 0;
static unsigned nObjCPropertyDecl = 0;
+static unsigned nLinkageSpecDecl = 0;
static bool StatSwitch = false;
@@ -156,7 +157,9 @@
nFileVars*sizeof(FileVarDecl)+nParmVars*sizeof(ParmVarDecl)+
nFieldDecls*sizeof(FieldDecl)+nSUC*sizeof(RecordDecl)+
nEnumDecls*sizeof(EnumDecl)+nEnumConst*sizeof(EnumConstantDecl)+
- nTypedef*sizeof(TypedefDecl)) /* FIXME: add ObjC decls */);
+ nTypedef*sizeof(TypedefDecl)+
+ nLinkageSpecDecl*sizeof(LinkageSpecDecl))
+ /* FIXME: add ObjC decls */);
}
void Decl::addDeclKind(const Kind k) {
@@ -223,6 +226,9 @@
case PropertyDecl:
nObjCPropertyDecl++;
break;
+ case LinkageSpec:
+ nLinkageSpecDecl++;
+ break;
}
}
diff --git a/AST/DeclSerialization.cpp b/AST/DeclSerialization.cpp
index 6baa262..146ebba 100644
--- a/AST/DeclSerialization.cpp
+++ b/AST/DeclSerialization.cpp
@@ -422,3 +422,19 @@
return decl;
}
+
+//===----------------------------------------------------------------------===//
+// LinkageSpec Serialization.
+//===----------------------------------------------------------------------===//
+
+void LinkageSpecDecl::EmitInRec(Serializer& S) const {
+ Decl::EmitInRec(S);
+ S.EmitInt(getLanguage());
+ S.EmitPtr(D);
+}
+
+void LinkageSpecDecl::ReadInRec(Deserializer& D) {
+ Decl::ReadInRec(D);
+ Language = static_cast<LanguageIDs>(D.ReadInt());
+ D.ReadPtr(this->D);
+}