[cfe-commits] r109440 - in /cfe/trunk/lib: AST/ExprConstant.cpp Analysis/FormatStringParsing.h Analysis/ScanfFormatString.cpp Basic/Diagnostic.cpp Lex/PPExpressions.cpp Sema/AnalysisBasedWarnings.cpp Sema/SemaCXXCast.cpp Sema/SemaDecl.cpp Sema/SemaStmt.cpp

Dan Gohman gohman at apple.com
Mon Jul 26 14:25:24 PDT 2010


Author: djg
Date: Mon Jul 26 16:25:24 2010
New Revision: 109440

URL: http://llvm.org/viewvc/llvm-project?rev=109440&view=rev
Log:
Fix namespace polution.

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

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=109440&r1=109439&r2=109440&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Mon Jul 26 16:25:24 2010
@@ -2321,6 +2321,8 @@
 //    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 @@
   ICEDiag() : Val(0) {}
 };
 
-ICEDiag NoDiag() { return ICEDiag(); }
+}
+
+static ICEDiag NoDiag() { return ICEDiag(); }
 
 static ICEDiag CheckEvalInICE(const Expr* E, ASTContext &Ctx) {
   Expr::EvalResult EVResult;

Modified: cfe/trunk/lib/Analysis/FormatStringParsing.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/FormatStringParsing.h?rev=109440&r1=109439&r2=109440&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/FormatStringParsing.h (original)
+++ cfe/trunk/lib/Analysis/FormatStringParsing.h Mon Jul 26 16:25:24 2010
@@ -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 @@
   }
 };
 
-namespace clang {
 namespace analyze_format_string {
   
 OptionalAmount ParseAmount(const char *&Beg, const char *E);

Modified: cfe/trunk/lib/Analysis/ScanfFormatString.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ScanfFormatString.cpp?rev=109440&r1=109439&r2=109440&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ScanfFormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/ScanfFormatString.cpp Mon Jul 26 16:25:24 2010
@@ -22,6 +22,7 @@
 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;

Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=109440&r1=109439&r2=109440&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Mon Jul 26 16:25:24 2010
@@ -38,6 +38,8 @@
 // Builtin Diagnostic information
 //===----------------------------------------------------------------------===//
 
+namespace {
+
 // Diagnostic classes.
 enum {
   CLASS_NOTE       = 0x01,
@@ -64,6 +66,8 @@
   }
 };
 
+}
+
 static const StaticDiagInfoRec StaticDiagInfo[] = {
 #define DIAG(ENUM,CLASS,DEFAULT_MAPPING,DESC,GROUP,SFINAE, CATEGORY)    \
   { diag::ENUM, DEFAULT_MAPPING, CLASS, SFINAE, CATEGORY, DESC, GROUP },

Modified: cfe/trunk/lib/Lex/PPExpressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPExpressions.cpp?rev=109440&r1=109439&r2=109440&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPExpressions.cpp (original)
+++ cfe/trunk/lib/Lex/PPExpressions.cpp Mon Jul 26 16:25:24 2010
@@ -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 @@
   void setEnd(SourceLocation L) { Range.setEnd(L); }
 };
 
+}
+
 static bool EvaluateDirectiveSubExpr(PPValue &LHS, unsigned MinPrec,
                                      Token &PeekTok, bool ValueLive,
                                      Preprocessor &PP);

Modified: cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp?rev=109440&r1=109439&r2=109440&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp (original)
+++ cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp Mon Jul 26 16:25:24 2010
@@ -197,6 +197,8 @@
   return AlwaysFallThrough;
 }
 
+namespace {
+
 struct CheckFallThroughDiagnostics {
   unsigned diag_MaybeFallThrough_HasNoReturn;
   unsigned diag_MaybeFallThrough_ReturnsNonVoid;
@@ -266,6 +268,8 @@
   }
 };
 
+}
+
 /// 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

Modified: cfe/trunk/lib/Sema/SemaCXXCast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCXXCast.cpp?rev=109440&r1=109439&r2=109440&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXCast.cpp Mon Jul 26 16:25:24 2010
@@ -197,7 +197,7 @@
 /// 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) {

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=109440&r1=109439&r2=109440&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Jul 26 16:25:24 2010
@@ -929,6 +929,8 @@
   }
 }
 
+namespace {
+
 /// Used in MergeFunctionDecl to keep track of function parameters in
 /// C.
 struct GNUCompatibleParamWarning {
@@ -937,6 +939,7 @@
   QualType PromotedType;
 };
 
+}
 
 /// getSpecialMember - get the special member enum for a method.
 Sema::CXXSpecialMember Sema::getSpecialMember(const CXXMethodDecl *MD) {

Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=109440&r1=109439&r2=109440&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Mon Jul 26 16:25:24 2010
@@ -1577,6 +1577,8 @@
                                           HandlerBlock.takeAs<Stmt>()));
 }
 
+namespace {
+
 class TypeWithHandler {
   QualType t;
   CXXCatchStmt *stmt;
@@ -1606,6 +1608,8 @@
   }
 };
 
+}
+
 /// ActOnCXXTryBlock - Takes a try compound-statement and a number of
 /// handlers and creates a try statement from them.
 Action::OwningStmtResult





More information about the cfe-commits mailing list