aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-08-26 09:15:37 +0000
committerJohn McCall <rjmccall@apple.com>2010-08-26 09:15:37 +0000
commitea318642072d3d94b5c3cff0fa6f4b33d2db0768 (patch)
tree2780521c7b66a98236c295de928ff6badb50c129 /lib
parenta8b7a7d3eaa51dd200cba1e5541f2542d24d7a6e (diff)
Move things around so that Sema.h no longer depends on even DeclBase.h.
It still depends on Type because DeclarationName.h does. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112177 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaAttr.cpp22
-rw-r--r--lib/Sema/SemaDeclCXX.cpp12
2 files changed, 20 insertions, 14 deletions
diff --git a/lib/Sema/SemaAttr.cpp b/lib/Sema/SemaAttr.cpp
index 4ba1a236ff..917bf2bc3b 100644
--- a/lib/Sema/SemaAttr.cpp
+++ b/lib/Sema/SemaAttr.cpp
@@ -315,6 +315,16 @@ void Sema::FreeVisContext() {
VisContext = 0;
}
+static void PushPragmaVisibility(Sema &S, VisibilityAttr::VisibilityType type,
+ SourceLocation loc) {
+ // Put visibility on stack.
+ if (!S.VisContext)
+ S.VisContext = new VisStack;
+
+ VisStack *Stack = static_cast<VisStack*>(S.VisContext);
+ Stack->push_back(std::make_pair(type, loc));
+}
+
void Sema::ActOnPragmaVisibility(bool IsPush, const IdentifierInfo* VisType,
SourceLocation PragmaLoc) {
if (IsPush) {
@@ -333,20 +343,14 @@ void Sema::ActOnPragmaVisibility(bool IsPush, const IdentifierInfo* VisType,
VisType->getName();
return;
}
- PushPragmaVisibility(type, PragmaLoc);
+ PushPragmaVisibility(*this, type, PragmaLoc);
} else {
PopPragmaVisibility();
}
}
-void Sema::PushPragmaVisibility(VisibilityAttr::VisibilityType type,
- SourceLocation loc) {
- // Put visibility on stack.
- if (!VisContext)
- VisContext = new VisStack;
-
- VisStack *Stack = static_cast<VisStack*>(VisContext);
- Stack->push_back(std::make_pair(type, loc));
+void Sema::PushVisibilityAttr(const VisibilityAttr *Attr) {
+ PushPragmaVisibility(*this, Attr->getVisibility(), Attr->getLocation());
}
void Sema::PopPragmaVisibility() {
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 20d1177a21..223569d9d4 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -3277,13 +3277,15 @@ Decl *Sema::ActOnConversionDeclarator(CXXConversionDecl *Conversion) {
// Namespace Handling
//===----------------------------------------------------------------------===//
+
+
/// ActOnStartNamespaceDef - This is called at the start of a namespace
/// definition.
Decl *Sema::ActOnStartNamespaceDef(Scope *NamespcScope,
- SourceLocation IdentLoc,
- IdentifierInfo *II,
- SourceLocation LBrace,
- AttributeList *AttrList) {
+ SourceLocation IdentLoc,
+ IdentifierInfo *II,
+ SourceLocation LBrace,
+ AttributeList *AttrList) {
// anonymous namespace starts at its left brace
NamespaceDecl *Namespc = NamespaceDecl::Create(Context, CurContext,
(II ? IdentLoc : LBrace) , II);
@@ -3294,7 +3296,7 @@ Decl *Sema::ActOnStartNamespaceDef(Scope *NamespcScope,
ProcessDeclAttributeList(DeclRegionScope, Namespc, AttrList);
if (const VisibilityAttr *attr = Namespc->getAttr<VisibilityAttr>())
- PushPragmaVisibility(attr->getVisibility(), attr->getLocation());
+ PushVisibilityAttr(attr);
if (II) {
// C++ [namespace.def]p2: