]> granicus.if.org Git - clang/commitdiff
Fix namespace polution.
authorDan Gohman <gohman@apple.com>
Mon, 26 Jul 2010 21:25:24 +0000 (21:25 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 26 Jul 2010 21:25:24 +0000 (21:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109440 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ExprConstant.cpp
lib/Analysis/FormatStringParsing.h
lib/Analysis/ScanfFormatString.cpp
lib/Basic/Diagnostic.cpp
lib/Lex/PPExpressions.cpp
lib/Sema/AnalysisBasedWarnings.cpp
lib/Sema/SemaCXXCast.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaStmt.cpp

index 3c9742033265598504369b67f22c7b766e46f03c..b74b327c9cac42e37b07ed415624bf2757e96e67 100644 (file)
@@ -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;
index 49d9735f806dd825ec0b17cf9852426b3208d169..607e99ccd076a2dd545e15228e3eeb811bce093f 100644 (file)
@@ -6,6 +6,8 @@
 #include "clang/AST/Type.h"
 #include "llvm/Support/raw_ostream.h"
 
+namespace clang {
+
 template <typename T>
 class UpdateOnReturn {
   T &ValueToUpdate;
@@ -19,7 +21,6 @@ public:
   }
 };
 
-namespace clang {
 namespace analyze_format_string {
   
 OptionalAmount ParseAmount(const char *&Beg, const char *E);
index d65352ac879ed5dec78aa758b10bc5e16f832c9f..4c2c4c6fb9fe43c8463ccd2245030eba26901709 100644 (file)
@@ -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<ScanfSpecifier>
         ScanfSpecifierResult;
index f956f1aec85fd1ac7db712401fb536909c58a659..74937910d93be77ca7b54cfcd173c54cb8bc980a 100644 (file)
@@ -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 },
index 756ce27a93dcba9a56be6ded9a11a035459bb7fb..9920c4cb7cf85331ee607555a59e889278c57789 100644 (file)
@@ -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);
index 3c09122394228185bbc2eee7466fa33179daa7ac..3d2c45f3f83c512fe1e96fd46350d045dfe3f437 100644 (file)
@@ -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
index 787bd00ac818243a0e48af3597ebb988e8d58f6e..29e9051082d204fb24e05db0f0def12728049c03 100644 (file)
@@ -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<PointerType>(),
                     *T2PtrType = T2->getAs<PointerType>();
   if (T1PtrType && T2PtrType) {
index 11e1ffe107a59ff48557ec1be9de00ab9f23ae14..1788eb77226299adaefeef93895884df7c6ba30a 100644 (file)
@@ -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) {
index 58131daf8301d24dc340c8a028a24551ca17751c..b4d207eab1138fee2c6792ce956456ca50bccbb5 100644 (file)
@@ -1577,6 +1577,8 @@ Sema::ActOnCXXCatchBlock(SourceLocation CatchLoc, DeclPtrTy ExDecl,
                                           HandlerBlock.takeAs<Stmt>()));
 }
 
+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