From 3c46e8db99196179b30e7ac5c20c4efd5f3926d7 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 26 Jul 2010 21:25:24 +0000 Subject: [PATCH] Fix namespace polution. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109440 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/ExprConstant.cpp | 6 +++++- lib/Analysis/FormatStringParsing.h | 3 ++- lib/Analysis/ScanfFormatString.cpp | 1 + lib/Basic/Diagnostic.cpp | 4 ++++ lib/Lex/PPExpressions.cpp | 4 ++++ lib/Sema/AnalysisBasedWarnings.cpp | 4 ++++ lib/Sema/SemaCXXCast.cpp | 2 +- lib/Sema/SemaDecl.cpp | 3 +++ lib/Sema/SemaStmt.cpp | 4 ++++ 9 files changed, 28 insertions(+), 3 deletions(-) diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 3c97420332..b74b327c9c 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -2321,6 +2321,8 @@ APSInt Expr::EvaluateAsInt(ASTContext &Ctx) const { // the comma operator in C99 mode. // 2: This expression is not an ICE, and is not a legal subexpression for one. +namespace { + struct ICEDiag { unsigned Val; SourceLocation Loc; @@ -2330,7 +2332,9 @@ struct ICEDiag { ICEDiag() : Val(0) {} }; -ICEDiag NoDiag() { return ICEDiag(); } +} + +static ICEDiag NoDiag() { return ICEDiag(); } static ICEDiag CheckEvalInICE(const Expr* E, ASTContext &Ctx) { Expr::EvalResult EVResult; diff --git a/lib/Analysis/FormatStringParsing.h b/lib/Analysis/FormatStringParsing.h index 49d9735f80..607e99ccd0 100644 --- a/lib/Analysis/FormatStringParsing.h +++ b/lib/Analysis/FormatStringParsing.h @@ -6,6 +6,8 @@ #include "clang/AST/Type.h" #include "llvm/Support/raw_ostream.h" +namespace clang { + template class UpdateOnReturn { T &ValueToUpdate; @@ -19,7 +21,6 @@ public: } }; -namespace clang { namespace analyze_format_string { OptionalAmount ParseAmount(const char *&Beg, const char *E); diff --git a/lib/Analysis/ScanfFormatString.cpp b/lib/Analysis/ScanfFormatString.cpp index d65352ac87..4c2c4c6fb9 100644 --- a/lib/Analysis/ScanfFormatString.cpp +++ b/lib/Analysis/ScanfFormatString.cpp @@ -22,6 +22,7 @@ using clang::analyze_format_string::OptionalAmount; using clang::analyze_format_string::ConversionSpecifier; using clang::analyze_scanf::ScanfConversionSpecifier; using clang::analyze_scanf::ScanfSpecifier; +using clang::UpdateOnReturn; typedef clang::analyze_format_string::SpecifierResult ScanfSpecifierResult; diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp index f956f1aec8..74937910d9 100644 --- a/lib/Basic/Diagnostic.cpp +++ b/lib/Basic/Diagnostic.cpp @@ -38,6 +38,8 @@ using namespace clang; // Builtin Diagnostic information //===----------------------------------------------------------------------===// +namespace { + // Diagnostic classes. enum { CLASS_NOTE = 0x01, @@ -64,6 +66,8 @@ struct StaticDiagInfoRec { } }; +} + static const StaticDiagInfoRec StaticDiagInfo[] = { #define DIAG(ENUM,CLASS,DEFAULT_MAPPING,DESC,GROUP,SFINAE, CATEGORY) \ { diag::ENUM, DEFAULT_MAPPING, CLASS, SFINAE, CATEGORY, DESC, GROUP }, diff --git a/lib/Lex/PPExpressions.cpp b/lib/Lex/PPExpressions.cpp index 756ce27a93..9920c4cb7c 100644 --- a/lib/Lex/PPExpressions.cpp +++ b/lib/Lex/PPExpressions.cpp @@ -24,6 +24,8 @@ #include "llvm/ADT/APSInt.h" using namespace clang; +namespace { + /// PPValue - Represents the value of a subexpression of a preprocessor /// conditional and the source range covered by it. class PPValue { @@ -47,6 +49,8 @@ public: void setEnd(SourceLocation L) { Range.setEnd(L); } }; +} + static bool EvaluateDirectiveSubExpr(PPValue &LHS, unsigned MinPrec, Token &PeekTok, bool ValueLive, Preprocessor &PP); diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp index 3c09122394..3d2c45f3f8 100644 --- a/lib/Sema/AnalysisBasedWarnings.cpp +++ b/lib/Sema/AnalysisBasedWarnings.cpp @@ -197,6 +197,8 @@ static ControlFlowKind CheckFallThrough(AnalysisContext &AC) { return AlwaysFallThrough; } +namespace { + struct CheckFallThroughDiagnostics { unsigned diag_MaybeFallThrough_HasNoReturn; unsigned diag_MaybeFallThrough_ReturnsNonVoid; @@ -266,6 +268,8 @@ struct CheckFallThroughDiagnostics { } }; +} + /// CheckFallThroughForFunctionDef - Check that we don't fall off the end of a /// function that should return a value. Check that we don't fall off the end /// of a noreturn function. We assume that functions and blocks not marked diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp index 787bd00ac8..29e9051082 100644 --- a/lib/Sema/SemaCXXCast.cpp +++ b/lib/Sema/SemaCXXCast.cpp @@ -197,7 +197,7 @@ Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, /// the same kind of pointer (plain or to-member). Unlike the Sema function, /// this one doesn't care if the two pointers-to-member don't point into the /// same class. This is because CastsAwayConstness doesn't care. -bool UnwrapDissimilarPointerTypes(QualType& T1, QualType& T2) { +static bool UnwrapDissimilarPointerTypes(QualType& T1, QualType& T2) { const PointerType *T1PtrType = T1->getAs(), *T2PtrType = T2->getAs(); if (T1PtrType && T2PtrType) { diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 11e1ffe107..1788eb7722 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -929,6 +929,8 @@ static void MergeAttributes(Decl *New, Decl *Old, ASTContext &C) { } } +namespace { + /// Used in MergeFunctionDecl to keep track of function parameters in /// C. struct GNUCompatibleParamWarning { @@ -937,6 +939,7 @@ struct GNUCompatibleParamWarning { QualType PromotedType; }; +} /// getSpecialMember - get the special member enum for a method. Sema::CXXSpecialMember Sema::getSpecialMember(const CXXMethodDecl *MD) { diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 58131daf83..b4d207eab1 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -1577,6 +1577,8 @@ Sema::ActOnCXXCatchBlock(SourceLocation CatchLoc, DeclPtrTy ExDecl, HandlerBlock.takeAs())); } +namespace { + class TypeWithHandler { QualType t; CXXCatchStmt *stmt; @@ -1606,6 +1608,8 @@ public: } }; +} + /// ActOnCXXTryBlock - Takes a try compound-statement and a number of /// handlers and creates a try statement from them. Action::OwningStmtResult -- 2.40.0