aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-02-06 11:13:08 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-02-06 11:13:08 +0000
commit5bbc385ad2d8e487edfbc2756eaf4fb0b920cfe4 (patch)
treebfca2c6fa55e99c087addcc911ded14d84efb7b7
parent4cf96bb9dfebf58b127849eecd141337a2da195d (diff)
Move instantiateTemplateAttribute into the sema namespace, make helpers static.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149864 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Frontend/LayoutOverrideSource.cpp2
-rw-r--r--lib/Lex/ModuleMap.cpp3
-rw-r--r--lib/Sema/SemaExpr.cpp2
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp8
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp4
-rw-r--r--utils/TableGen/ClangAttrEmitter.cpp8
6 files changed, 18 insertions, 9 deletions
diff --git a/lib/Frontend/LayoutOverrideSource.cpp b/lib/Frontend/LayoutOverrideSource.cpp
index 9cc0667850..eb7865e112 100644
--- a/lib/Frontend/LayoutOverrideSource.cpp
+++ b/lib/Frontend/LayoutOverrideSource.cpp
@@ -15,7 +15,7 @@
using namespace clang;
/// \brief Parse a simple identifier.
-std::string parseName(StringRef S) {
+static std::string parseName(StringRef S) {
unsigned Offset = 0;
while (Offset < S.size() &&
(isalpha(S[Offset]) || S[Offset] == '_' ||
diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp
index 84ac08081e..1f56a2f941 100644
--- a/lib/Lex/ModuleMap.cpp
+++ b/lib/Lex/ModuleMap.cpp
@@ -1015,7 +1015,8 @@ void ModuleMapParser::parseRequiresDecl() {
/// \brief Append to \p Paths the set of paths needed to get to the
/// subframework in which the given module lives.
-void appendSubframeworkPaths(Module *Mod, llvm::SmallVectorImpl<char> &Path) {
+static void appendSubframeworkPaths(Module *Mod,
+ llvm::SmallVectorImpl<char> &Path) {
// Collect the framework names from the given module to the top-level module.
llvm::SmallVector<StringRef, 2> Paths;
for (; Mod; Mod = Mod->Parent) {
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 2a9fd61d9c..15dfb0b8c2 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -9325,7 +9325,7 @@ ExprResult Sema::HandleExprEvaluationContextForTypeof(Expr *E) {
return TranformToPotentiallyEvaluated(E);
}
-bool IsPotentiallyEvaluatedContext(Sema &SemaRef) {
+static bool IsPotentiallyEvaluatedContext(Sema &SemaRef) {
// Do not mark anything as "used" within a dependent context; wait for
// an instantiation.
if (SemaRef.CurContext->isDependentContext())
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index dde782672f..8abb6e149a 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -1665,8 +1665,12 @@ Sema::SubstBaseSpecifiers(CXXRecordDecl *Instantiation,
}
// Defined via #include from SemaTemplateInstantiateDecl.cpp
-Attr* instantiateTemplateAttribute(const Attr *At, ASTContext &C, Sema &S,
- const MultiLevelTemplateArgumentList &TemplateArgs);
+namespace clang {
+ namespace sema {
+ Attr *instantiateTemplateAttribute(const Attr *At, ASTContext &C, Sema &S,
+ const MultiLevelTemplateArgumentList &TemplateArgs);
+ }
+}
/// \brief Instantiate the definition of a class from a given pattern.
///
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index a957f25ef2..3cf816a332 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -100,8 +100,8 @@ void Sema::InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs,
Saved = CurrentInstantiationScope->cloneScopes(OuterMostScope);
LateAttrs->push_back(LateInstantiatedAttribute(TmplAttr, Saved, New));
} else {
- Attr *NewAttr =
- instantiateTemplateAttribute(TmplAttr, Context, *this, TemplateArgs);
+ Attr *NewAttr = sema::instantiateTemplateAttribute(TmplAttr, Context,
+ *this, TemplateArgs);
New->addAttr(NewAttr);
}
}
diff --git a/utils/TableGen/ClangAttrEmitter.cpp b/utils/TableGen/ClangAttrEmitter.cpp
index 7db1ababb1..38889ec98c 100644
--- a/utils/TableGen/ClangAttrEmitter.cpp
+++ b/utils/TableGen/ClangAttrEmitter.cpp
@@ -942,7 +942,9 @@ void ClangAttrTemplateInstantiateEmitter::run(raw_ostream &OS) {
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
- OS << "Attr* instantiateTemplateAttribute(const Attr *At, ASTContext &C, "
+ OS << "namespace clang {\n"
+ << "namespace sema {\n\n"
+ << "Attr *instantiateTemplateAttribute(const Attr *At, ASTContext &C, "
<< "Sema &S,\n"
<< " const MultiLevelTemplateArgumentList &TemplateArgs) {\n"
<< " switch (At->getKind()) {\n"
@@ -992,6 +994,8 @@ void ClangAttrTemplateInstantiateEmitter::run(raw_ostream &OS) {
OS << " } // end switch\n"
<< " llvm_unreachable(\"Unknown attribute!\");\n"
<< " return 0;\n"
- << "}\n\n";
+ << "}\n\n"
+ << "} // end namespace sema\n"
+ << "} // end namespace clang\n";
}