From ea62bd9c83d2c271c3596f9e3342be8d34f9160f Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Wed, 28 Oct 2015 13:54:16 +0000 Subject: [PATCH] Put global classes into the appropriate namespace. Most of the cases belong into an anonymous namespace. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251514 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Sema/CodeCompleteOptions.h | 4 ++++ lib/CodeGen/CGBuiltin.cpp | 4 +++- lib/CodeGen/CGOpenMPRuntime.cpp | 2 +- lib/Driver/ToolChains.cpp | 2 ++ lib/Driver/Tools.cpp | 2 ++ lib/Parse/ParsePragma.cpp | 4 ++++ lib/Sema/SemaDecl.cpp | 2 ++ lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | 2 ++ 8 files changed, 20 insertions(+), 2 deletions(-) diff --git a/include/clang/Sema/CodeCompleteOptions.h b/include/clang/Sema/CodeCompleteOptions.h index e43496f55b..fc7713c795 100644 --- a/include/clang/Sema/CodeCompleteOptions.h +++ b/include/clang/Sema/CodeCompleteOptions.h @@ -10,6 +10,8 @@ #ifndef LLVM_CLANG_SEMA_CODECOMPLETEOPTIONS_H #define LLVM_CLANG_SEMA_CODECOMPLETEOPTIONS_H +namespace clang { + /// Options controlling the behavior of code completion. class CodeCompleteOptions { public: @@ -33,5 +35,7 @@ public: { } }; +} // namespace clang + #endif diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index 7a3bec1bb1..8b8b54ddeb 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -2111,7 +2111,8 @@ enum { AddRetType | VectorizeRetType | Add1ArgType | InventFloatType }; - struct NeonIntrinsicInfo { +namespace { +struct NeonIntrinsicInfo { unsigned BuiltinID; unsigned LLVMIntrinsic; unsigned AltLLVMIntrinsic; @@ -2122,6 +2123,7 @@ enum { return BuiltinID < RHSBuiltinID; } }; +} // end anonymous namespace #define NEONMAP0(NameBase) \ { NEON::BI__builtin_neon_ ## NameBase, 0, 0, #NameBase, 0 } diff --git a/lib/CodeGen/CGOpenMPRuntime.cpp b/lib/CodeGen/CGOpenMPRuntime.cpp index fc3771c58f..30811824d5 100644 --- a/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/lib/CodeGen/CGOpenMPRuntime.cpp @@ -2601,7 +2601,7 @@ void CGOpenMPRuntime::emitTaskCall( /// (references element of array in original variable). /// \param RedOpGen Generator of reduction operation with use of LHSVar and /// RHSVar. -void EmitOMPAggregateReduction( +static void EmitOMPAggregateReduction( CodeGenFunction &CGF, QualType Type, const VarDecl *LHSVar, const VarDecl *RHSVar, const llvm::function_refgetOption().matches(options::OPT_mmicromips); } +namespace { struct DetectedMultilibs { /// The set of multilibs that the detected installation supports. MultilibSet Multilibs; @@ -1573,6 +1574,7 @@ struct DetectedMultilibs { /// targeting the non-default multilib. Otherwise, it is empty. llvm::Optional BiarchSibling; }; +} // end anonymous namespace static Multilib makeMultilib(StringRef commonSuffix) { return Multilib(commonSuffix, commonSuffix, commonSuffix); diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 1c6f86f8b5..e90e616bbf 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -5369,12 +5369,14 @@ static bool maybeConsumeDash(const std::string &EH, size_t &I) { return !HaveDash; } +namespace { struct EHFlags { EHFlags() : Synch(false), Asynch(false), NoExceptC(false) {} bool Synch; bool Asynch; bool NoExceptC; }; +} // end anonymous namespace /// /EH controls whether to run destructor cleanups when exceptions are /// thrown. There are three modifiers: diff --git a/lib/Parse/ParsePragma.cpp b/lib/Parse/ParsePragma.cpp index ab2b52ec39..4430eb8d03 100644 --- a/lib/Parse/ParsePragma.cpp +++ b/lib/Parse/ParsePragma.cpp @@ -334,6 +334,7 @@ void Parser::HandlePragmaVisibility() { Actions.ActOnPragmaVisibility(VisType, VisLoc); } +namespace { struct PragmaPackInfo { Sema::PragmaPackKind Kind; IdentifierInfo *Name; @@ -341,6 +342,7 @@ struct PragmaPackInfo { SourceLocation LParenLoc; SourceLocation RParenLoc; }; +} // end anonymous namespace void Parser::HandlePragmaPack() { assert(Tok.is(tok::annot_pragma_pack)); @@ -750,11 +752,13 @@ bool Parser::HandlePragmaMSInitSeg(StringRef PragmaName, return true; } +namespace { struct PragmaLoopHintInfo { Token PragmaName; Token Option; ArrayRef Toks; }; +} // end anonymous namespace static std::string PragmaLoopHintString(Token PragmaName, Token Option) { std::string PragmaString; diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 43fe994784..622ff1ebbc 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -14011,6 +14011,7 @@ static bool ValidDuplicateEnum(EnumConstantDecl *ECD, EnumDecl *Enum) { return false; } +namespace { struct DupKey { int64_t val; bool isTombstoneOrEmptyKey; @@ -14034,6 +14035,7 @@ struct DenseMapInfoDupKey { LHS.val == RHS.val; } }; +} // end anonymous namespace // Emits a warning when an element is implicitly set a value that // a previous element has already been set to. diff --git a/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp index db2416c538..f983c30856 100644 --- a/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -2192,6 +2192,7 @@ PathDiagnosticPiece *CFRefReportVisitor::VisitNode(const ExplodedNode *N, return P; } +namespace { // Find the first node in the current function context that referred to the // tracked symbol and the memory location that value was stored to. Note, the // value is only reported if the allocation occurred in the same function as @@ -2206,6 +2207,7 @@ struct AllocationInfo { const LocationContext *InInterestingMethodContext) : N(InN), R(InR), InterestingMethodContext(InInterestingMethodContext) {} }; +} // end anonymous namespace static AllocationInfo GetAllocationSite(ProgramStateManager& StateMgr, const ExplodedNode *N, -- 2.40.0