diff options
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/AST/Decl.h | 22 | ||||
-rw-r--r-- | include/clang/AST/DeclBase.h | 4 | ||||
-rw-r--r-- | include/clang/Basic/Linkage.h | 8 |
3 files changed, 24 insertions, 10 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index b6a650fea3..947525f691 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -898,11 +898,12 @@ public: /// external, C linkage. bool isExternC() const; - /// Checks if this variable has C language linkage. Note that this is not the - /// same as isExternC since decls with non external linkage can have C - /// language linkage. They can also have C language linkage when they are not - /// declared in an extern C context, but a previous decl is. - bool hasCLanguageLinkage() const; + /// Compute the language linkage. + LanguageLinkage getLanguageLinkage() const; + + bool hasCLanguageLinkage() const { + return getLanguageLinkage() == CLanguageLinkage; + } /// isLocalVarDecl - Returns true for local variable declarations /// other than parameters. Note that this includes static variables @@ -1790,11 +1791,12 @@ public: /// external, C linkage. bool isExternC() const; - /// Checks if this function has C language linkage. Note that this is not the - /// same as isExternC since decls with non external linkage can have C - /// language linkage. They can also have C language linkage when they are not - /// declared in an extern C context, but a previous decl is. - bool hasCLanguageLinkage() const; + /// Compute the language linkage. + LanguageLinkage getLanguageLinkage() const; + + bool hasCLanguageLinkage() const { + return getLanguageLinkage() == CLanguageLinkage; + } /// \brief Determines whether this is a global function. bool isGlobal() const; diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h index 5a9e9fedfa..3248d23f42 100644 --- a/include/clang/AST/DeclBase.h +++ b/include/clang/AST/DeclBase.h @@ -1090,6 +1090,10 @@ public: /// a C++ extern "C" linkage spec. bool isExternCContext() const; + /// \brief Determines whether this context is, or is nested within, + /// a C++ extern "C++" linkage spec. + bool isExternCXXContext() const; + /// \brief Determine whether this declaration context is equivalent /// to the declaration context DC. bool Equals(const DeclContext *DC) const { diff --git a/include/clang/Basic/Linkage.h b/include/clang/Basic/Linkage.h index 6bc1f5d5ef..01b8db15f5 100644 --- a/include/clang/Basic/Linkage.h +++ b/include/clang/Basic/Linkage.h @@ -42,6 +42,14 @@ enum Linkage { ExternalLinkage }; +/// \brief Describes the different kinds of language linkage +/// (C++ [dcl.link]) that an entity may have. +enum LanguageLinkage { + CLanguageLinkage, + CXXLanguageLinkage, + NoLanguageLinkage +}; + /// \brief A more specific kind of linkage than enum Linkage. /// /// This is relevant to CodeGen and AST file reading. |