diff --git a/examples/PrintFunctionNames/PrintFunctionNames.cpp b/examples/PrintFunctionNames/PrintFunctionNames.cpp
index 9f8f6e3f050a5650fadc268528b754b5bfafff58..7eb8e93cb7ca1b4c7d21fe0a2f6b0ba86d2300e4 100644
--- a/examples/PrintFunctionNames/PrintFunctionNames.cpp
+++ b/examples/PrintFunctionNames/PrintFunctionNames.cpp
@@ -117,7 +117,7 @@ protected:
 
 };
 
-}
+} // namespace
 
 static FrontendPluginRegistry::Add<PrintFunctionNamesAction>
 X("print-fns", "print function names");
diff --git a/include/clang/ARCMigrate/ARCMTActions.h b/include/clang/ARCMigrate/ARCMTActions.h
index c830aa3d78744e2609ce483018ac10b6edbf1363..cfcf4e96288189d14189fb079afadc8650b07c4e 100644
--- a/include/clang/ARCMigrate/ARCMTActions.h
+++ b/include/clang/ARCMigrate/ARCMTActions.h
@@ -70,7 +70,7 @@ protected:
   bool BeginInvocation(CompilerInstance &CI) override;
 };
 
-}
-}
+} // namespace arcmt
+} // namespace clang
 
 #endif
diff --git a/include/clang/AST/ASTImporter.h b/include/clang/AST/ASTImporter.h
index ee48955ca63625fdb8175fed838042028f3c40f5..f215b1c3cfdda5f20b9390632034f3f7355848c1 100644
--- a/include/clang/AST/ASTImporter.h
+++ b/include/clang/AST/ASTImporter.h
@@ -290,6 +290,6 @@ namespace clang {
     bool IsStructurallyEquivalent(QualType From, QualType To,
                                   bool Complain = true);
   };
-}
+} // namespace clang
 
 #endif // LLVM_CLANG_AST_ASTIMPORTER_H
diff --git a/include/clang/AST/ASTLambda.h b/include/clang/AST/ASTLambda.h
index 69df2d8c01138dc992f2c8a79fd9495c90ee02ba..82294b11bc5eb97fcd402cc925705651029083be 100644
--- a/include/clang/AST/ASTLambda.h
+++ b/include/clang/AST/ASTLambda.h
@@ -75,6 +75,6 @@ inline DeclContext *getLambdaAwareParentOfDeclContext(DeclContext *DC) {
     return DC->getParent();
 }
 
-} // clang
+} // namespace clang
 
 #endif
diff --git a/include/clang/AST/ASTVector.h b/include/clang/AST/ASTVector.h
index 6ec054582e263452c7b8c10cc8f0bb6c3f5f3ae3..cddb766a3b4cd96204980b03c20dce91aa1cf354 100644
--- a/include/clang/AST/ASTVector.h
+++ b/include/clang/AST/ASTVector.h
@@ -400,5 +400,5 @@ void ASTVector<T>::grow(const ASTContext &C, size_t MinSize) {
   Capacity.setPointer(Begin+NewCapacity);
 }
 
-} // end: clang namespace
+} // namespace clang
 #endif
diff --git a/include/clang/AST/BaseSubobject.h b/include/clang/AST/BaseSubobject.h
index da538e3566a7ac738610220d51fa0539ef80543b..585d786ac6ac774c06e2e05536853fe1846b2da0 100644
--- a/include/clang/AST/BaseSubobject.h
+++ b/include/clang/AST/BaseSubobject.h
@@ -82,6 +82,6 @@ template <> struct isPodLike<clang::BaseSubobject> {
   static const bool value = true;
 };
 
-}
+} // namespace llvm
 
 #endif
diff --git a/include/clang/AST/CanonicalType.h b/include/clang/AST/CanonicalType.h
index b25800bfedb91f99cfffc0a77fc0cd3cf066c72f..4a25a06b447c65eec646c7053375cc1f65446eaa 100644
--- a/include/clang/AST/CanonicalType.h
+++ b/include/clang/AST/CanonicalType.h
@@ -659,7 +659,7 @@ CanProxy<Type> CanTypeIterator<InputIterator>::operator->() const {
   return CanProxy<Type>(*this);
 }
 
-}
+} // namespace clang
 
 
 #endif
diff --git a/include/clang/AST/DeclAccessPair.h b/include/clang/AST/DeclAccessPair.h
index 3c5056c6e55b3b6909137f308833cdda31612916..3527a160aa8c8c05ffa993423f5bd013b111538a 100644
--- a/include/clang/AST/DeclAccessPair.h
+++ b/include/clang/AST/DeclAccessPair.h
@@ -59,7 +59,7 @@ public:
   operator NamedDecl*() const { return getDecl(); }
   NamedDecl *operator->() const { return getDecl(); }
 };
-}
+} // namespace clang
 
 // Take a moment to tell SmallVector that DeclAccessPair is POD.
 namespace llvm {
diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h
index 6b6ac3f7d5a51357e5638f635997e19f8e0cbe12..316f8d16db533af0ea0375fb584296598404b562 100644
--- a/include/clang/AST/DeclBase.h
+++ b/include/clang/AST/DeclBase.h
@@ -54,7 +54,7 @@ class Stmt;
 class StoredDeclsMap;
 class TranslationUnitDecl;
 class UsingDirectiveDecl;
-}
+} // namespace clang
 
 namespace clang {
 
@@ -1799,7 +1799,7 @@ struct cast_convert_decl_context<ToTy, true> {
 };
 
 
-} // end clang.
+} // namespace clang
 
 namespace llvm {
 
diff --git a/include/clang/AST/DeclFriend.h b/include/clang/AST/DeclFriend.h
index 12b93b408a7037c99518e3fb08efe2843294b701..8a4105b2b1fddffca0c767d1b4f91634d93a91fc 100644
--- a/include/clang/AST/DeclFriend.h
+++ b/include/clang/AST/DeclFriend.h
@@ -242,6 +242,6 @@ inline void CXXRecordDecl::pushFriendDecl(FriendDecl *FD) {
   data().FirstFriend = FD;
 }
   
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/AST/DeclGroup.h b/include/clang/AST/DeclGroup.h
index bd3dbd8fa7876ac9a70e98962b2e3430cc5af92e..621ba9feb43d1919927ac6f2e75b735008a055a9 100644
--- a/include/clang/AST/DeclGroup.h
+++ b/include/clang/AST/DeclGroup.h
@@ -134,7 +134,7 @@ public:
   }
 };
 
-} // end clang namespace
+} // namespace clang
 
 namespace llvm {
   // DeclGroupRef is "like a pointer", implement PointerLikeTypeTraits.
@@ -151,5 +151,5 @@ namespace llvm {
     }
     enum { NumLowBitsAvailable = 0 };
   };
-}
+} // namespace llvm
 #endif
diff --git a/include/clang/AST/DependentDiagnostic.h b/include/clang/AST/DependentDiagnostic.h
index 8e038c83c9890410bb7ee5f58ee3509e1868c49c..df2ca7b5d880ae585e3d5c027efc4428cebafd73 100644
--- a/include/clang/AST/DependentDiagnostic.h
+++ b/include/clang/AST/DependentDiagnostic.h
@@ -184,6 +184,6 @@ inline DeclContext::ddiag_range DeclContext::ddiags() const {
   return ddiag_range(ddiag_iterator(Map->FirstDiagnostic), ddiag_iterator());
 }
 
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/AST/EvaluatedExprVisitor.h b/include/clang/AST/EvaluatedExprVisitor.h
index 5cae5d9eca3f42453851f5217f62b10863376759..1a7a130d831bb72244dc7012531c49683bcc42b0 100644
--- a/include/clang/AST/EvaluatedExprVisitor.h
+++ b/include/clang/AST/EvaluatedExprVisitor.h
@@ -124,6 +124,6 @@ public:
     EvaluatedExprVisitorBase<make_const_ptr, ImplClass>(Context) { }
 };
 
-}
+} // namespace clang
 
 #endif // LLVM_CLANG_AST_EVALUATEDEXPRVISITOR_H
diff --git a/include/clang/AST/ExternalASTSource.h b/include/clang/AST/ExternalASTSource.h
index 9a76080762140ae9de15803ffeac30cb2f9a6420..2cb25d1ec61087762cdaa6b3c1bb841ecdd6c99a 100644
--- a/include/clang/AST/ExternalASTSource.h
+++ b/include/clang/AST/ExternalASTSource.h
@@ -467,7 +467,7 @@ struct PointerLikeTypeTraits<
     NumLowBitsAvailable = PointerLikeTypeTraits<T>::NumLowBitsAvailable - 1
   };
 };
-}
+} // namespace llvm
 
 namespace clang {
 /// \brief Represents a lazily-loaded vector of data.
diff --git a/include/clang/AST/Mangle.h b/include/clang/AST/Mangle.h
index c5a7ea16a7ecc17dea9df79276b6955da7d925df..ba6755dcc680c3fecfb22d3327dbd2e4cb65e301 100644
--- a/include/clang/AST/Mangle.h
+++ b/include/clang/AST/Mangle.h
@@ -240,6 +240,6 @@ public:
   static MicrosoftMangleContext *create(ASTContext &Context,
                                         DiagnosticsEngine &Diags);
 };
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/AST/NestedNameSpecifier.h b/include/clang/AST/NestedNameSpecifier.h
index 4da17b0c0779a45f3718a54dd7d73a1839dda9ab..4f593e43a6fa54a5626186b4df5915d4ad05d684 100644
--- a/include/clang/AST/NestedNameSpecifier.h
+++ b/include/clang/AST/NestedNameSpecifier.h
@@ -510,6 +510,6 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
   return DB;
 }
 
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/AST/OperationKinds.h b/include/clang/AST/OperationKinds.h
index e3f012667727241744c20ccee8720f3ef900022c..b01f05e4c12628931bde4935b871c070757f769a 100644
--- a/include/clang/AST/OperationKinds.h
+++ b/include/clang/AST/OperationKinds.h
@@ -350,6 +350,6 @@ enum ObjCBridgeCastKind {
   OBC_BridgeRetained
 };
 
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/AST/ParentMap.h b/include/clang/AST/ParentMap.h
index 8945c413d26851f72f62ac7c24c02665aa34adf0..721e6efdce326171cb0ebece4009c929b5da0720 100644
--- a/include/clang/AST/ParentMap.h
+++ b/include/clang/AST/ParentMap.h
@@ -63,5 +63,5 @@ public:
   }
 };
 
-} // end clang namespace
+} // namespace clang
 #endif
diff --git a/include/clang/AST/Redeclarable.h b/include/clang/AST/Redeclarable.h
index 92046d582bf38975e8d53dc23a806902b037f6da..e19af1b053f6a1147de1b5258a98e2805f8902b7 100644
--- a/include/clang/AST/Redeclarable.h
+++ b/include/clang/AST/Redeclarable.h
@@ -272,6 +272,6 @@ public:
   bool isFirstDecl() const { return getFirstDecl() == this; }
 };
 
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index d903b9d8cbcfbb7f4a97767d5433cb6789a3d0ca..5c76f3fdc3604dd0a6bf12caf48f3fad518d0e6d 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -67,7 +67,7 @@ namespace llvm {
 
   template <>
   struct isPodLike<clang::QualType> { static const bool value = true; };
-}
+} // namespace llvm
 
 namespace clang {
   class ASTContext;
@@ -1008,7 +1008,7 @@ private:
   static DestructionKind isDestructedTypeImpl(QualType type);
 };
 
-} // end clang.
+} // namespace clang
 
 namespace llvm {
 /// Implement simplify_type for QualType, so that we can dyn_cast from QualType
diff --git a/include/clang/AST/TypeLoc.h b/include/clang/AST/TypeLoc.h
index e29fa4903282bf2791c60a9b2a8c8c4f0614f423..932ee3f3bdee67a83ced58b1ffa5d37e215f3690 100644
--- a/include/clang/AST/TypeLoc.h
+++ b/include/clang/AST/TypeLoc.h
@@ -1952,6 +1952,6 @@ public:
 };
 
 
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/AST/TypeOrdering.h b/include/clang/AST/TypeOrdering.h
index 392e544d90c11e6b6d1078f630ec3f318bc3dbf5..865e135aa73761f34c428e767db31745e88a9fd7 100644
--- a/include/clang/AST/TypeOrdering.h
+++ b/include/clang/AST/TypeOrdering.h
@@ -74,6 +74,6 @@ namespace llvm {
       return LHS == RHS;
     }
   };
-}
+} // namespace llvm
 
 #endif
diff --git a/include/clang/AST/VTTBuilder.h b/include/clang/AST/VTTBuilder.h
index 727bf5109ad420ae597fae49260da7a569d1d28f..0ce2bc9fb239c1dc03223b669935e54c4de93a28 100644
--- a/include/clang/AST/VTTBuilder.h
+++ b/include/clang/AST/VTTBuilder.h
@@ -157,6 +157,6 @@ public:
 
 };
 
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h b/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h
index cc14c7bd33dbc627ed6bc955797fcd8a1bdad472..830f1d8e2da398b9e3fa82f1d242bb0d03023e98 100644
--- a/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h
+++ b/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h
@@ -44,6 +44,6 @@ private:
   void mapReachability(const CFGBlock *Dst);
 };
   
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Analysis/Analyses/Consumed.h b/include/clang/Analysis/Analyses/Consumed.h
index a7109233987c10e31d26c348325169d381ce1624..346cdb3120ffd0a8106c467021175c028f079ed3 100644
--- a/include/clang/Analysis/Analyses/Consumed.h
+++ b/include/clang/Analysis/Analyses/Consumed.h
@@ -260,6 +260,7 @@ namespace consumed {
     /// exactly once.
     void run(AnalysisDeclContext &AC);
   };
-}} // end namespace clang::consumed
+} // namespace consumed
+} // namespace clang
 
 #endif
diff --git a/include/clang/Analysis/Analyses/FormatString.h b/include/clang/Analysis/Analyses/FormatString.h
index 2e8058dabda295b26c941657527642c51ba640b2..f59b45a33404aaa412abb4ddc3c27f088228c32a 100644
--- a/include/clang/Analysis/Analyses/FormatString.h
+++ b/include/clang/Analysis/Analyses/FormatString.h
@@ -393,7 +393,7 @@ public:
   static bool namedTypeToLengthModifier(QualType QT, LengthModifier &LM);
 };
 
-} // end analyze_format_string namespace
+} // namespace analyze_format_string
 
 //===----------------------------------------------------------------------===//
 /// Pieces specific to fprintf format strings.
@@ -529,7 +529,7 @@ public:
   bool hasValidPrecision() const;
   bool hasValidFieldWidth() const;
 };
-}  // end analyze_printf namespace
+} // namespace analyze_printf
 
 //===----------------------------------------------------------------------===//
 /// Pieces specific to fscanf format strings.
@@ -595,7 +595,7 @@ public:
   static ScanfSpecifier Parse(const char *beg, const char *end);
 };
 
-} // end analyze_scanf namespace
+} // namespace analyze_scanf
 
 //===----------------------------------------------------------------------===//
 // Parsing and processing of format strings (both fprintf and fscanf).
@@ -665,6 +665,6 @@ bool ParseScanfString(FormatStringHandler &H,
                       const char *beg, const char *end, const LangOptions &LO,
                       const TargetInfo &Target);
 
-} // end analyze_format_string namespace
-} // end clang namespace
+} // namespace analyze_format_string
+} // namespace clang
 #endif
diff --git a/include/clang/Analysis/Analyses/PostOrderCFGView.h b/include/clang/Analysis/Analyses/PostOrderCFGView.h
index a1c6504275889a23172d1df82bce661106602bc5..d4b8c8b9037a2f523e9739a4e8633d9b7496a8f5 100644
--- a/include/clang/Analysis/Analyses/PostOrderCFGView.h
+++ b/include/clang/Analysis/Analyses/PostOrderCFGView.h
@@ -109,7 +109,7 @@ public:
   static PostOrderCFGView *create(AnalysisDeclContext &analysisContext);
 };
 
-} // end clang namespace
+} // namespace clang
 
 #endif
 
diff --git a/include/clang/Analysis/Analyses/PseudoConstantAnalysis.h b/include/clang/Analysis/Analyses/PseudoConstantAnalysis.h
index c4ec2f22eca0b53a70acd9c55730cf9d831f844c..b4addd2f0ea3a7225fc597dd240a9258171a8e7b 100644
--- a/include/clang/Analysis/Analyses/PseudoConstantAnalysis.h
+++ b/include/clang/Analysis/Analyses/PseudoConstantAnalysis.h
@@ -40,6 +40,6 @@ private:
   bool Analyzed;
 };
 
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Analysis/Analyses/ReachableCode.h b/include/clang/Analysis/Analyses/ReachableCode.h
index 4c523bfc8b561c84cfa3a0c7213aa8f994aad209..1dd02e5b951f292f38494e8d80783072d4f8ab21 100644
--- a/include/clang/Analysis/Analyses/ReachableCode.h
+++ b/include/clang/Analysis/Analyses/ReachableCode.h
@@ -64,6 +64,7 @@ unsigned ScanReachableFromBlock(const CFGBlock *Start,
 void FindUnreachableCode(AnalysisDeclContext &AC, Preprocessor &PP,
                          Callback &CB);
 
-}} // end namespace clang::reachable_code
+} // namespace reachable_code
+} // namespace clang
 
 #endif
diff --git a/include/clang/Analysis/Analyses/ThreadSafety.h b/include/clang/Analysis/Analyses/ThreadSafety.h
index 22694a7a225ab79df8666414fc077850909f7902..c19e34ce077575e42507ea7d264ec3167adf13ed 100644
--- a/include/clang/Analysis/Analyses/ThreadSafety.h
+++ b/include/clang/Analysis/Analyses/ThreadSafety.h
@@ -222,5 +222,6 @@ void threadSafetyCleanup(BeforeSet *Cache);
 /// of access.
 LockKind getLockKindFromAccessKind(AccessKind AK);
 
-}} // end namespace clang::threadSafety
+} // namespace threadSafety
+} // namespace clang
 #endif
diff --git a/include/clang/Analysis/Analyses/ThreadSafetyLogical.h b/include/clang/Analysis/Analyses/ThreadSafetyLogical.h
index bc78021343a45a8ee2d0bf20f2a8e32f95f72754..481568f20fd5a15239bc442820277b6feb4d0222 100644
--- a/include/clang/Analysis/Analyses/ThreadSafetyLogical.h
+++ b/include/clang/Analysis/Analyses/ThreadSafetyLogical.h
@@ -100,9 +100,9 @@ bool LExpr::implies(const LExpr *RHS) const {
   return lexpr::implies(this, RHS);
 }
 
-}
-}
-}
+} // namespace lexpr
+} // namespace threadSafety
+} // namespace clang
 
 #endif
 
diff --git a/include/clang/Analysis/Analyses/UninitializedValues.h b/include/clang/Analysis/Analyses/UninitializedValues.h
index 53ff20c23560c4dd4573acdcc42857e4d43ce17a..794c108b1bff4bf2b224f23150f7126927caaba7 100644
--- a/include/clang/Analysis/Analyses/UninitializedValues.h
+++ b/include/clang/Analysis/Analyses/UninitializedValues.h
@@ -122,5 +122,5 @@ void runUninitializedVariablesAnalysis(const DeclContext &dc, const CFG &cfg,
                                        UninitVariablesHandler &handler,
                                        UninitVariablesAnalysisStats &stats);
 
-}
+} // namespace clang
 #endif
diff --git a/include/clang/Analysis/AnalysisContext.h b/include/clang/Analysis/AnalysisContext.h
index 931190e43a66861c7f20db9039444ad450d0e9ee..99a93a87e3584bfd6f415b6261487019a73e6825 100644
--- a/include/clang/Analysis/AnalysisContext.h
+++ b/include/clang/Analysis/AnalysisContext.h
@@ -476,5 +476,5 @@ private:
   }
 };
 
-} // end clang namespace
+} // namespace clang
 #endif
diff --git a/include/clang/Analysis/CFG.h b/include/clang/Analysis/CFG.h
index 5430c3bc6f2184c696da97d31252d0ad65bc86fc..bdedb4eca160e47c9500d0b1e01d2da6f03d007f 100644
--- a/include/clang/Analysis/CFG.h
+++ b/include/clang/Analysis/CFG.h
@@ -1109,5 +1109,5 @@ template <> struct GraphTraits<Inverse<const ::clang::CFG*> >
     return F->nodes_end();
   }
 };
-} // end llvm namespace
+} // namespace llvm
 #endif
diff --git a/include/clang/Analysis/CFGStmtMap.h b/include/clang/Analysis/CFGStmtMap.h
index 4dfa91df0f42cb49d74ecfc7cb1844b28e082c63..4a8ce9eb51862381707e4bc1a420b5c6d6d4e786 100644
--- a/include/clang/Analysis/CFGStmtMap.h
+++ b/include/clang/Analysis/CFGStmtMap.h
@@ -48,5 +48,5 @@ public:
   }
 };
 
-} // end clang namespace
+} // namespace clang
 #endif
diff --git a/include/clang/Analysis/CallGraph.h b/include/clang/Analysis/CallGraph.h
index eda22a57e8a50b1c496ba790ff9d60b28aaa2d2d..b8d923b8ec41b83d1307302f38f25379182f5c26 100644
--- a/include/clang/Analysis/CallGraph.h
+++ b/include/clang/Analysis/CallGraph.h
@@ -166,7 +166,7 @@ public:
   void dump() const;
 };
 
-} // end clang namespace
+} // namespace clang
 
 // Graph traits for iteration, viewing.
 namespace llvm {
@@ -248,6 +248,6 @@ template <> struct GraphTraits<const clang::CallGraph*> :
   }
 };
 
-} // end llvm namespace
+} // namespace llvm
 
 #endif
diff --git a/include/clang/Analysis/CodeInjector.h b/include/clang/Analysis/CodeInjector.h
index 413a55b05b07ae4504b3634265db47e6b7ea0576..1c590de4c0df00cc9ed1d5cc6020f924b58f036d 100644
--- a/include/clang/Analysis/CodeInjector.h
+++ b/include/clang/Analysis/CodeInjector.h
@@ -41,6 +41,6 @@ public:
   virtual Stmt *getBody(const FunctionDecl *D) = 0;
   virtual Stmt *getBody(const ObjCMethodDecl *D) = 0;
 };
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Analysis/DomainSpecific/CocoaConventions.h b/include/clang/Analysis/DomainSpecific/CocoaConventions.h
index 8b3fcff52d081bcddcf562bc75cf349a818b9aec..6fac09d65811c037869c0bc00ebcfdc391eb1bea 100644
--- a/include/clang/Analysis/DomainSpecific/CocoaConventions.h
+++ b/include/clang/Analysis/DomainSpecific/CocoaConventions.h
@@ -37,6 +37,7 @@ namespace coreFoundation {
   bool followsCreateRule(const FunctionDecl *FD);
 }
 
-}} // end: "clang:ento"
+} // namespace ento
+} // namespace clang
 
 #endif
diff --git a/include/clang/Analysis/DomainSpecific/ObjCNoReturn.h b/include/clang/Analysis/DomainSpecific/ObjCNoReturn.h
index f9e800a4a412ec4edf83c9aa5e611aa48b7a0d62..4076c722374b0f827ce79abfd1aa6288bfbfc513 100644
--- a/include/clang/Analysis/DomainSpecific/ObjCNoReturn.h
+++ b/include/clang/Analysis/DomainSpecific/ObjCNoReturn.h
@@ -41,6 +41,6 @@ public:
   /// return.
   bool isImplicitNoReturn(const ObjCMessageExpr *ME);
 };
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Analysis/Support/BumpVector.h b/include/clang/Analysis/Support/BumpVector.h
index 841adf64557dab68d429d07372fdc65468575fa3..a39bef56c3b96ab5dedf57c98dc7c130d7647368 100644
--- a/include/clang/Analysis/Support/BumpVector.h
+++ b/include/clang/Analysis/Support/BumpVector.h
@@ -240,5 +240,5 @@ void BumpVector<T>::grow(BumpVectorContext &C, size_t MinSize) {
   Capacity = Begin+NewCapacity;
 }
 
-} // end: clang namespace
+} // namespace clang
 #endif
diff --git a/include/clang/Basic/AddressSpaces.h b/include/clang/Basic/AddressSpaces.h
index 8dd75660c672823bf00b2b880c615016686174a7..a90afdd1a1a9c5004c3097da6c250a8f65dc26d4 100644
--- a/include/clang/Basic/AddressSpaces.h
+++ b/include/clang/Basic/AddressSpaces.h
@@ -44,8 +44,8 @@ enum ID {
 /// to target-specific ones.
 typedef unsigned Map[Count];
 
-}
+} // namespace LangAS
 
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Basic/Builtins.h b/include/clang/Basic/Builtins.h
index 27428ad81cb8b2cf6ba84ef7cd1f2367d1321a6f..993e0b9f328a6fef43d9a721992fd63fc30d893a 100644
--- a/include/clang/Basic/Builtins.h
+++ b/include/clang/Basic/Builtins.h
@@ -189,6 +189,6 @@ private:
               const char *Fmt) const;
 };
 
-}
+} // namespace Builtin
 } // end namespace clang
 #endif
diff --git a/include/clang/Basic/DiagnosticIDs.h b/include/clang/Basic/DiagnosticIDs.h
index a675dfabe46de0a8a7e5184eb92f6eade349298a..2cff6715780de90e08b57d0e8282979880b8290c 100644
--- a/include/clang/Basic/DiagnosticIDs.h
+++ b/include/clang/Basic/DiagnosticIDs.h
@@ -76,7 +76,7 @@ namespace clang {
       Remark          ///< A diagnostic that indicates normal progress through
                       ///< compilation.
     };
-  }
+  } // namespace diag
 
 class DiagnosticMapping {
   unsigned Severity : 3;
diff --git a/include/clang/Basic/LLVM.h b/include/clang/Basic/LLVM.h
index 0e6ff9259a15309d1424a6e512d52a78e8282f09..0a4c96eb9e38971dad20b9b3503cfc10b37ded4c 100644
--- a/include/clang/Basic/LLVM.h
+++ b/include/clang/Basic/LLVM.h
@@ -47,7 +47,7 @@ namespace llvm {
   class raw_ostream;
   class raw_pwrite_stream;
   // TODO: DenseMap, ...
-}
+} // namespace llvm
 
 
 namespace clang {
diff --git a/include/clang/Basic/OpenMPKinds.h b/include/clang/Basic/OpenMPKinds.h
index e2f115113e200b4272afc5cf83d1aee7c8d916af..1808d866c436bd203e8df962b6161204b95aba5e 100644
--- a/include/clang/Basic/OpenMPKinds.h
+++ b/include/clang/Basic/OpenMPKinds.h
@@ -117,7 +117,7 @@ bool isOpenMPPrivate(OpenMPClauseKind Kind);
 /// \return true - the clause is a threadprivate clause, otherwise - false.
 bool isOpenMPThreadPrivate(OpenMPClauseKind Kind);
 
-}
+} // namespace clang
 
 #endif
 
diff --git a/include/clang/Basic/OperatorPrecedence.h b/include/clang/Basic/OperatorPrecedence.h
index 640749fdd10d5fd23729c970ade0521ac3351cea..4ee6d3530336aeeabae218a06e7702e2031243e6 100644
--- a/include/clang/Basic/OperatorPrecedence.h
+++ b/include/clang/Basic/OperatorPrecedence.h
@@ -41,7 +41,7 @@ namespace prec {
     Multiplicative  = 13,   // *, /, %
     PointerToMember = 14    // .*, ->*
   };
-}
+} // namespace prec
 
 /// \brief Return the precedence of the specified binary operator token.
 prec::Level getBinOpPrecedence(tok::TokenKind Kind, bool GreaterThanIsOperator,
diff --git a/include/clang/Basic/PlistSupport.h b/include/clang/Basic/PlistSupport.h
index 84dd29138a805f28c5e24e4c533d6bdc775a3cac..9273c566212e2fb666372fc43f3f28d4af000aa7 100644
--- a/include/clang/Basic/PlistSupport.h
+++ b/include/clang/Basic/PlistSupport.h
@@ -113,7 +113,7 @@ inline void EmitRange(raw_ostream &o, const SourceManager &SM,
   EmitLocation(o, SM, R.getEnd(), FM, indent + 1);
   Indent(o, indent) << "</array>\n";
 }
-}
-}
+} // namespace markup
+} // namespace clang
 
 #endif
diff --git a/include/clang/Basic/PrettyStackTrace.h b/include/clang/Basic/PrettyStackTrace.h
index 6badae5c03496a2bb5581d3bbe15656c71f514ab..c01be4bb7f30e28ce02455129be4ad1664e688c8 100644
--- a/include/clang/Basic/PrettyStackTrace.h
+++ b/include/clang/Basic/PrettyStackTrace.h
@@ -33,6 +33,6 @@ namespace clang {
       : SM(sm), Loc(L), Message(Msg) {}
     void print(raw_ostream &OS) const override;
   };
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Basic/Sanitizers.h b/include/clang/Basic/Sanitizers.h
index 78c1ddb56f9b37b455e4b282fbf4e6c6a1d09e66..c249ad87a9b8a2c193d0b7e230233e6cc61bd75a 100644
--- a/include/clang/Basic/Sanitizers.h
+++ b/include/clang/Basic/Sanitizers.h
@@ -44,7 +44,7 @@ enum SanitizerOrdinal : uint64_t {
   const SanitizerMask ID##Group = 1ULL << SO_##ID##Group;
 #include "clang/Basic/Sanitizers.def"
 
-}
+} // namespace SanitizerKind
 
 struct SanitizerSet {
   SanitizerSet();
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h
index 3aea5ea9825ece59438ba2cd39e6259b0945e149..288a271efcdd1f26896a044a69f951f3062c9b53 100644
--- a/include/clang/Basic/SourceManager.h
+++ b/include/clang/Basic/SourceManager.h
@@ -423,7 +423,7 @@ namespace SrcMgr {
       return E;
     }
   };
-}  // end SrcMgr namespace.
+} // namespace SrcMgr
 
 /// \brief External source of source location entries.
 class ExternalSLocEntrySource {
diff --git a/include/clang/Basic/TemplateKinds.h b/include/clang/Basic/TemplateKinds.h
index aed287b462284d76a7023beeaece309921fe4517..7a4084f92796276fb67cd9ea1d8d8d2d86c3244e 100644
--- a/include/clang/Basic/TemplateKinds.h
+++ b/include/clang/Basic/TemplateKinds.h
@@ -38,7 +38,7 @@ enum TemplateNameKind {
   TNK_Dependent_template_name
 };
 
-}
+} // namespace clang
 #endif
 
 
diff --git a/include/clang/Basic/TypeTraits.h b/include/clang/Basic/TypeTraits.h
index ef84d2b11163d0c68346b7647792cbac1919833c..e3cfd8518ca05a3bbfa6513e77731c0f1fba7742 100644
--- a/include/clang/Basic/TypeTraits.h
+++ b/include/clang/Basic/TypeTraits.h
@@ -94,6 +94,6 @@ namespace clang {
     UETT_AlignOf,
     UETT_VecStep
   };
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Basic/Version.h b/include/clang/Basic/Version.h
index 02da432a40db11f8059eed5fe3da46b14682195a..744befe343468f25113a6e742bea664e45480aa1 100644
--- a/include/clang/Basic/Version.h
+++ b/include/clang/Basic/Version.h
@@ -77,6 +77,6 @@ namespace clang {
   /// for use in the CPP __VERSION__ macro, which includes the clang version
   /// number, the repository version, and the vendor tag.
   std::string getClangFullCPPVersion();
-}
+} // namespace clang
 
 #endif // LLVM_CLANG_BASIC_VERSION_H
diff --git a/include/clang/Basic/Visibility.h b/include/clang/Basic/Visibility.h
index 6ac52ed6b5e1d8fc106ba4d689dbd6d4af69a851..ac992f08e86613114472d5cc63d31873cd641629 100644
--- a/include/clang/Basic/Visibility.h
+++ b/include/clang/Basic/Visibility.h
@@ -136,6 +136,6 @@ public:
     if (withVis) mergeVisibility(other);
   }
 };
-}
+} // namespace clang
 
 #endif // LLVM_CLANG_BASIC_VISIBILITY_H
diff --git a/include/clang/CodeGen/BackendUtil.h b/include/clang/CodeGen/BackendUtil.h
index 8586e7788942c5639afae1ebc302bfc6e15964bd..3a3ac1f0d540143ac0721686c05a1e59874a5d28 100644
--- a/include/clang/CodeGen/BackendUtil.h
+++ b/include/clang/CodeGen/BackendUtil.h
@@ -35,6 +35,6 @@ namespace clang {
                          const TargetOptions &TOpts, const LangOptions &LOpts,
                          StringRef TDesc, llvm::Module *M, BackendAction Action,
                          raw_pwrite_stream *OS);
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/CodeGen/CodeGenAction.h b/include/clang/CodeGen/CodeGenAction.h
index 264780d01ca900c3e4557f47b54ca3d790f492df..08ab634e073b117e4863fa31b44753d794f6be75 100644
--- a/include/clang/CodeGen/CodeGenAction.h
+++ b/include/clang/CodeGen/CodeGenAction.h
@@ -98,6 +98,6 @@ public:
   EmitObjAction(llvm::LLVMContext *_VMContext = nullptr);
 };
 
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/CodeGen/ModuleBuilder.h b/include/clang/CodeGen/ModuleBuilder.h
index 8facc3c8307bb984e8504d2537c85245654259d5..45570253774a1e88a045b2a184bc38c089abc85d 100644
--- a/include/clang/CodeGen/ModuleBuilder.h
+++ b/include/clang/CodeGen/ModuleBuilder.h
@@ -45,6 +45,6 @@ namespace clang {
                                    const CodeGenOptions &CGO,
                                    llvm::LLVMContext& C,
                                    CoverageSourceInfo *CoverageInfo = nullptr);
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Driver/Multilib.h b/include/clang/Driver/Multilib.h
index 20bb80dca273f2603fdef9c1ee0c6b43b277d865..0833198325521fd7066833d87ae0360e95d6bc40 100644
--- a/include/clang/Driver/Multilib.h
+++ b/include/clang/Driver/Multilib.h
@@ -168,8 +168,8 @@ private:
 };
 
 raw_ostream &operator<<(raw_ostream &OS, const MultilibSet &MS);
-}
-}
+} // namespace driver
+} // namespace clang
 
 #endif
 
diff --git a/include/clang/Driver/Options.h b/include/clang/Driver/Options.h
index 2716fa9ae85eb1132741fb80edf59cc34f4a266e..c26592a5a95bdc7f084ccb32abe2fd8195bee197 100644
--- a/include/clang/Driver/Options.h
+++ b/include/clang/Driver/Options.h
@@ -42,10 +42,10 @@ enum ID {
     LastOption
 #undef OPTION
   };
-}
+} // namespace options
 
 llvm::opt::OptTable *createDriverOptTable();
-}
-}
+} // namespace driver
+} // namespace clang
 
 #endif
diff --git a/include/clang/Edit/Commit.h b/include/clang/Edit/Commit.h
index 5cc5b9c6ff8b81ad53247a93a5356feac68c8207..f512ef2a25226a3cd6dff59824d928a82a9d84de 100644
--- a/include/clang/Edit/Commit.h
+++ b/include/clang/Edit/Commit.h
@@ -142,7 +142,7 @@ private:
   }
 };
 
-}
+} // namespace edit
 
 } // end namespace clang
 
diff --git a/include/clang/Edit/EditedSource.h b/include/clang/Edit/EditedSource.h
index 150a5b41b5a4949afc896770a8f50da7cd41d741..88905dc040cc18273fe1a681bb0c0a62b5c31438 100644
--- a/include/clang/Edit/EditedSource.h
+++ b/include/clang/Edit/EditedSource.h
@@ -82,7 +82,7 @@ private:
   FileEditsTy::iterator getActionForOffset(FileOffset Offs);
 };
 
-}
+} // namespace edit
 
 } // end namespace clang
 
diff --git a/include/clang/Edit/EditsReceiver.h b/include/clang/Edit/EditsReceiver.h
index 600ac28ea920ee1124fb868f2c9b571b545cb02f..267c4b1c7541b7de774dea9ffa7de084524eca6b 100644
--- a/include/clang/Edit/EditsReceiver.h
+++ b/include/clang/Edit/EditsReceiver.h
@@ -28,7 +28,7 @@ public:
   virtual void remove(CharSourceRange range);
 };
 
-}
+} // namespace edit
 
 } // end namespace clang
 
diff --git a/include/clang/Edit/FileOffset.h b/include/clang/Edit/FileOffset.h
index 0c1e72b84e51b65a89d78b3794e54f11f1aaa74d..c68c0c6242070f7ea34e61784e7a6f590bf7e725 100644
--- a/include/clang/Edit/FileOffset.h
+++ b/include/clang/Edit/FileOffset.h
@@ -54,7 +54,7 @@ public:
   }
 };
 
-}
+} // namespace edit
 
 } // end namespace clang
 
diff --git a/include/clang/Edit/Rewriters.h b/include/clang/Edit/Rewriters.h
index 5e3425f56f73e534d0243c0ddeb4fd33209b53a5..a41fc2d90c902aeaf62d419e289482df3eccea7a 100644
--- a/include/clang/Edit/Rewriters.h
+++ b/include/clang/Edit/Rewriters.h
@@ -34,7 +34,7 @@ bool rewriteToObjCLiteralSyntax(const ObjCMessageExpr *Msg,
 bool rewriteToObjCSubscriptSyntax(const ObjCMessageExpr *Msg,
                                   const NSAPI &NS, Commit &commit);
 
-}
+} // namespace edit
 
 }  // end namespace clang
 
diff --git a/include/clang/Frontend/ASTConsumers.h b/include/clang/Frontend/ASTConsumers.h
index 757fcae988fc0ce202604b0c17892c31f444c50c..4c17cb6f62fe3be48a777ec34204d041bc61d768 100644
--- a/include/clang/Frontend/ASTConsumers.h
+++ b/include/clang/Frontend/ASTConsumers.h
@@ -53,6 +53,6 @@ std::unique_ptr<ASTConsumer> CreateASTViewer();
 // to stderr; this is intended for debugging.
 std::unique_ptr<ASTConsumer> CreateDeclContextPrinter();
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/Frontend/ChainedDiagnosticConsumer.h b/include/clang/Frontend/ChainedDiagnosticConsumer.h
index eb33273c2fb3fa2b8c67ef7605683dafbd92acbd..9c0c18122e6a1b9cb82079817c942d84670ff6d9 100644
--- a/include/clang/Frontend/ChainedDiagnosticConsumer.h
+++ b/include/clang/Frontend/ChainedDiagnosticConsumer.h
@@ -67,6 +67,6 @@ public:
   }
 };
 
-} // end namspace clang
+} // namespace clang
 
 #endif
diff --git a/include/clang/Frontend/CommandLineSourceLoc.h b/include/clang/Frontend/CommandLineSourceLoc.h
index a78c96d23afa3af0444f246907413333d6e3a6f7..29756e793502de453a714652aa2ac44ab5f794c1 100644
--- a/include/clang/Frontend/CommandLineSourceLoc.h
+++ b/include/clang/Frontend/CommandLineSourceLoc.h
@@ -51,7 +51,7 @@ public:
   }
 };
 
-}
+} // namespace clang
 
 namespace llvm {
   namespace cl {
@@ -81,7 +81,7 @@ namespace llvm {
 
       return false;
     }
-  }
-}
+  } // namespace cl
+} // namespace llvm
 
 #endif
diff --git a/include/clang/Frontend/DiagnosticRenderer.h b/include/clang/Frontend/DiagnosticRenderer.h
index 84a0f50823bcfaf1fa1ff688e1b98ad072428c1b..142ecd4082443b94dee067fb2777658ec6e92c2c 100644
--- a/include/clang/Frontend/DiagnosticRenderer.h
+++ b/include/clang/Frontend/DiagnosticRenderer.h
@@ -172,5 +172,5 @@ public:
   virtual void emitNote(SourceLocation Loc, StringRef Message,
                         const SourceManager *SM) = 0;
 };
-} // end clang namespace
+} // namespace clang
 #endif
diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h
index c3aa226ea909b4ce2a238d3fcb44c6e0f752a808..c59aff6b539f7d514cf452faf11afa5d36711d03 100644
--- a/include/clang/Frontend/FrontendOptions.h
+++ b/include/clang/Frontend/FrontendOptions.h
@@ -56,7 +56,7 @@ namespace frontend {
     MigrateSource,          ///< Run migrator.
     RunPreprocessorOnly     ///< Just lex, no output.
   };
-}
+} // namespace frontend
 
 enum InputKind {
   IK_None,
diff --git a/include/clang/Frontend/LangStandard.h b/include/clang/Frontend/LangStandard.h
index 8021d08942e51107d40092de11fe0551be7e26fa..1e2841c7143e6764beb1c7b8868560b7d3135cf2 100644
--- a/include/clang/Frontend/LangStandard.h
+++ b/include/clang/Frontend/LangStandard.h
@@ -32,7 +32,7 @@ enum LangFeatures {
   ImplicitInt = (1 << 11)
 };
 
-}
+} // namespace frontend
 
 /// LangStandard - Information about the properties of a particular language
 /// standard.
diff --git a/include/clang/Frontend/LayoutOverrideSource.h b/include/clang/Frontend/LayoutOverrideSource.h
index 16d032b7dd72c27299c1294d0cb4494ca19de628..167b4f2a60274181a9b58ba380bb349ccc9f77ba 100644
--- a/include/clang/Frontend/LayoutOverrideSource.h
+++ b/include/clang/Frontend/LayoutOverrideSource.h
@@ -58,6 +58,6 @@ namespace clang {
     /// \brief Dump the overridden layouts.
     void dump();
   };
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Frontend/MigratorOptions.h b/include/clang/Frontend/MigratorOptions.h
index 8eb71b13f8854f31fb5bca2aa48cc994854a720e..cb24a025dee5a8d8e27b61f06501b2ec14070c7a 100644
--- a/include/clang/Frontend/MigratorOptions.h
+++ b/include/clang/Frontend/MigratorOptions.h
@@ -27,5 +27,5 @@ public:
   }
 };
 
-}
+} // namespace clang
 #endif
diff --git a/include/clang/Frontend/SerializedDiagnosticPrinter.h b/include/clang/Frontend/SerializedDiagnosticPrinter.h
index 4c57e9d404f0f38c4cf60d0161e8600fe223d72f..969bc6f8bc4efff74dafd6621abeb2375868e77a 100644
--- a/include/clang/Frontend/SerializedDiagnosticPrinter.h
+++ b/include/clang/Frontend/SerializedDiagnosticPrinter.h
@@ -37,7 +37,7 @@ std::unique_ptr<DiagnosticConsumer> create(StringRef OutputFile,
                                            DiagnosticOptions *Diags,
                                            bool MergeChildRecords = false);
 
-} // end serialized_diags namespace
-} // end clang namespace
+} // namespace serialized_diags
+} // namespace clang
 
 #endif
diff --git a/include/clang/Frontend/SerializedDiagnosticReader.h b/include/clang/Frontend/SerializedDiagnosticReader.h
index 92e99d305da5170fca44744c947240db46ed9137..320ac9627232d03c52da828c623665567e3589d7 100644
--- a/include/clang/Frontend/SerializedDiagnosticReader.h
+++ b/include/clang/Frontend/SerializedDiagnosticReader.h
@@ -120,8 +120,8 @@ protected:
   };
 };
 
-} // end serialized_diags namespace
-} // end clang namespace
+} // namespace serialized_diags
+} // namespace clang
 
 namespace std {
 template <>
diff --git a/include/clang/Frontend/SerializedDiagnostics.h b/include/clang/Frontend/SerializedDiagnostics.h
index 2032cd3988dbf305359728f5298b4ee7a4945870..e614f45c8cbd2dbecd291ef20c27a99ed8ebec92 100644
--- a/include/clang/Frontend/SerializedDiagnostics.h
+++ b/include/clang/Frontend/SerializedDiagnostics.h
@@ -53,7 +53,7 @@ enum Level {
 /// \brief The serialized diagnostics version number.
 enum { VersionNumber = 2 };
 
-} // end serialized_diags namespace
-} // end clang namespace
+} // namespace serialized_diags
+} // namespace clang
 
 #endif
diff --git a/include/clang/Frontend/TextDiagnosticBuffer.h b/include/clang/Frontend/TextDiagnosticBuffer.h
index 3bcf824455e2dc9764c8dfe28267d890363a6098..e733768a60879ea55c14312206193414726e04d4 100644
--- a/include/clang/Frontend/TextDiagnosticBuffer.h
+++ b/include/clang/Frontend/TextDiagnosticBuffer.h
@@ -50,6 +50,6 @@ public:
   void FlushDiagnostics(DiagnosticsEngine &Diags) const;
 };
 
-} // end namspace clang
+} // namespace clang
 
 #endif
diff --git a/include/clang/Frontend/VerifyDiagnosticConsumer.h b/include/clang/Frontend/VerifyDiagnosticConsumer.h
index 475f07f9dc06ad55d774352c4f70c3be17b7bccd..a49122114fc1f92f6e2d3426374d36f8c67105c5 100644
--- a/include/clang/Frontend/VerifyDiagnosticConsumer.h
+++ b/include/clang/Frontend/VerifyDiagnosticConsumer.h
@@ -273,6 +273,6 @@ public:
                         const Diagnostic &Info) override;
 };
 
-} // end namspace clang
+} // namespace clang
 
 #endif
diff --git a/include/clang/Lex/CodeCompletionHandler.h b/include/clang/Lex/CodeCompletionHandler.h
index 91c3b7811f079b728186d70fba29db5c3ed49c31..67aedacdd1ee240076030cb58fd4b2e4edae146c 100644
--- a/include/clang/Lex/CodeCompletionHandler.h
+++ b/include/clang/Lex/CodeCompletionHandler.h
@@ -66,6 +66,6 @@ public:
   virtual void CodeCompleteNaturalLanguage() { }
 };
   
-}
+} // namespace clang
 
 #endif // LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
diff --git a/include/clang/Lex/ExternalPreprocessorSource.h b/include/clang/Lex/ExternalPreprocessorSource.h
index 33e7a2d84b88f7e41d516fcc872d6c516283323b..e23a791a02e1c850c587ab11fd275195971b4785 100644
--- a/include/clang/Lex/ExternalPreprocessorSource.h
+++ b/include/clang/Lex/ExternalPreprocessorSource.h
@@ -38,6 +38,6 @@ public:
   virtual Module *getModule(unsigned ModuleID) = 0;
 };
   
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Lex/HeaderSearchOptions.h b/include/clang/Lex/HeaderSearchOptions.h
index c9c32609f19b229e9298345bb71d19387f0807d2..7b5766ce48170e3be7d1a53566226eb35353a2e5 100644
--- a/include/clang/Lex/HeaderSearchOptions.h
+++ b/include/clang/Lex/HeaderSearchOptions.h
@@ -38,7 +38,7 @@ namespace frontend {
     ObjCXXSystem,   ///< Like System, but only used for ObjC++.
     After           ///< Like System, but searched after the system directories.
   };
-}
+} // namespace frontend
 
 /// HeaderSearchOptions - Helper class for storing options related to the
 /// initialization of the HeaderSearch object.
diff --git a/include/clang/Lex/ModuleLoader.h b/include/clang/Lex/ModuleLoader.h
index ae79650d1fd0b7744ef8cf00aa383ecb6a50d904..cd3dda1ad3662d85d8d7ce758f6accc4683279a0 100644
--- a/include/clang/Lex/ModuleLoader.h
+++ b/include/clang/Lex/ModuleLoader.h
@@ -124,6 +124,6 @@ public:
   bool HadFatalFailure;
 };
   
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Lex/ModuleMap.h b/include/clang/Lex/ModuleMap.h
index 0bbcfac3b81b9069a58b1c5b96a63736746bff27..c2c81db3fb3aa62a9fe8b5f06eeef4e54ecdd828 100644
--- a/include/clang/Lex/ModuleMap.h
+++ b/include/clang/Lex/ModuleMap.h
@@ -466,5 +466,5 @@ public:
   module_iterator module_end()   const { return Modules.end(); }
 };
   
-}
+} // namespace clang
 #endif
diff --git a/include/clang/Lex/TokenConcatenation.h b/include/clang/Lex/TokenConcatenation.h
index a2d98b0d473a3117183f1715156d7c2572736046..4f5771f6aa93d37cff09c0e89b8d5fad5848881d 100644
--- a/include/clang/Lex/TokenConcatenation.h
+++ b/include/clang/Lex/TokenConcatenation.h
@@ -67,6 +67,6 @@ namespace clang {
     /// is literally 'L', 'u', 'U', or 'u8'.
     bool IsIdentifierStringPrefix(const Token &Tok) const;
   };
-  } // end clang namespace
+  } // namespace clang
 
 #endif
diff --git a/include/clang/Rewrite/Core/HTMLRewrite.h b/include/clang/Rewrite/Core/HTMLRewrite.h
index dafdf51ce63b590c1dc567d2a7e0ba46c2ed9c66..83795148bd4b8e70bc2b28256c3a65784e5dda20 100644
--- a/include/clang/Rewrite/Core/HTMLRewrite.h
+++ b/include/clang/Rewrite/Core/HTMLRewrite.h
@@ -75,7 +75,7 @@ namespace html {
   /// reasonably close.
   void HighlightMacros(Rewriter &R, FileID FID, const Preprocessor &PP);
 
-} // end html namespace
-} // end clang namespace
+} // namespace html
+} // namespace clang
 
 #endif
diff --git a/include/clang/Rewrite/Frontend/ASTConsumers.h b/include/clang/Rewrite/Frontend/ASTConsumers.h
index c9df8895041d39c5e684269dcca58494ed7d66d3..6037791164569024e5f53ec932e0a4da7d0be3bd 100644
--- a/include/clang/Rewrite/Frontend/ASTConsumers.h
+++ b/include/clang/Rewrite/Frontend/ASTConsumers.h
@@ -43,6 +43,6 @@ std::unique_ptr<ASTConsumer> CreateHTMLPrinter(raw_ostream *OS,
                                                bool SyntaxHighlight = true,
                                                bool HighlightMacros = true);
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/Rewrite/Frontend/FixItRewriter.h b/include/clang/Rewrite/Frontend/FixItRewriter.h
index 3b1b31e0cdee0eb34717aa9640c344c8afa9c0c9..448ae29f4dad0aa1dd79a9183e6262443f3d8e81 100644
--- a/include/clang/Rewrite/Frontend/FixItRewriter.h
+++ b/include/clang/Rewrite/Frontend/FixItRewriter.h
@@ -127,6 +127,6 @@ public:
   void Diag(SourceLocation Loc, unsigned DiagID);
 };
 
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Sema/AnalysisBasedWarnings.h b/include/clang/Sema/AnalysisBasedWarnings.h
index 64dd2d36bef896aae16528cfb6aa14de4d1fb775..5b1fbf399af726aa27d824100cafd423bba9d9fd 100644
--- a/include/clang/Sema/AnalysisBasedWarnings.h
+++ b/include/clang/Sema/AnalysisBasedWarnings.h
@@ -98,6 +98,7 @@ public:
   void PrintStats() const;
 };
 
-}} // end namespace clang::sema
+} // namespace sema
+} // namespace clang
 
 #endif
diff --git a/include/clang/Sema/DelayedDiagnostic.h b/include/clang/Sema/DelayedDiagnostic.h
index 155b3aa72d70a66b028abf17678fb50b48d660ea..6ae4308e1b81819ef3de7ff492c4bb67fcec929c 100644
--- a/include/clang/Sema/DelayedDiagnostic.h
+++ b/include/clang/Sema/DelayedDiagnostic.h
@@ -291,7 +291,7 @@ public:
   bool pool_empty() const { return Diagnostics.empty(); }
 };
 
-}
+} // namespace sema
 
 /// Add a diagnostic to the current delay pool.
 inline void Sema::DelayedDiagnostics::add(const sema::DelayedDiagnostic &diag) {
@@ -300,6 +300,6 @@ inline void Sema::DelayedDiagnostics::add(const sema::DelayedDiagnostic &diag) {
 }
 
 
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Sema/Lookup.h b/include/clang/Sema/Lookup.h
index 5bfee8b0d037cb52ca1dbaa9721666556510eeb1..4259ab009ba1b10c2d3472615fe5b17ebf8bb53e 100644
--- a/include/clang/Sema/Lookup.h
+++ b/include/clang/Sema/Lookup.h
@@ -750,6 +750,6 @@ public:
   iterator end() { return iterator(Decls.end()); }
 };
 
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Sema/ObjCMethodList.h b/include/clang/Sema/ObjCMethodList.h
index b618e38f88cd415731ca98db084365fa6e0b81f0..ef48b06579a6ceb2da9ba08fbba712993476b8b6 100644
--- a/include/clang/Sema/ObjCMethodList.h
+++ b/include/clang/Sema/ObjCMethodList.h
@@ -53,6 +53,6 @@ struct ObjCMethodList {
   }
 };
 
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Sema/Ownership.h b/include/clang/Sema/Ownership.h
index 8acf9e82bf95af1cdc166dbe618613a31cacbada..fe91423d677107fec1751eb433e2c39ac248d414 100644
--- a/include/clang/Sema/Ownership.h
+++ b/include/clang/Sema/Ownership.h
@@ -103,7 +103,7 @@ namespace clang {
       return *this;
     }
   };
-}
+} // namespace clang
 
 namespace llvm {
   template <class T>
@@ -121,7 +121,7 @@ namespace llvm {
 
   template <class T>
   struct isPodLike<clang::OpaquePtr<T> > { static const bool value = true; };
-}
+} // namespace llvm
 
 namespace clang {
   // Basic
@@ -282,6 +282,6 @@ namespace clang {
     assert(!R.isInvalid() && "operation was asserted to never fail!");
     return R.get();
   }
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Sema/ParsedTemplate.h b/include/clang/Sema/ParsedTemplate.h
index b36425f1be83d79a8a6f2b2f17fe9fca4306a810..586f2d7f0b77665a4b66039ac62cdcb18483e09d 100644
--- a/include/clang/Sema/ParsedTemplate.h
+++ b/include/clang/Sema/ParsedTemplate.h
@@ -209,6 +209,6 @@ namespace clang {
   /// Retrieves the range of the given template parameter lists.
   SourceRange getTemplateParamsRange(TemplateParameterList const *const *Params,
                                      unsigned NumParams);  
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Sema/PrettyDeclStackTrace.h b/include/clang/Sema/PrettyDeclStackTrace.h
index ca22e640deb490660d736eb24e6619fcf20560da..8e227a72868d98221c24913ebf9cae6cdd5af50f 100644
--- a/include/clang/Sema/PrettyDeclStackTrace.h
+++ b/include/clang/Sema/PrettyDeclStackTrace.h
@@ -42,6 +42,6 @@ public:
   void print(raw_ostream &OS) const override;
 };
 
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index cb75b969f116af7f3a350862168a69044e62e538..4d815262592ea951d763e5edffd8567c3400d7ef 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -198,7 +198,7 @@ namespace sema {
   class LambdaScopeInfo;
   class PossiblyUnreachableDiag;
   class TemplateDeductionInfo;
-}
+} // namespace sema
 
 namespace threadSafety {
   class BeforeSet;
diff --git a/include/clang/Sema/SemaConsumer.h b/include/clang/Sema/SemaConsumer.h
index 676646afbd5959c769c035be61dffa4817e9f414..f232c85e6d76d8bfe5e4f282729ec4907ba6fea8 100644
--- a/include/clang/Sema/SemaConsumer.h
+++ b/include/clang/Sema/SemaConsumer.h
@@ -43,6 +43,6 @@ namespace clang {
       return Consumer->SemaConsumer;
     }
   };
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Sema/SemaFixItUtils.h b/include/clang/Sema/SemaFixItUtils.h
index 343ccfb3d6307fb57b4d243890f4ba278ded1ac1..4d85a632da251e63b25f90566b204f529699b653 100644
--- a/include/clang/Sema/SemaFixItUtils.h
+++ b/include/clang/Sema/SemaFixItUtils.h
@@ -87,5 +87,5 @@ struct ConversionFixItGenerator {
   }
 };
 
-} // endof namespace clang
+} // namespace clang
 #endif
diff --git a/include/clang/Sema/SemaLambda.h b/include/clang/Sema/SemaLambda.h
index d043e2c459b3c29ce1ce202eed0012c401405b39..1e9a376dc1aeac360240c22750cd45682ccbcfab 100644
--- a/include/clang/Sema/SemaLambda.h
+++ b/include/clang/Sema/SemaLambda.h
@@ -31,6 +31,6 @@ Optional<unsigned> getStackIndexOfNearestEnclosingCaptureCapableLambda(
     ArrayRef<const sema::FunctionScopeInfo *> FunctionScopes,
     VarDecl *VarToCapture, Sema &S);
 
-} // clang
+} // namespace clang
 
 #endif
diff --git a/include/clang/Sema/Template.h b/include/clang/Sema/Template.h
index b822b11126ea930337b042e0eaf45b9aedd07b2e..5307bf5f5b9bf4729bd50ff729066718e0c33c00 100644
--- a/include/clang/Sema/Template.h
+++ b/include/clang/Sema/Template.h
@@ -513,6 +513,6 @@ namespace clang {
         VarTemplatePartialSpecializationDecl *PartialSpec);
     void InstantiateEnumDefinition(EnumDecl *Enum, EnumDecl *Pattern);
   };  
-}
+} // namespace clang
 
 #endif // LLVM_CLANG_SEMA_TEMPLATE_H
diff --git a/include/clang/Sema/TypoCorrection.h b/include/clang/Sema/TypoCorrection.h
index 958aab0fce349a164ecbfab5b43bc63a7b8e6771..814a85ab8e4041418625bbf45d515832439f5c19 100644
--- a/include/clang/Sema/TypoCorrection.h
+++ b/include/clang/Sema/TypoCorrection.h
@@ -355,6 +355,6 @@ public:
   }
 };
 
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h
index 83185a870ab1ca7995dac3c787e19b15d3741f6d..da217f158df8568d618bed6142d5c9b1c1e87c5c 100644
--- a/include/clang/Serialization/ASTBitCodes.h
+++ b/include/clang/Serialization/ASTBitCodes.h
@@ -1481,7 +1481,7 @@ namespace clang {
     };
 
     /// @}
-  }
+  } // namespace serialization
 } // end namespace clang
 
 #endif
diff --git a/include/clang/Serialization/ASTDeserializationListener.h b/include/clang/Serialization/ASTDeserializationListener.h
index 4b10c39d8fb22f3a3855e7436d5b0dd55d9c5856..39213311937b53d70f90a20013307220e7bee86e 100644
--- a/include/clang/Serialization/ASTDeserializationListener.h
+++ b/include/clang/Serialization/ASTDeserializationListener.h
@@ -53,6 +53,6 @@ public:
   /// \brief A module definition was read from the AST file.
   virtual void ModuleRead(serialization::SubmoduleID ID, Module *Mod) {}
 };
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Serialization/ContinuousRangeMap.h b/include/clang/Serialization/ContinuousRangeMap.h
index 244b01b22aa18d4ce8371db16afdfe8279c94a1a..05777e31ece632ce37e3871f41ccb79a3a52fcae 100644
--- a/include/clang/Serialization/ContinuousRangeMap.h
+++ b/include/clang/Serialization/ContinuousRangeMap.h
@@ -134,6 +134,6 @@ public:
   friend class Builder;
 };
 
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Serialization/GlobalModuleIndex.h b/include/clang/Serialization/GlobalModuleIndex.h
index 7e205106c4ee8a812f141a50b454d8bd4ef2881b..e11605a1d396c1b4233efbe4049f0f3f35634381 100644
--- a/include/clang/Serialization/GlobalModuleIndex.h
+++ b/include/clang/Serialization/GlobalModuleIndex.h
@@ -202,6 +202,6 @@ public:
                               StringRef Path);
 };
 
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/Serialization/ModuleManager.h b/include/clang/Serialization/ModuleManager.h
index ea4b57fa3ace98ec567d34b6c2636fcb8838555a..a5418ba4e0892ed3ffbc9d13544221b1ab1b29f2 100644
--- a/include/clang/Serialization/ModuleManager.h
+++ b/include/clang/Serialization/ModuleManager.h
@@ -330,6 +330,7 @@ public:
   void viewGraph();
 };
 
-} } // end namespace clang::serialization
+} // namespace serialization
+ } // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Checkers/ObjCRetainCount.h b/include/clang/StaticAnalyzer/Checkers/ObjCRetainCount.h
index 5850656916e37f318f7d09eec1a5de02109657e9..6602219d1e38f0be1866e1a83e50ef0b11e35769 100644
--- a/include/clang/StaticAnalyzer/Checkers/ObjCRetainCount.h
+++ b/include/clang/StaticAnalyzer/Checkers/ObjCRetainCount.h
@@ -228,7 +228,9 @@ public:
   static CallEffects getEffect(const FunctionDecl *FD);
 };
 
-}}}
+} // namespace objc_retain
+} // namespace ento
+} // namespace clang
 
 #endif
 
diff --git a/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h b/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
index f02e48a4418b7f5bd8e9a4b9a81da394599f65fa..3e8a8c6f945017c0a94d6742ac1fdd3753a1ab54 100644
--- a/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
+++ b/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
@@ -538,6 +538,6 @@ public:
   
 typedef IntrusiveRefCntPtr<AnalyzerOptions> AnalyzerOptionsRef;
   
-}
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
index 308ac8363bea1c6dd46caf981df3964d8057e284..28ae89d7d01c4bd4f1edb27b74e8ac52fcd840ad 100644
--- a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
+++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
@@ -311,8 +311,8 @@ public:
   virtual void Profile(llvm::FoldingSetNodeID& hash) const;
 };
 
-} // end ento namespace
-} // end clang namespace
+} // namespace ento
+} // namespace clang
 
 namespace llvm {
   template<> struct ilist_traits<clang::ento::BugReport>
@@ -331,7 +331,7 @@ namespace llvm {
   private:
     mutable ilist_half_node<clang::ento::BugReport> Sentinel;
   };
-}
+} // namespace llvm
 
 namespace clang {
 namespace ento {
@@ -554,8 +554,8 @@ public:
   virtual BugReport::NodeResolver& getNodeResolver() = 0;
 };
 
-} // end GR namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h
index 83b05ecc52a5c93e3be9c29991ac9ba806a0d7b2..129c329feb0a8aaf0cda4a74e8c6404869a2ef6b 100644
--- a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h
+++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h
@@ -357,9 +357,9 @@ const Stmt *GetRetValExpr(const ExplodedNode *N);
 bool isDeclRefExprToReference(const Expr *E);
 
 
-} // end namespace clang
+} // namespace bugreporter
 } // end namespace ento
-} // end namespace bugreporter
+} // namespace clang
 
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
index 16226e94df48c66f30a5b5295d12bbf30ef41667..a543052782b09986ee3b0687a0af9dd62135bf1e 100644
--- a/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
+++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
@@ -75,7 +75,7 @@ public:
   StringRef getDescription() const { return desc; }
 };
 
-} // end GR namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
index 941d524079b0a77655cbd9868a8e0b6d14a99326..d98dd78e40e7a74e8460929cb7e81c4759298c8c 100644
--- a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
+++ b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
@@ -842,8 +842,8 @@ public:
   void FullProfile(llvm::FoldingSetNodeID &ID) const;
 };  
 
-} // end GR namespace
+} // namespace ento
 
-} //end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/Checker.h b/include/clang/StaticAnalyzer/Core/Checker.h
index 099d76311fc976d34367c8185a53db3b7bd98fa0..4bd765379c4cc993b65f2834422a3ec133118448 100644
--- a/include/clang/StaticAnalyzer/Core/Checker.h
+++ b/include/clang/StaticAnalyzer/Core/Checker.h
@@ -411,7 +411,7 @@ public:
   }
 };
 
-} // end check namespace
+} // namespace check
 
 namespace eval {
 
@@ -446,7 +446,7 @@ public:
   }
 };
 
-} // end eval namespace
+} // namespace eval
 
 class CheckerBase : public ProgramPointTag {
   CheckName Name;
@@ -528,8 +528,8 @@ struct DefaultBool {
   DefaultBool &operator=(bool b) { val = b; return *this; }
 };
 
-} // end ento namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/CheckerManager.h b/include/clang/StaticAnalyzer/Core/CheckerManager.h
index 8a1a82b342ac45030f602a5e62f785138b389418..ed7c384f658d03c749cd112e696879e4f7cbab2c 100644
--- a/include/clang/StaticAnalyzer/Core/CheckerManager.h
+++ b/include/clang/StaticAnalyzer/Core/CheckerManager.h
@@ -602,8 +602,8 @@ private:
   EventsTy Events;
 };
 
-} // end ento namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h b/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h
index ce512fd301ee7ea5c5268df6c704a5bf022a3656..b2a2fbd2c3845c18a849d8b739ba297187ded73a 100644
--- a/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h
+++ b/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h
@@ -34,7 +34,7 @@ void CREATEFN(AnalyzerOptions &AnalyzerOpts,\
               const Preprocessor &PP);
 #include "clang/StaticAnalyzer/Core/Analyses.def"
 
-} // end 'ento' namespace
-} // end 'clang' namespace
+} // namespace ento
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h b/include/clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h
index cc8a9b8ef071994710e5e212412164ddeddb7a00..164d7d586efd0246740c3409763a19733b1f3aea 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h
@@ -103,7 +103,7 @@ public:
   }
 };
     
-} // end ento namespace
-} // end clang namespace
+} // namespace ento
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
index 3e0913ec4eeaa43c87adf067161be05b8366eb13..f307c10b592f0be3967aef1e9261b362dec75265 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
@@ -128,8 +128,8 @@ public:
   }
 };
 
-} // enAnaCtxMgrspace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h b/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
index 5b007f1531df8259fa77c7f9305e815b9218ac6c..8930258614b15f7f0d3b5c7289a31a5fcef264a7 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
@@ -193,8 +193,8 @@ public:
   const SVal* getPersistentSVal(SVal X);
 };
 
-} // end GR namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h b/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h
index 1d779e6cb6ec0b6399af67880e1e18c027f2c015..3a0f4ef886413da90de6df334e686ba3a0a2fd9f 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h
@@ -53,8 +53,8 @@ public:
   friend class Factory;
 };
 
-} // end GR namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
index 63b8631665ac756c059335b0d128ff6e25ac51b9..d4fbde0aac674e55f29ae9ad877e71579dc6c0a4 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
@@ -1027,6 +1027,6 @@ namespace llvm {
       return Val.get();
     }
   };
-}
+} // namespace llvm
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
index 68274f52a60c56cfe2e488fdf53d91c0bba78ceb..136e6d75bf844c7a20bf0b1d8740db58517f5be1 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
@@ -304,8 +304,8 @@ private:
   }
 };
 
-} // end GR namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
index 6a42df20d1cb69da06e53750f7f94d17144cc62c..92255de2c1eb58ca98d6b87aea0850c7afc5ef62 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
@@ -36,8 +36,8 @@ template <class T> bool containsStmt(const Stmt *S) {
   return false;
 }
 
-} // end GR namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h
index f8760964b7542637df4f9961186acd7aa9cdac28..a92c3bebeff5cf3635c7a0fd80f1c08a3ee7105b 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h
@@ -152,8 +152,8 @@ std::unique_ptr<ConstraintManager>
 CreateRangeConstraintManager(ProgramStateManager &statemgr,
                              SubEngine *subengine);
 
-} // end GR namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
index d5822e22448199ff93c51f6707c808b0294f158b..7084fa0592a2700761b78497d7b79e5952b08652 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
@@ -541,7 +541,7 @@ public:
   }
 };
 
-} // end ento namespace
-} // end clang namespace
+} // namespace ento
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeInfo.h b/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeInfo.h
index e13c6410c7be9920dc08c09d1e96082cfa9077b9..accbe7d3eace13ff619a4b3e8aea40970dddaa8c 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeInfo.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeInfo.h
@@ -46,7 +46,7 @@ public:
   }
 };
 
-} // end ento
-} // end clang
+} // namespace ento
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h b/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h
index cc3779d743f2b5c18304891a20ecf4c3c38dcc99..946ec6f5f3c71a92f7e8c961a680d2068d1d3592 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h
@@ -120,8 +120,8 @@ public:
                                  ProgramStateRef state);
 };
 
-} // end GR namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
index cfb1b921e9a425e08c90ac994363b2651eba3fb0..22b7d732c02e2cfa3764a190efe48e05c32d0f78 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
@@ -433,9 +433,9 @@ public:
   inline const_iterator end()   const { return Impl.end();   }
 };
 
-} // end GR namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 // GraphTraits
 
@@ -492,6 +492,6 @@ namespace llvm {
     }
   };
 
-} // end llvm namespace
+} // namespace llvm
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
index d8f1c34fefd169c43e68ae3bda8063905f555247..e980ab70ae5603e6a9cc80704001e34b7a1ca584 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
@@ -613,8 +613,8 @@ struct ProgramStateTrait<ReplayWithoutInlining> :
   static void *GDMIndex() { static int index = 0; return &index; }
 };
 
-} // end ento namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h b/include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h
index faa350004511f1a7e7afe1a99b995972be9dd621..9e621191386a827bc0736a29fc5ab496328d5d51 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h
@@ -135,6 +135,7 @@ public:
 
 };
 
-}} // end clang ento namespaces
+} // namespace ento
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h b/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
index 4f0712968bf6654ce4764538309be7c86c2404a0..c57756e441a61c6c511c912afd928bc494bbcf14 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
@@ -1345,9 +1345,9 @@ public:
   bool hasTrait(const MemRegion *MR, InvalidationKinds IK);
 };
   
-} // end GR namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 //===----------------------------------------------------------------------===//
 // Pretty-printing regions.
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
index ac4e452c0250e51396233dabebc1e3d3fa3ee243..49602374a3c28f6464471f69eb7fa186692ed38b 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
@@ -813,8 +813,8 @@ public:
   bool scan(const SymExpr *sym);
 };
 
-} // end ento namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h
index 6b4da7db244df122a7e4e2c20d35fea344b32737..56b5d6d40c785f520c83ea0a66e259f655fc7245 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h
@@ -238,8 +238,8 @@ namespace ento {
     }
   };
 
-} // end ento namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
index a68d3410a87b5271ddc3f87c609bb438d279f63c..d45cee05b533dfcca6b148b6f9ebd537653d6677 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
@@ -326,8 +326,8 @@ SValBuilder* createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc,
                                      ASTContext &context,
                                      ProgramStateManager &stateMgr);
 
-} // end GR namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
index 642e11af0e6cd69fb2a3b233c9ac7a60d15da3db..baeb09a3e1c8b86789cc65273f7b10e76ce7266d 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
@@ -457,7 +457,7 @@ private:
   }
 };
 
-} // end namespace ento::nonloc
+} // namespace nonloc
 
 //==------------------------------------------------------------------------==//
 //  Subclasses of Loc.
@@ -551,11 +551,11 @@ private:
   }
 };
 
-} // end ento::loc namespace
+} // namespace loc
 
-} // end ento namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 namespace llvm {
 static inline raw_ostream &operator<<(raw_ostream &os,
@@ -569,6 +569,6 @@ template <> struct isPodLike<clang::ento::SVal> {
   static const bool value = true;
 };
 
-} // end llvm namespace
+} // namespace llvm
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h b/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
index a03b6306a0edea7ba2b3900834e91cbb86e11c75..c41ac8ed62b3441116d95b7a553616614c05e425 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
@@ -281,8 +281,8 @@ CreateRegionStoreManager(ProgramStateManager &StMgr);
 std::unique_ptr<StoreManager>
 CreateFieldsOnlyRegionStoreManager(ProgramStateManager &StMgr);
 
-} // end GR namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h b/include/clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h
index 958c8c377ea2af0faafcd78ebaeca86fa30bef19..ed8af4a52e61839c1c958078c0dd2e8af112ccfb 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h
@@ -47,5 +47,6 @@ public:
   const StoreManager &getStoreManager() const { return mgr; }
 };
 
-}}
+} // namespace ento
+} // namespace clang
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
index 741ba0e2f290ab0d798ac3d1db96888141cb61d3..d7aee40a055ec46ba1e795c40dba1a85e421b930 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
@@ -155,8 +155,8 @@ public:
   virtual void processEndWorklist(bool hasWorkRemaining) = 0;
 };
 
-} // end GR namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
index 1ca96a2231478491575b18e278e9b9f21811000c..a933e658c54abb14a035a5ef484bc07e287d5dd8 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
@@ -660,9 +660,9 @@ public:
   virtual ~SymbolVisitor();
 };
 
-} // end GR namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 namespace llvm {
 static inline raw_ostream &operator<<(raw_ostream &os,
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/TaintManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/TaintManager.h
index d39b5017d312df900f4ac1c452a00574f7dd08d0..cef8918ff57685496e95bf80e1bd3ff073a1a782 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/TaintManager.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/TaintManager.h
@@ -40,7 +40,7 @@ class TaintManager {
   TaintManager() {}
 };
 
-}
-}
+} // namespace ento
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h b/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h
index 4f1a60e675569b4a0ff2abb8a3f6c6bc50961149..609bbc873f1b7202a6ba8916dbc20358699138ed 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h
@@ -93,8 +93,8 @@ public:
   static WorkList *makeBFSBlockDFSContents();
 };
 
-} // end GR namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h b/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h
index 37ea05fb99cff06c066f201e4fcb721fd779481e..e37c747528b3e95a35a7d13674ecf8c5a68b18b0 100644
--- a/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h
+++ b/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h
@@ -42,8 +42,8 @@ public:
 std::unique_ptr<AnalysisASTConsumer>
 CreateAnalysisConsumer(CompilerInstance &CI);
 
-} // end GR namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/include/clang/StaticAnalyzer/Frontend/FrontendActions.h b/include/clang/StaticAnalyzer/Frontend/FrontendActions.h
index 36afb4bc5d73e732a993e75632ba9100189c750f..c55c25e795119051c16194ee507ecc46cd903ede 100644
--- a/include/clang/StaticAnalyzer/Frontend/FrontendActions.h
+++ b/include/clang/StaticAnalyzer/Frontend/FrontendActions.h
@@ -53,7 +53,7 @@ private:
 
 void printCheckerHelp(raw_ostream &OS, ArrayRef<std::string> plugins);
 
-} // end GR namespace
+} // namespace ento
 
 } // end namespace clang
 
diff --git a/include/clang/StaticAnalyzer/Frontend/ModelConsumer.h b/include/clang/StaticAnalyzer/Frontend/ModelConsumer.h
index 24f8042587f39fa0c18ed9b439803002177fcad3..5723c2eb453a1a75ee675fb6da43c77848532a88 100644
--- a/include/clang/StaticAnalyzer/Frontend/ModelConsumer.h
+++ b/include/clang/StaticAnalyzer/Frontend/ModelConsumer.h
@@ -38,7 +38,7 @@ public:
 private:
   llvm::StringMap<Stmt *> &Bodies;
 };
-}
-}
+} // namespace ento
+} // namespace clang
 
 #endif
diff --git a/lib/ARCMigrate/ObjCMT.cpp b/lib/ARCMigrate/ObjCMT.cpp
index 8c2e0f4de8088fcc00e9eb491b99693ae5651f7d..81d1a283f02b94b9edbb2e1d1f164c58e090dc19 100644
--- a/lib/ARCMigrate/ObjCMT.cpp
+++ b/lib/ARCMigrate/ObjCMT.cpp
@@ -177,7 +177,7 @@ protected:
   }
 };
 
-}
+} // namespace
 
 ObjCMigrateAction::ObjCMigrateAction(FrontendAction *WrappedAction,
                                      StringRef migrateDir,
@@ -379,7 +379,7 @@ public:
     return true;
   }
 };
-}
+} // namespace
 
 void ObjCMigrateASTConsumer::migrateDecl(Decl *D) {
   if (!D)
@@ -1853,7 +1853,7 @@ private:
   }
 };
 
-}
+} // namespace
 
 void ObjCMigrateASTConsumer::HandleTranslationUnit(ASTContext &Ctx) {
   
@@ -2084,7 +2084,7 @@ template<> struct DenseMapInfo<EditEntry> {
         LHS.Text == RHS.Text;
   }
 };
-}
+} // namespace llvm
 
 namespace {
 class RemapFileParser {
@@ -2166,7 +2166,7 @@ private:
       Entries.push_back(Entry);
   }
 };
-}
+} // namespace
 
 static bool reportDiag(const Twine &Err, DiagnosticsEngine &Diag) {
   Diag.Report(Diag.getCustomDiagID(DiagnosticsEngine::Error, "%0"))
diff --git a/lib/ARCMigrate/TransAutoreleasePool.cpp b/lib/ARCMigrate/TransAutoreleasePool.cpp
index a8a99fa712a3c87094aad676c924f8f3b4eabb75..8e944110af8c6a2a439d9d89cd29775d2520f890 100644
--- a/lib/ARCMigrate/TransAutoreleasePool.cpp
+++ b/lib/ARCMigrate/TransAutoreleasePool.cpp
@@ -62,7 +62,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 namespace {
 
diff --git a/lib/ARCMigrate/Transforms.cpp b/lib/ARCMigrate/Transforms.cpp
index 56d3af7233bf6ea94a2549de207193de4a16ba7c..dfae3f5cba393d5c93036d945c569d471ceda9f9 100644
--- a/lib/ARCMigrate/Transforms.cpp
+++ b/lib/ARCMigrate/Transforms.cpp
@@ -355,7 +355,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 MigrationContext::~MigrationContext() {
   for (traverser_iterator
diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp
index 60cbb0601138e5e9283534cbc0b31212b226db6a..6b4a078734c0eac6c8cf9dec6ad6f6d678223f4f 100644
--- a/lib/AST/ASTDumper.cpp
+++ b/lib/AST/ASTDumper.cpp
@@ -550,7 +550,7 @@ namespace  {
     void visitVerbatimBlockLineComment(const VerbatimBlockLineComment *C);
     void visitVerbatimLineComment(const VerbatimLineComment *C);
   };
-}
+} // namespace
 
 //===----------------------------------------------------------------------===//
 //  Utilities
diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp
index 76e4e119150117c86bd92e6401d272014802e4d5..3c9899aec805ef3366a4e4a33b2710a3cb25bbb2 100644
--- a/lib/AST/ASTImporter.cpp
+++ b/lib/AST/ASTImporter.cpp
@@ -223,7 +223,7 @@ namespace clang {
     Expr *VisitMemberExpr(MemberExpr *E);
     Expr *VisitCallExpr(CallExpr *E);
   };
-}
+} // namespace clang
 using namespace clang;
 
 //----------------------------------------------------------------------------
@@ -296,7 +296,7 @@ namespace {
       return C2.getDiagnostics().Report(Loc, DiagID);
     }
   };
-}
+} // namespace
 
 static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
                                      QualType T1, QualType T2);
diff --git a/lib/AST/CXXABI.h b/lib/AST/CXXABI.h
index dad226474fa7ffd75c43c88fae3d2dd8efd783a9..2dab43cea17a1af12c8d5c5358653948d8edd384 100644
--- a/lib/AST/CXXABI.h
+++ b/lib/AST/CXXABI.h
@@ -62,6 +62,6 @@ public:
 /// Creates an instance of a C++ ABI class.
 CXXABI *CreateItaniumCXXABI(ASTContext &Ctx);
 CXXABI *CreateMicrosoftCXXABI(ASTContext &Ctx);
-}
+} // namespace clang
 
 #endif
diff --git a/lib/AST/CXXInheritance.cpp b/lib/AST/CXXInheritance.cpp
index 800c8f83b8800ee8b1e4b4daea02b297d3a74edf..b1c5a0033b81df6b773034924d7f5070cfd983e6 100644
--- a/lib/AST/CXXInheritance.cpp
+++ b/lib/AST/CXXInheritance.cpp
@@ -470,7 +470,7 @@ namespace {
                  const CXXRecordDecl *InVirtualSubobject,
                  CXXFinalOverriderMap &Overriders);
   };
-}
+} // namespace
 
 void FinalOverriderCollector::Collect(const CXXRecordDecl *RD, 
                                       bool VirtualBase,
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index d9a3389c58f3a194feb2e062a95147f52376f014..973d79fc5d20c9f0418c44378a1fac34e90e99e9 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -1350,7 +1350,7 @@ public:
     return LV;
   }
 };
-}
+} // namespace clang
 
 static LinkageInfo getLVForDecl(const NamedDecl *D,
                                 LVComputationKind computation) {
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index a1600cb1101480c4b40e28d41d56b8a2d28d24e3..c2c590f7c0484f199d8281cd46e44dd9428993bf 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -1259,7 +1259,7 @@ namespace {
                  const SynthesizeIvarChunk &RHS) {
       return LHS.Size < RHS.Size;
   }
-}
+} // namespace
 
 /// all_declared_ivar_begin - return first ivar declared in this class,
 /// its extensions and its implementation. Lazily build the list on first
diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp
index c3ce476009722d0006c1142347af8da482ebabd3..0ea946d498df0747305ca8a97449da90c5e71e31 100644
--- a/lib/AST/DeclPrinter.cpp
+++ b/lib/AST/DeclPrinter.cpp
@@ -96,7 +96,7 @@ namespace {
     void prettyPrintAttributes(Decl *D);
     void printDeclType(QualType T, StringRef DeclName, bool Pack = false);
   };
-}
+} // namespace
 
 void Decl::print(raw_ostream &Out, unsigned Indentation,
                  bool PrintInstantiation) const {
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 36f4139f835216e7e827604370a3d7751917f688..8f0c57b10b70d2331ed7b6221553055f605e5068 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -188,7 +188,7 @@ namespace {
                                 SourceLocation (Expr::*v)() const) {
     return static_cast<const E*>(expr)->getLocStart();
   }
-}
+} // namespace
 
 SourceLocation Expr::getExprLoc() const {
   switch (getStmtClass()) {
@@ -2907,7 +2907,7 @@ namespace {
         HasSideEffects = true;
     }
   };
-}
+} // namespace
 
 bool Expr::HasSideEffects(const ASTContext &Ctx,
                           bool IncludePossibleEffects) const {
@@ -3208,7 +3208,7 @@ namespace {
       NonTrivial = true;
     }
   };
-}
+} // namespace
 
 bool Expr::hasNonTrivialCall(const ASTContext &Ctx) const {
   NonTrivialCallFinder Finder(Ctx);
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index 8e472f17414021a4dcbc0d9113bf108dc2d604af..b69bc1c7953c4a701b6d2d153b75b357fa9ffd8b 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -791,7 +791,7 @@ namespace {
   };
   typedef ScopeRAII<false> BlockScopeRAII;
   typedef ScopeRAII<true> FullExpressionRAII;
-}
+} // namespace
 
 bool SubobjectDesignator::checkSubobject(EvalInfo &Info, const Expr *E,
                                          CheckSubobjectKind CSK) {
@@ -1091,7 +1091,7 @@ namespace {
       return false;
     return LHS.Path == RHS.Path;
   }
-}
+} // namespace
 
 static bool Evaluate(APValue &Result, EvalInfo &Info, const Expr *E);
 static bool EvaluateInPlace(APValue &Result, EvalInfo &Info,
@@ -3210,7 +3210,7 @@ enum EvalStmtResult {
   /// Still scanning for 'case' or 'default' statement.
   ESR_CaseNotFound
 };
-}
+} // namespace
 
 static bool EvaluateDecl(EvalInfo &Info, const Decl *D) {
   if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
@@ -4314,7 +4314,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 //===----------------------------------------------------------------------===//
 // Common base class for lvalue and temporary evaluation.
@@ -4411,7 +4411,7 @@ public:
     }
   }
 };
-}
+} // namespace
 
 //===----------------------------------------------------------------------===//
 // LValue Evaluation
@@ -5153,7 +5153,7 @@ namespace {
     bool VisitCXXConstructExpr(const CXXConstructExpr *E);
     bool VisitCXXStdInitializerListExpr(const CXXStdInitializerListExpr *E);
   };
-}
+} // namespace
 
 /// Perform zero-initialization on an object of non-union class type.
 /// C++11 [dcl.init]p5:
@@ -6645,7 +6645,7 @@ private:
   }
 };
 
-}
+} // namespace
 
 bool DataRecursiveIntBinOpEvaluator::
        VisitBinOpLHSOnly(EvalResult &LHSResult, const BinaryOperator *E,
@@ -8640,7 +8640,7 @@ struct ICEDiag {
   ICEDiag(ICEKind IK, SourceLocation l) : Kind(IK), Loc(l) {}
 };
 
-}
+} // namespace
 
 static ICEDiag NoDiag() { return ICEDiag(IK_ICE, SourceLocation()); }
 
diff --git a/lib/AST/ItaniumCXXABI.cpp b/lib/AST/ItaniumCXXABI.cpp
index 7503cbfc9805e6fa33730a4376bead96219160f5..28cb6d8b36a4a39e087af3c8d24317f6a2119399 100644
--- a/lib/AST/ItaniumCXXABI.cpp
+++ b/lib/AST/ItaniumCXXABI.cpp
@@ -153,7 +153,7 @@ public:
     return new ItaniumNumberingContext();
   }
 };
-}
+} // namespace
 
 CXXABI *clang::CreateItaniumCXXABI(ASTContext &Ctx) {
   return new ItaniumCXXABI(Ctx);
diff --git a/lib/AST/ItaniumMangle.cpp b/lib/AST/ItaniumMangle.cpp
index e5a31f879b76c839b5edb3ccbad2005c14a1266f..38c3ccb673fc0b22020f69ad7ca36800c77735c4 100644
--- a/lib/AST/ItaniumMangle.cpp
+++ b/lib/AST/ItaniumMangle.cpp
@@ -408,7 +408,7 @@ private:
   void mangleFunctionParam(const ParmVarDecl *parm);
 };
 
-}
+} // namespace
 
 bool ItaniumMangleContextImpl::shouldMangleCXXName(const NamedDecl *D) {
   const FunctionDecl *FD = dyn_cast<FunctionDecl>(D);
diff --git a/lib/AST/MicrosoftCXXABI.cpp b/lib/AST/MicrosoftCXXABI.cpp
index aba6796256a7b0e7cf5901216c37b9c96e8641c4..29229ee3c0440dd8b111cdc0bd8247ad2530c03f 100644
--- a/lib/AST/MicrosoftCXXABI.cpp
+++ b/lib/AST/MicrosoftCXXABI.cpp
@@ -124,7 +124,7 @@ public:
     return new MicrosoftNumberingContext();
   }
 };
-}
+} // namespace
 
 // getNumBases() seems to only give us the number of direct bases, and not the
 // total.  This function tells us if we inherit from anybody that uses MI, or if
diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp
index 29a95a5103cea96e1a7bf3b0868bd841371a37ce..01b1ed3c2defcb0a888ea8f8ae85fc456b8d1552 100644
--- a/lib/AST/MicrosoftMangle.cpp
+++ b/lib/AST/MicrosoftMangle.cpp
@@ -313,7 +313,7 @@ private:
   void mangleTemplateArg(const TemplateDecl *TD, const TemplateArgument &TA,
                          const NamedDecl *Parm);
 };
-}
+} // namespace
 
 bool MicrosoftMangleContextImpl::shouldMangleCXXName(const NamedDecl *D) {
   if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
diff --git a/lib/AST/NestedNameSpecifier.cpp b/lib/AST/NestedNameSpecifier.cpp
index 50a00502ca9fcace9f5cc949ac99152517161a60..059262109fc09dde85161abf9760307d6eb5772b 100644
--- a/lib/AST/NestedNameSpecifier.cpp
+++ b/lib/AST/NestedNameSpecifier.cpp
@@ -377,7 +377,7 @@ namespace {
     memcpy(&Result, static_cast<char *>(Data) + Offset, sizeof(void*));
     return Result;
   }
-}
+} // namespace
 
 SourceRange NestedNameSpecifierLoc::getSourceRange() const {
   if (!Qualifier)
@@ -470,7 +470,7 @@ namespace {
            reinterpret_cast<char *>(&Ptr) + sizeof(void *),
            Buffer, BufferSize, BufferCapacity);
   }
-}
+} // namespace
 
 NestedNameSpecifierLocBuilder::
 NestedNameSpecifierLocBuilder(const NestedNameSpecifierLocBuilder &Other) 
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp
index 6f4a89fee39c93dc60c75072a76cc13b2a516bc8..31baed83e92c57e3f1867bb45bb9f6d450947b0f 100644
--- a/lib/AST/Stmt.cpp
+++ b/lib/AST/Stmt.cpp
@@ -190,7 +190,7 @@ namespace {
   (void) is_good(implements_getLocStart(&type::getLocStart))
 #define ASSERT_IMPLEMENTS_getLocEnd(type) \
   (void) is_good(implements_getLocEnd(&type::getLocEnd))
-}
+} // namespace
 
 /// Check whether the various Stmt classes implement their member
 /// functions.
@@ -239,7 +239,7 @@ namespace {
     return SourceRange(static_cast<const S*>(stmt)->getLocStart(),
                        static_cast<const S*>(stmt)->getLocEnd());
   }
-}
+} // namespace
 
 SourceRange Stmt::getSourceRange() const {
   switch (getStmtClass()) {
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp
index 658e3dfdeed4218bc9fc5f43302175badbe27326..36eb08c01cba6bc335a5e02bb07b0cbb8a0c87e5 100644
--- a/lib/AST/StmtPrinter.cpp
+++ b/lib/AST/StmtPrinter.cpp
@@ -104,7 +104,7 @@ namespace  {
     void Visit##CLASS(CLASS *Node);
 #include "clang/AST/StmtNodes.inc"
   };
-}
+} // namespace
 
 //===----------------------------------------------------------------------===//
 //  Stmt printing methods.
@@ -799,7 +799,7 @@ void OMPClausePrinter::VisitOMPFlushClause(OMPFlushClause *Node) {
     OS << ")";
   }
 }
-}
+} // namespace
 
 //===----------------------------------------------------------------------===//
 //  OpenMP directives printing methods
diff --git a/lib/AST/StmtProfile.cpp b/lib/AST/StmtProfile.cpp
index 23f8d0c8be7a6f454031e4d564a57d75142c72a1..47e161fd94d74c2c1f092a50ff9bc5d3dc7ef9fe 100644
--- a/lib/AST/StmtProfile.cpp
+++ b/lib/AST/StmtProfile.cpp
@@ -65,7 +65,7 @@ namespace {
     /// \brief Visit a single template argument.
     void VisitTemplateArgument(const TemplateArgument &Arg);
   };
-}
+} // namespace
 
 void StmtProfiler::VisitStmt(const Stmt *S) {
   ID.AddInteger(S->getStmtClass());
@@ -425,7 +425,7 @@ OMPClauseProfiler::VisitOMPCopyprivateClause(const OMPCopyprivateClause *C) {
 void OMPClauseProfiler::VisitOMPFlushClause(const OMPFlushClause *C) {
   VisitOMPClauseList(C);
 }
-}
+} // namespace
 
 void
 StmtProfiler::VisitOMPExecutableDirective(const OMPExecutableDirective *S) {
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 3ac117194099ab4d211b80f10ac0821d63dcf280..097d0120826d6fdcee1a5692507fcd1e551d2d00 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -597,7 +597,7 @@ namespace {
       return Visit(T->getOriginalType());
     }
   };
-}
+} // namespace
 
 AutoType *Type::getContainedAutoType() const {
   return GetContainedAutoVisitor().Visit(this);
@@ -2101,7 +2101,7 @@ public:
                          L.hasLocalOrUnnamedType() | R.hasLocalOrUnnamedType());
   }
 };
-}
+} // namespace
 
 static CachedProperties computeCachedProperties(const Type *T);
 
@@ -2143,7 +2143,7 @@ public:
     T->TypeBits.CachedLocalOrUnnamed = Result.hasLocalOrUnnamedType();
   }
 };
-}
+} // namespace clang
 
 // Instantiate the friend template at a private class.  In a
 // reasonable implementation, these symbols will be internal.
diff --git a/lib/AST/TypeLoc.cpp b/lib/AST/TypeLoc.cpp
index c069eb0617397efa51012b15eb37a1ca717cb3b9..f3d379ae6eee9fdf6526c8e34838d4862db6afcb 100644
--- a/lib/AST/TypeLoc.cpp
+++ b/lib/AST/TypeLoc.cpp
@@ -33,7 +33,7 @@ namespace {
     }
 #include "clang/AST/TypeLocNodes.def"
   };
-}
+} // namespace
 
 SourceRange TypeLoc::getLocalSourceRangeImpl(TypeLoc TL) {
   if (TL.isNull()) return SourceRange();
@@ -50,7 +50,7 @@ namespace {
     }
 #include "clang/AST/TypeLocNodes.def"
   };
-}
+} // namespace
 
 /// \brief Returns the alignment of the type source info data block.
 unsigned TypeLoc::getLocalAlignmentForType(QualType Ty) {
@@ -68,7 +68,7 @@ namespace {
     }
 #include "clang/AST/TypeLocNodes.def"
   };
-}
+} // namespace
 
 /// \brief Returns the size of the type source info data block.
 unsigned TypeLoc::getFullDataSizeForType(QualType Ty) {
@@ -96,7 +96,7 @@ namespace {
     }
 #include "clang/AST/TypeLocNodes.def"
   };
-}
+} // namespace
 
 /// \brief Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the
 /// TypeLoc is a PointerLoc and next TypeLoc is for "int".
@@ -216,7 +216,7 @@ namespace {
     }
 #include "clang/AST/TypeLocNodes.def"
   };
-}
+} // namespace
 
 
 /// \brief Determines if the given type loc corresponds to a
diff --git a/lib/AST/TypePrinter.cpp b/lib/AST/TypePrinter.cpp
index ebe09d85495e15dc25fba8468d2a7696831a474d..a727a51fe6df6b5a6b423ccdac60f1feb72a5c30 100644
--- a/lib/AST/TypePrinter.cpp
+++ b/lib/AST/TypePrinter.cpp
@@ -108,7 +108,7 @@ namespace {
     void print##CLASS##After(const CLASS##Type *T, raw_ostream &OS);
 #include "clang/AST/TypeNodes.def"
   };
-}
+} // namespace
 
 static void AppendTypeQualList(raw_ostream &OS, unsigned TypeQuals, bool C99) {
   bool appendSpace = false;
diff --git a/lib/AST/VTableBuilder.cpp b/lib/AST/VTableBuilder.cpp
index ca5f0aad0013eb2d482b2fca8d71d672241544ed..ef3e5bb0b4836b61b36b16cb6f3a9cd8d19d7012 100644
--- a/lib/AST/VTableBuilder.cpp
+++ b/lib/AST/VTableBuilder.cpp
@@ -2237,7 +2237,7 @@ void ItaniumVTableBuilder::dumpLayout(raw_ostream &Out) {
 
   Out << '\n';
 }
-}
+} // namespace
 
 VTableLayout::VTableLayout(uint64_t NumVTableComponents,
                            const VTableComponent *VTableComponents,
diff --git a/lib/Analysis/BodyFarm.cpp b/lib/Analysis/BodyFarm.cpp
index 7d1b23575293d35fa807cf590b3de360590ee174..77bb3eaaa15bf7ba157f4c751dc0561c97ed0881 100644
--- a/lib/Analysis/BodyFarm.cpp
+++ b/lib/Analysis/BodyFarm.cpp
@@ -84,7 +84,7 @@ public:
 private:
   ASTContext &C;
 };
-}
+} // namespace
 
 BinaryOperator *ASTMaker::makeAssignment(const Expr *LHS, const Expr *RHS,
                                          QualType Ty) {
diff --git a/lib/Analysis/BodyFarm.h b/lib/Analysis/BodyFarm.h
index 91379437231dc7cf23c000f377424e1fe8d4604f..e5b554cb22835f4459bf8439e7f534a8199463f1 100644
--- a/lib/Analysis/BodyFarm.h
+++ b/lib/Analysis/BodyFarm.h
@@ -46,6 +46,6 @@ private:
   BodyMap Bodies;
   CodeInjector *Injector;
 };
-}
+} // namespace clang
 
 #endif
diff --git a/lib/Analysis/CallGraph.cpp b/lib/Analysis/CallGraph.cpp
index 91a8492eaa5467ee0bf105845519926390f16112..344146f857ebf958f8fec8878313757cc7b10f38 100644
--- a/lib/Analysis/CallGraph.cpp
+++ b/lib/Analysis/CallGraph.cpp
@@ -225,4 +225,4 @@ struct DOTGraphTraits<const CallGraph*> : public DefaultDOTGraphTraits {
   }
 
 };
-}
+} // namespace llvm
diff --git a/lib/Analysis/Consumed.cpp b/lib/Analysis/Consumed.cpp
index fa985ee02e590b315a49590f3dc72ddd46afaebf..5c892b25c05b6a8ffd63380429599b8fd49a9ec5 100644
--- a/lib/Analysis/Consumed.cpp
+++ b/lib/Analysis/Consumed.cpp
@@ -941,7 +941,8 @@ void ConsumedStmtVisitor::VisitVarDecl(const VarDecl *Var) {
     StateMap->setState(Var, consumed::CS_Unknown);
   }
 }
-}} // end clang::consumed::ConsumedStmtVisitor
+} // namespace consumed
+} // namespace clang
 
 namespace clang {
 namespace consumed {
@@ -1467,4 +1468,5 @@ void ConsumedAnalyzer::run(AnalysisDeclContext &AC) {
   
   WarningsHandler.emitDiagnostics();
 }
-}} // end namespace clang::consumed
+} // namespace consumed
+} // namespace clang
diff --git a/lib/Analysis/FormatStringParsing.h b/lib/Analysis/FormatStringParsing.h
index e1652964b8c24d1be4887bc0a96b8d166f71c530..d5415217150b798ef45d4fab886baa4c7ec252c2 100644
--- a/lib/Analysis/FormatStringParsing.h
+++ b/lib/Analysis/FormatStringParsing.h
@@ -68,7 +68,7 @@ public:
   const T &getValue() { return FS; }
 };
   
-} // end analyze_format_string namespace
-} // end clang namespace
+} // namespace analyze_format_string
+} // namespace clang
 
 #endif
diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp
index 0ab158036d84be7089815cae5cd4b45f67f68fde..13af3beaa2a18f3a222d3f257588fed10f8f9473 100644
--- a/lib/Analysis/LiveVariables.cpp
+++ b/lib/Analysis/LiveVariables.cpp
@@ -44,7 +44,7 @@ public:
   void sortWorklist();
 };
 
-}
+} // namespace
 
 void DataflowWorklist::enqueueBlock(const clang::CFGBlock *block) {
   if (block && !enqueuedBlocks[block->getBlockID()]) {
@@ -106,7 +106,7 @@ public:
       DSetFact(false), // This is a *major* performance win.
       killAtAssign(KillAtAssign) {}
 };
-}
+} // namespace
 
 static LiveVariablesImpl &getImpl(void *x) {
   return *((LiveVariablesImpl *) x);
@@ -135,7 +135,7 @@ namespace {
     }
     return A;
   }
-}
+} // namespace
 
 void LiveVariables::Observer::anchor() { }
 
@@ -212,7 +212,7 @@ public:
   void VisitUnaryOperator(UnaryOperator *UO);
   void Visit(Stmt *S);
 };
-}
+} // namespace
 
 static const VariableArrayType *FindVA(QualType Ty) {
   const Type *ty = Ty.getTypePtr();
diff --git a/lib/Analysis/ReachableCode.cpp b/lib/Analysis/ReachableCode.cpp
index 8165b09f408005454321e5e1c588e38e8004bde1..795d6741fe9dfd47f4a6a7e64ac3851ecce4d248 100644
--- a/lib/Analysis/ReachableCode.cpp
+++ b/lib/Analysis/ReachableCode.cpp
@@ -370,7 +370,7 @@ namespace {
                         const Stmt *S,
                         clang::reachable_code::Callback &CB);
   };
-}
+} // namespace
 
 void DeadCodeScan::enqueue(const CFGBlock *block) {
   unsigned blockID = block->getBlockID();
@@ -676,4 +676,5 @@ void FindUnreachableCode(AnalysisDeclContext &AC, Preprocessor &PP,
   }
 }
 
-}} // end namespace clang::reachable_code
+} // namespace reachable_code
+} // namespace clang
diff --git a/lib/Analysis/ThreadSafetyLogical.cpp b/lib/Analysis/ThreadSafetyLogical.cpp
index facfa11a39abf6a9b397ad8b90b692c1f92044e4..9d8456719b2e066871979cd4a5edc2dd270d1e6c 100644
--- a/lib/Analysis/ThreadSafetyLogical.cpp
+++ b/lib/Analysis/ThreadSafetyLogical.cpp
@@ -109,4 +109,4 @@ bool implies(const LExpr *LHS, const LExpr *RHS) {
 }
 }
 }
-}
+} // namespace clang
diff --git a/lib/Analysis/UninitializedValues.cpp b/lib/Analysis/UninitializedValues.cpp
index f2f791957aa320cafa03f318b95e8dbd4db72932..df071c44811e0ce79759af2974a351c9cff875c4 100644
--- a/lib/Analysis/UninitializedValues.cpp
+++ b/lib/Analysis/UninitializedValues.cpp
@@ -62,7 +62,7 @@ public:
   /// Returns the bit vector index for a given declaration.
   Optional<unsigned> getValueIndex(const VarDecl *d) const;
 };
-}
+} // namespace
 
 void DeclToIndex::computeMap(const DeclContext &dc) {
   unsigned count = 0;
@@ -223,7 +223,7 @@ public:
   void enqueueSuccessors(const CFGBlock *block);
   const CFGBlock *dequeue();
 };
-}
+} // namespace
 
 void DataflowWorklist::enqueueSuccessors(const clang::CFGBlock *block) {
   for (CFGBlock::const_succ_iterator I = block->succ_begin(),
@@ -345,7 +345,7 @@ public:
     return Init;
   }
 };
-}
+} // namespace
 
 static const DeclRefExpr *getSelfInitExpr(VarDecl *VD) {
   if (VD->getType()->isRecordType()) return nullptr;
@@ -672,7 +672,7 @@ public:
     return Use;
   }
 };
-}
+} // namespace
 
 void TransferFunctions::reportUse(const Expr *ex, const VarDecl *vd) {
   Value v = vals[vd];
@@ -862,7 +862,7 @@ struct PruneBlocksHandler : public UninitVariablesHandler {
     hadAnyUse = true;
   }
 };
-}
+} // namespace
 
 void clang::runUninitializedVariablesAnalysis(
     const DeclContext &dc,
diff --git a/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp
index 643503b00b918d1e7c3ef1ccbcbd6866418bb8b4..baee5aa8e0286b5e1aa70f5778929021b52c63c4 100644
--- a/lib/Basic/DiagnosticIDs.cpp
+++ b/lib/Basic/DiagnosticIDs.cpp
@@ -68,7 +68,7 @@ struct StaticDiagInfoRec {
   }
 };
 
-} // namespace anonymous
+} // namespace
 
 static const StaticDiagInfoRec StaticDiagInfo[] = {
 #define DIAG(ENUM, CLASS, DEFAULT_SEVERITY, DESC, GROUP, SFINAE, NOWERROR,     \
@@ -193,7 +193,7 @@ namespace {
       return StringRef(NameStr, NameLen);
     }
   };
-}
+} // namespace
 
 // Unfortunately, the split between DiagnosticIDs and Diagnostic is not
 // particularly clean, but for now we just implement this method here so we can
@@ -292,8 +292,8 @@ namespace clang {
       }
     };
 
-  } // end diag namespace
-} // end clang namespace
+  } // namespace diag
+} // namespace clang
 
 
 //===----------------------------------------------------------------------===//
@@ -497,7 +497,7 @@ namespace {
                        DiagGroupNames[NameOffset]);
     }
   };
-}
+} // namespace
 
 // Second the table of options, sorted by name for fast binary lookup.
 static const WarningOption OptionTable[] = {
diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp
index b2950081000346fef17c34a6986277ed6ea3d175..c7bb2c667d3c66710713ee30aacf6dbc862b2f57 100644
--- a/lib/Basic/IdentifierTable.cpp
+++ b/lib/Basic/IdentifierTable.cpp
@@ -122,7 +122,7 @@ namespace {
     KS_Enabled,     // Enabled
     KS_Future       // Is a keyword in future standard
   };
-}
+} // namespace
 
 /// \brief Translates flags as specified in TokenKinds.def into keyword status
 /// in the given language standard.
diff --git a/lib/Basic/VirtualFileSystem.cpp b/lib/Basic/VirtualFileSystem.cpp
index 8a882e13f7a5e718940a1e8afd07c77d9b510eea..7196f2d1f962d9df52fb3272619295491598c591 100644
--- a/lib/Basic/VirtualFileSystem.cpp
+++ b/lib/Basic/VirtualFileSystem.cpp
@@ -213,7 +213,7 @@ public:
     return EC;
   }
 };
-}
+} // namespace
 
 directory_iterator RealFileSystem::dir_begin(const Twine &Dir,
                                              std::error_code &EC) {
@@ -1024,7 +1024,7 @@ public:
   JSONWriter(llvm::raw_ostream &OS) : OS(OS) {}
   void write(ArrayRef<YAMLVFSEntry> Entries, Optional<bool> IsCaseSensitive);
 };
-}
+} // namespace
 
 bool JSONWriter::containedIn(StringRef Parent, StringRef Path) {
   using namespace llvm::sys;
diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp
index f5edea7810ab699e5f4a698b855c5131cb56a5b3..b133e932c42367563bae8c402685a5c09508905b 100644
--- a/lib/CodeGen/BackendUtil.cpp
+++ b/lib/CodeGen/BackendUtil.cpp
@@ -149,7 +149,7 @@ private:
   const LangOptions &LangOpts;
 };
 
-}
+} // namespace
 
 static void addObjCARCAPElimPass(const PassManagerBuilder &Builder, PassManagerBase &PM) {
   if (Builder.OptLevel > 0)
diff --git a/lib/CodeGen/CGAtomic.cpp b/lib/CodeGen/CGAtomic.cpp
index da82249fe11475d4cfb606c6de8ff54ed6a8b5dc..57b92dd97dc6e3aca6c6c575063d9ca2bb0b8caf 100644
--- a/lib/CodeGen/CGAtomic.cpp
+++ b/lib/CodeGen/CGAtomic.cpp
@@ -272,7 +272,7 @@ namespace {
     void EmitAtomicUpdateOp(llvm::AtomicOrdering AO, RValue UpdateRal,
                             bool IsVolatile);
   };
-}
+} // namespace
 
 AtomicExpr::AtomicOrderingKind
 AtomicInfo::translateAtomicOrdering(const llvm::AtomicOrdering AO) {
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp
index 3fd344c389a5098b32f0a78103a4176697c4a4e0..d3a3131888c35cb2eeb2753bbe0922833eab8ef3 100644
--- a/lib/CodeGen/CGBlocks.cpp
+++ b/lib/CodeGen/CGBlocks.cpp
@@ -242,7 +242,7 @@ namespace {
     
       return LeftValue > RightValue;
   }
-}
+} // namespace
 
 /// Determines if the given type is safe for constant capture in C++.
 static bool isSafeForCXXConstantCapture(QualType type) {
@@ -2249,7 +2249,7 @@ namespace {
       CGF.BuildBlockRelease(Addr, BLOCK_FIELD_IS_BYREF);
     }
   };
-}
+} // namespace
 
 /// Enter a cleanup to destroy a __block variable.  Note that this
 /// cleanup should be a no-op if the variable hasn't left the stack
diff --git a/lib/CodeGen/CGBlocks.h b/lib/CodeGen/CGBlocks.h
index c4eed0d0e8eb46d295085a1f41653db3da645553..ef43d1b09875cbbb821c049534c87e92364da6c3 100644
--- a/lib/CodeGen/CGBlocks.h
+++ b/lib/CodeGen/CGBlocks.h
@@ -37,7 +37,7 @@ class FunctionType;
 class PointerType;
 class Value;
 class LLVMContext;
-}
+} // namespace llvm
 
 namespace clang {
 
diff --git a/lib/CodeGen/CGCUDANV.cpp b/lib/CodeGen/CGCUDANV.cpp
index 67d0ab7a82f7bc6c1016499fb320cf46e8b6eb97..0ffdb43d5660cdf6b909c31e7cc65dd75ab96ab8 100644
--- a/lib/CodeGen/CGCUDANV.cpp
+++ b/lib/CodeGen/CGCUDANV.cpp
@@ -74,7 +74,7 @@ public:
   llvm::Function *makeModuleDtorFunction() override;
 };
 
-}
+} // namespace
 
 CGNVCUDARuntime::CGNVCUDARuntime(CodeGenModule &CGM)
     : CGCUDARuntime(CGM), Context(CGM.getLLVMContext()),
diff --git a/lib/CodeGen/CGCUDARuntime.h b/lib/CodeGen/CGCUDARuntime.h
index dcacf9703277bacae4601ee94461248bd9bcea82..05e36e61311b95c954b215105c6b483512c7c264 100644
--- a/lib/CodeGen/CGCUDARuntime.h
+++ b/lib/CodeGen/CGCUDARuntime.h
@@ -59,7 +59,7 @@ public:
 /// Creates an instance of a CUDA runtime class.
 CGCUDARuntime *CreateNVCUDARuntime(CodeGenModule &CGM);
 
-}
-}
+} // namespace CodeGen
+} // namespace clang
 
 #endif
diff --git a/lib/CodeGen/CGCXXABI.h b/lib/CodeGen/CGCXXABI.h
index b6b4ee6850ac841f07fa5b51682b0a052bc48d7d..b8f3dee07c9c2c551245dd8bd819bcc49776cad9 100644
--- a/lib/CodeGen/CGCXXABI.h
+++ b/lib/CodeGen/CGCXXABI.h
@@ -542,7 +542,7 @@ CGCXXABI *CreateItaniumCXXABI(CodeGenModule &CGM);
 /// Creates a Microsoft-family ABI.
 CGCXXABI *CreateMicrosoftCXXABI(CodeGenModule &CGM);
 
-}
-}
+} // namespace CodeGen
+} // namespace clang
 
 #endif
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index 58ef171df0d75b1b5b8b93ed5c995610994165fb..4fbcac1b22da09e35d0d1825a1ef1397978a3181 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -2843,7 +2843,7 @@ struct DestroyUnpassedArg : EHScopeStack::Cleanup {
   }
 };
 
-}
+} // namespace
 
 struct DisableDebugLocationUpdates {
   CodeGenFunction &CGF;
diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp
index 4d6a4e288dd3faaea2c5cabfa153cd6b9f746c3e..cfba8db63245d25c48a9061db66cd1f7472b1b10 100644
--- a/lib/CodeGen/CGClass.cpp
+++ b/lib/CodeGen/CGClass.cpp
@@ -384,7 +384,7 @@ namespace {
     // external code might potentially access the vtable.
     void VisitCXXThisExpr(const CXXThisExpr *E) { UsesThis = true; }
   };
-}
+} // namespace
 
 static bool BaseInitializerUsesThis(ASTContext &C, const Expr *Init) {
   DynamicThisUseChecker Checker(C);
@@ -860,7 +860,7 @@ namespace {
     CodeGenFunction &CGF;
     SanitizerSet OldSanOpts;
   };
-}
+} // namespace
 
 namespace {
   class FieldMemcpyizer {
@@ -1228,7 +1228,7 @@ namespace {
     }
   };
 
-}
+} // namespace
 
 /// EmitCtorPrologue - This routine generates necessary code to initialize
 /// base classes and non-static data members belonging to this constructor.
@@ -1531,7 +1531,7 @@ namespace {
                       flags.isForNormalCleanup() && useEHCleanupForArray);
     }
   };
-}
+} // namespace
 
 /// \brief Emit all code that comes at the end of class's
 /// destructor. This is to call destructors on members and base classes
@@ -1892,7 +1892,7 @@ namespace {
                                 /*Delegating=*/true, Addr);
     }
   };
-}
+} // namespace
 
 void
 CodeGenFunction::EmitDelegatingCXXConstructorCall(const CXXConstructorDecl *Ctor,
@@ -1945,7 +1945,7 @@ namespace {
                                 /*Delegating=*/false, Addr);
     }
   };
-}
+} // namespace
 
 void CodeGenFunction::PushDestructorCleanup(const CXXDestructorDecl *D,
                                             llvm::Value *Addr) {
diff --git a/lib/CodeGen/CGCleanup.h b/lib/CodeGen/CGCleanup.h
index 81c64123dfdb5574ad9b31578b83e35be393fa04..792cc07bdb8265652a7519751fb5dee0bc100b91 100644
--- a/lib/CodeGen/CGCleanup.h
+++ b/lib/CodeGen/CGCleanup.h
@@ -551,7 +551,7 @@ EHScopeStack::stabilize(iterator ir) const {
   return stable_iterator(EndOfBuffer - ir.Ptr);
 }
 
-}
-}
+} // namespace CodeGen
+} // namespace clang
 
 #endif
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index 07dbce4252fef2d702635a87b4a989063f3d1cbb..97c0f2af29ff5db2fa849f64d5b8a60c171b0d12 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -522,7 +522,7 @@ namespace {
       CGF.EmitLifetimeEnd(Size, Addr);
     }
   };
-}
+} // namespace
 
 /// EmitAutoVarWithLifetime - Does the setup required for an automatic
 /// variable with lifetime.
@@ -1586,7 +1586,7 @@ namespace {
                               ElementType, Destroyer);
     }
   };
-}
+} // namespace
 
 /// pushIrregularPartialArrayCleanup - Push an EH cleanup to destroy
 /// already-constructed elements of the given array.  The cleanup
@@ -1651,7 +1651,7 @@ namespace {
       CGF.EmitARCRelease(Param, Precise);
     }
   };
-}
+} // namespace
 
 /// Emit an alloca (or GlobalValue depending on target)
 /// for the specified parameter and set up LocalDeclMap.
diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp
index 4c8501724bd8734c7a2ec5a0b92e75b20d3a5b59..935facba1e1a59b864a208bd10ad57448770231a 100644
--- a/lib/CodeGen/CGException.cpp
+++ b/lib/CodeGen/CGException.cpp
@@ -110,7 +110,7 @@ namespace {
     static const EHPersonality MSVC_C_specific_handler;
     static const EHPersonality MSVC_CxxFrameHandler3;
   };
-}
+} // namespace
 
 const EHPersonality EHPersonality::GNU_C = { "__gcc_personality_v0", nullptr };
 const EHPersonality
@@ -361,7 +361,7 @@ namespace {
       CGF.EmitNounwindRuntimeCall(getFreeExceptionFn(CGF.CGM), exn);
     }
   };
-}
+} // namespace
 
 // Emits an exception expression into the given location.  This
 // differs from EmitAnyExprToMem only in that, if a final copy-ctor
@@ -1081,7 +1081,7 @@ namespace {
       CGF.EnsureInsertPoint();
     }
   };
-}
+} // namespace
 
 /// Enters a finally block for an implementation using zero-cost
 /// exceptions.  This is mostly general, but hard-codes some
@@ -1332,7 +1332,7 @@ struct PerformSEHFinally : EHScopeStack::Cleanup {
     CGF.EmitCall(FnInfo, OutlinedFinally, ReturnValueSlot(), Args);
   }
 };
-}
+} // namespace
 
 namespace {
 /// Find all local variable captures in the statement.
@@ -1367,7 +1367,7 @@ struct CaptureFinder : ConstStmtVisitor<CaptureFinder> {
     Captures.push_back(ParentThis);
   }
 };
-}
+} // namespace
 
 void CodeGenFunction::EmitCapturedLocals(CodeGenFunction &ParentCGF,
                                          const Stmt *OutlinedStmt,
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 1a76afaf11589a17239ae6725b9f86aa2f002b7e..20c3c6b15b56ff17fb5488010c923363aa0d77a1 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -2242,7 +2242,7 @@ enum class CheckRecoverableKind {
   /// Runtime conditionally aborts, always need to support recovery.
   AlwaysRecoverable
 };
-}
+} // namespace
 
 static CheckRecoverableKind getRecoverableKind(SanitizerMask Kind) {
   assert(llvm::countPopulation(Kind) == 1);
diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp
index f0f706d7b957dcd26654005adfada4fadef6caf6..d3a4fd29d996e0622b50fdc2198fbac65fe38ac7 100644
--- a/lib/CodeGen/CGExprCXX.cpp
+++ b/lib/CodeGen/CGExprCXX.cpp
@@ -1213,7 +1213,7 @@ namespace {
       EmitNewDeleteCall(CGF, OperatorDelete, FPT, DeleteArgs);
     }
   };
-}
+} // namespace
 
 /// Enter a cleanup to call 'operator delete' if the initializer in a
 /// new-expression throws.
@@ -1437,7 +1437,7 @@ namespace {
       CGF.EmitDeleteCall(OperatorDelete, Ptr, ElementType);
     }
   };
-}
+} // namespace
 
 void
 CodeGenFunction::pushCallObjectDeleteCleanup(const FunctionDecl *OperatorDelete,
@@ -1564,7 +1564,7 @@ namespace {
       EmitNewDeleteCall(CGF, OperatorDelete, DeleteFTy, Args);
     }
   };
-}
+} // namespace
 
 /// Emit the code for deleting an array of objects.
 static void EmitArrayDelete(CodeGenFunction &CGF,
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index acfb9b6dbb255c7ba0159e649c48152ee524a43b..e88d62425b5fe3900183b7c29521c265069557cc 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/lib/CodeGen/CGExprConstant.cpp
@@ -421,7 +421,7 @@ struct BaseInfo {
 
   bool operator<(const BaseInfo &O) const { return Offset < O.Offset; }
 };
-}
+} // namespace
 
 void ConstStructBuilder::Build(const APValue &Val, const RecordDecl *RD,
                                bool IsPrimaryBase,
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp
index 9981fccb3e9dd9c8d2d752c58674c6e11d6b4827..09f92ad3bee02b0626a68c1b73eec9d7e3e2332c 100644
--- a/lib/CodeGen/CGObjC.cpp
+++ b/lib/CodeGen/CGObjC.cpp
@@ -448,7 +448,7 @@ struct FinishARCDealloc : EHScopeStack::Cleanup {
                                                       method);
   }
 };
-}
+} // namespace
 
 /// StartObjCMethod - Begin emission of an ObjCMethod. This generates
 /// the LLVM function and sets the other context used by
@@ -599,7 +599,7 @@ namespace {
     CharUnits IvarSize;
     CharUnits IvarAlignment;
   };
-}
+} // namespace
 
 /// Pick an implementation strategy for the given property synthesis.
 PropertyImplStrategy::PropertyImplStrategy(CodeGenModule &CGM,
@@ -1296,7 +1296,7 @@ namespace {
                       flags.isForNormalCleanup() && useEHCleanupForArray);
     }
   };
-}
+} // namespace
 
 /// Like CodeGenFunction::destroyARCStrong, but do it with a call.
 static void destroyARCStrongWithStore(CodeGenFunction &CGF,
@@ -1724,7 +1724,7 @@ namespace {
       CGF.EmitARCRelease(object, ARCImpreciseLifetime);
     }
   };
-}
+} // namespace
 
 /// Produce the code for a CK_ARCConsumeObject.  Does a primitive
 /// release at the end of the full-expression.
@@ -2340,7 +2340,7 @@ namespace {
       CGF.EmitObjCMRRAutoreleasePoolPop(Token);
     }
   };
-}
+} // namespace
 
 void CodeGenFunction::EmitObjCAutoreleasePoolCleanup(llvm::Value *Ptr) {
   if (CGM.getLangOpts().ObjCAutoRefCount)
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index a45446a7065a327209a48300e1349062a97c70cc..95326b39871a088e7e1511c87c9340f1ef095a81 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -3500,7 +3500,7 @@ namespace {
     void emitWriteHazard();
     void emitHazardsInNewBlocks();
   };
-}
+} // namespace
 
 /// Create the fragile-ABI read and write hazards based on the current
 /// state of the function, which is presumed to be immediately prior
diff --git a/lib/CodeGen/CGObjCRuntime.cpp b/lib/CodeGen/CGObjCRuntime.cpp
index 5290a87cebf22c4ebbf331033895c1e8d8ad25e1..009c0d916f506ac81b150a14bec2607fb860217e 100644
--- a/lib/CodeGen/CGObjCRuntime.cpp
+++ b/lib/CodeGen/CGObjCRuntime.cpp
@@ -167,7 +167,7 @@ namespace {
       CGF.EmitRuntimeCallOrInvoke(Fn);
     }
   };
-}
+} // namespace
 
 
 void CGObjCRuntime::EmitTryCatchStmt(CodeGenFunction &CGF,
@@ -307,7 +307,7 @@ namespace {
       CGF.Builder.CreateCall(SyncExitFn, SyncArg)->setDoesNotThrow();
     }
   };
-}
+} // namespace
 
 void CGObjCRuntime::EmitAtSynchronizedStmt(CodeGenFunction &CGF,
                                            const ObjCAtSynchronizedStmt &S,
diff --git a/lib/CodeGen/CGObjCRuntime.h b/lib/CodeGen/CGObjCRuntime.h
index 475254649866edb80b553d40fe56d1da1095dcf7..396d8e82960d0ecd95585db46743a3510ed14cf9 100644
--- a/lib/CodeGen/CGObjCRuntime.h
+++ b/lib/CodeGen/CGObjCRuntime.h
@@ -295,6 +295,6 @@ public:
 //TODO: This should include some way of selecting which runtime to target.
 CGObjCRuntime *CreateGNUObjCRuntime(CodeGenModule &CGM);
 CGObjCRuntime *CreateMacObjCRuntime(CodeGenModule &CGM);
-}
-}
+} // namespace CodeGen
+} // namespace clang
 #endif
diff --git a/lib/CodeGen/CGOpenCLRuntime.h b/lib/CodeGen/CGOpenCLRuntime.h
index 0c50b92914b828823a5cf0a9742c1b001dffaece..54d979f649174d1dbab608762e593ddae1c4664a 100644
--- a/lib/CodeGen/CGOpenCLRuntime.h
+++ b/lib/CodeGen/CGOpenCLRuntime.h
@@ -46,7 +46,7 @@ public:
   virtual llvm::Type *convertOpenCLSpecificType(const Type *T);
 };
 
-}
-}
+} // namespace CodeGen
+} // namespace clang
 
 #endif
diff --git a/lib/CodeGen/CGRecordLayoutBuilder.cpp b/lib/CodeGen/CGRecordLayoutBuilder.cpp
index c89d5cc3892a1d6e7ccd53fe89db91ccd9ee2d95..b28770e2566ad617eb2eedbf8def7b4d919254a8 100644
--- a/lib/CodeGen/CGRecordLayoutBuilder.cpp
+++ b/lib/CodeGen/CGRecordLayoutBuilder.cpp
@@ -212,7 +212,7 @@ private:
   CGRecordLowering(const CGRecordLowering &) = delete;
   void operator =(const CGRecordLowering &) = delete;
 };
-} // namespace {
+} // namespace
 
 CGRecordLowering::CGRecordLowering(CodeGenTypes &Types, const RecordDecl *D,                                 bool Packed)
   : Types(Types), Context(Types.getContext()), D(D),
diff --git a/lib/CodeGen/CodeGenAction.cpp b/lib/CodeGen/CodeGenAction.cpp
index 54e6b73b3020d4f89d36d961bf5effc38318b78a..89d01a191b86ecf906317d3655d7f02577e38d49 100644
--- a/lib/CodeGen/CodeGenAction.cpp
+++ b/lib/CodeGen/CodeGenAction.cpp
@@ -258,7 +258,7 @@ namespace clang {
   };
   
   void BackendConsumer::anchor() {}
-}
+} // namespace clang
 
 /// ConvertBackendLocation - Convert a location in a temporary llvm::SourceMgr
 /// buffer to be a valid FullSourceLoc.
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 2dd5414795e7340f307b2c6a94700d7a231f3601..79a1dcbb4f46492eba798c9c5879a7d33a93e8fe 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -1435,7 +1435,7 @@ namespace {
       return true;
     }
   };
-}
+} // namespace
 
 // isTriviallyRecursive - Check if this function calls another
 // decl that, because of the asm attribute or the other decl being a builtin,
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h
index 8e671fa7878c7fdc9b108b6699db54217ad679c9..28582f54b4927ceb6a4232a23fcef4db47561822 100644
--- a/lib/CodeGen/CodeGenModule.h
+++ b/lib/CodeGen/CodeGenModule.h
@@ -44,7 +44,7 @@ class DataLayout;
 class FunctionType;
 class LLVMContext;
 class IndexedInstrProfReader;
-}
+} // namespace llvm
 
 namespace clang {
 class TargetCodeGenInfo;
diff --git a/lib/CodeGen/CodeGenPGO.cpp b/lib/CodeGen/CodeGenPGO.cpp
index f182a469b3a41a57d11f2d8eca93c0551c82252f..51b44b794aefaf4bfbd3335ea15a263620941120 100644
--- a/lib/CodeGen/CodeGenPGO.cpp
+++ b/lib/CodeGen/CodeGenPGO.cpp
@@ -605,7 +605,7 @@ struct ComputeRegionCounts : public ConstStmtVisitor<ComputeRegionCounts> {
     RecordNextStmtCount = true;
   }
 };
-}
+} // namespace
 
 void PGOHash::combine(HashType Type) {
   // Check that we never combine 0 and only have six bits.
diff --git a/lib/CodeGen/CoverageMappingGen.cpp b/lib/CodeGen/CoverageMappingGen.cpp
index 9ad5d14edfdcc607a7af10a33f894ff7602e6c55..92c206de8f5d0a25c9131e6440247b82d9ebb3c6 100644
--- a/lib/CodeGen/CoverageMappingGen.cpp
+++ b/lib/CodeGen/CoverageMappingGen.cpp
@@ -884,7 +884,7 @@ struct CounterCoverageMappingBuilder
     // propagate counts into them.
   }
 };
-}
+} // namespace
 
 static bool isMachO(const CodeGenModule &CGM) {
   return CGM.getTarget().getTriple().isOSBinFormatMachO();
diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp
index 3f5ad5db01b535c94905b2d6848576b19cb677a2..a6de4773992df5ef7bd425c8d71448ebdbcb9d34 100644
--- a/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/lib/CodeGen/ItaniumCXXABI.cpp
@@ -336,7 +336,7 @@ public:
   // ARM64 libraries are prepared for non-unique RTTI.
   bool shouldRTTIBeUnique() const override { return false; }
 };
-}
+} // namespace
 
 CodeGen::CGCXXABI *CodeGen::CreateItaniumCXXABI(CodeGenModule &CGM) {
   switch (CGM.getTarget().getCXXABI().getKind()) {
@@ -1743,7 +1743,7 @@ namespace {
                                   Guard);
     }
   };
-}
+} // namespace
 
 /// The ARM code here follows the Itanium code closely enough that we
 /// just special-case it at particular places.
@@ -2250,7 +2250,7 @@ public:
   /// \param Force - true to force the creation of this RTTI value
   llvm::Constant *BuildTypeInfo(QualType Ty, bool Force = false);
 };
-}
+} // namespace
 
 llvm::GlobalVariable *ItaniumRTTIBuilder::GetAddrOfTypeName(
     QualType Ty, llvm::GlobalVariable::LinkageTypes Linkage) {
@@ -3347,7 +3347,7 @@ namespace {
       CGF.EmitRuntimeCallOrInvoke(getEndCatchFn(CGF.CGM));
     }
   };
-}
+} // namespace
 
 /// Emits a call to __cxa_begin_catch and enters a cleanup to call
 /// __cxa_end_catch.
diff --git a/lib/CodeGen/MicrosoftCXXABI.cpp b/lib/CodeGen/MicrosoftCXXABI.cpp
index 679516bfa89adec9d53547f220bd8bd5c259b692..f085a908386a54b36e2677740dbb029cb80c1306 100644
--- a/lib/CodeGen/MicrosoftCXXABI.cpp
+++ b/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -707,7 +707,7 @@ private:
   llvm::StructType *CatchHandlerTypeType;
 };
 
-}
+} // namespace
 
 CGCXXABI::RecordArgABI
 MicrosoftCXXABI::getRecordArgABI(const CXXRecordDecl *RD) const {
@@ -2195,7 +2195,7 @@ struct CallInitThreadAbort : EHScopeStack::Cleanup {
     CGF.EmitNounwindRuntimeCall(getInitThreadAbortFn(CGF.CGM), Guard);
   }
 };
-}
+} // namespace
 
 void MicrosoftCXXABI::EmitGuardedInit(CodeGenFunction &CGF, const VarDecl &D,
                                       llvm::GlobalVariable *GV,
diff --git a/lib/CodeGen/ModuleBuilder.cpp b/lib/CodeGen/ModuleBuilder.cpp
index 25e57401fd57aa029a6cc1017e76c386f00eabb0..158ee906d070d7fb3bdbfffa1de5a75661f5c42b 100644
--- a/lib/CodeGen/ModuleBuilder.cpp
+++ b/lib/CodeGen/ModuleBuilder.cpp
@@ -232,7 +232,7 @@ namespace {
       Builder->AddDependentLib(Lib);
     }
   };
-}
+} // namespace
 
 void CodeGenerator::anchor() { }
 
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
index e77c1242e70b1ccf78bed03c0645b770f94eff52..41a826c31e38c7c65edabcd9cb3e66242fcec4f9 100644
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/lib/CodeGen/TargetInfo.cpp
@@ -685,7 +685,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 /// Rewrite input constraint references after adding some output constraints.
 /// In the case where there is one output and one input and we add one output,
@@ -1750,7 +1750,7 @@ void WinX86_64TargetCodeGenInfo::setTargetAttributes(const Decl *D,
 
   addStackProbeSizeTargetAttribute(D, GV, CGM);
 }
-}
+} // namespace
 
 void X86_64ABIInfo::postMerge(unsigned AggregateSize, Class &Lo,
                               Class &Hi) const {
@@ -3151,7 +3151,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 llvm::Value *PPC32_SVR4_ABIInfo::EmitVAArg(llvm::Value *VAListAddr,
                                            QualType Ty,
@@ -3431,7 +3431,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 // Return true if the ABI requires Ty to be passed sign- or zero-
 // extended to 64 bits.
@@ -3977,7 +3977,7 @@ public:
 
   bool doesReturnSlotInterfereWithArgs() const override { return false; }
 };
-}
+} // namespace
 
 ABIArgInfo AArch64ABIInfo::classifyArgumentType(QualType Ty) const {
   Ty = useFirstFieldIfTransparentUnion(Ty);
@@ -4605,7 +4605,7 @@ void WindowsARMTargetCodeGenInfo::setTargetAttributes(
   ARMTargetCodeGenInfo::setTargetAttributes(D, GV, CGM);
   addStackProbeSizeTargetAttribute(D, GV, CGM);
 }
-}
+} // namespace
 
 void ARMABIInfo::computeInfo(CGFunctionInfo &FI) const {
   if (!getCXXABI().classifyReturnType(FI))
@@ -5179,7 +5179,7 @@ void NVPTXTargetCodeGenInfo::addNVVMMetadata(llvm::Function *F, StringRef Name,
   // Append metadata to nvvm.annotations
   MD->addOperand(llvm::MDNode::get(Ctx, MDVals));
 }
-}
+} // namespace
 
 //===----------------------------------------------------------------------===//
 // SystemZ ABI Implementation
@@ -5220,7 +5220,7 @@ public:
     : TargetCodeGenInfo(new SystemZABIInfo(CGT, HasVector)) {}
 };
 
-}
+} // namespace
 
 bool SystemZABIInfo::isPromotableIntegerType(QualType Ty) const {
   // Treat an enum type as its underlying type.
@@ -5530,7 +5530,7 @@ public:
                            CodeGen::CodeGenModule &M) const override;
 };
 
-}
+} // namespace
 
 void MSP430TargetCodeGenInfo::setTargetAttributes(const Decl *D,
                                                   llvm::GlobalValue *GV,
@@ -5612,7 +5612,7 @@ public:
     return SizeOfUnwindException;
   }
 };
-}
+} // namespace
 
 void MipsABIInfo::CoerceToIntArgs(
     uint64_t TySize, SmallVectorImpl<llvm::Type *> &ArgList) const {
@@ -5979,7 +5979,7 @@ void TCETargetCodeGenInfo::setTargetAttributes(
   }
 }
 
-}
+} // namespace
 
 //===----------------------------------------------------------------------===//
 // Hexagon ABI Implementation
@@ -6014,7 +6014,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 void HexagonABIInfo::computeInfo(CGFunctionInfo &FI) const {
   if (!getCXXABI().classifyReturnType(FI))
@@ -6128,7 +6128,7 @@ public:
                            CodeGen::CodeGenModule &M) const override;
 };
 
-}
+} // namespace
 
 void AMDGPUTargetCodeGenInfo::setTargetAttributes(
   const Decl *D,
diff --git a/lib/CodeGen/TargetInfo.h b/lib/CodeGen/TargetInfo.h
index bf63265f02830529a020cc10cfdc798ab5317f74..97ac04229eea506424b13c414a2a4896cf2c9b52 100644
--- a/lib/CodeGen/TargetInfo.h
+++ b/lib/CodeGen/TargetInfo.h
@@ -226,6 +226,6 @@ public:
     return 0;
   }
 };
-}
+} // namespace clang
 
 #endif
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 2367914cc0b42eedf47da0042936c141c4d398bf..2ba969d667ba9817c9a0e897898a3ebdebefa32d 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -2322,7 +2322,7 @@ enum OpenMPRuntimeKind {
   /// on this runtime library name.
   OMPRT_IOMP5
 };
-}
+} // namespace
 
 /// Compute the desired OpenMP runtime from the flag provided.
 static OpenMPRuntimeKind getOpenMPRuntime(const ToolChain &TC,
diff --git a/lib/Driver/Tools.h b/lib/Driver/Tools.h
index 753f542622fea333c796739b37bf47e82674a8e0..58ee29bfb91e44d97f02224771f46dda5459913e 100644
--- a/lib/Driver/Tools.h
+++ b/lib/Driver/Tools.h
@@ -234,7 +234,7 @@ namespace arm {
   const char* getLLVMArchSuffixForARM(StringRef CPU, StringRef Arch);
 
   void appendEBLinkFlags(const llvm::opt::ArgList &Args, ArgStringList &CmdArgs, const llvm::Triple &Triple);
-}
+} // namespace arm
 
 namespace mips {
   typedef enum {
@@ -252,7 +252,7 @@ namespace mips {
                      StringRef ABIName, StringRef FloatABI);
   bool shouldUseFPXX(const llvm::opt::ArgList &Args, const llvm::Triple &Triple,
                      StringRef CPUName, StringRef ABIName, StringRef FloatABI);
-}
+} // namespace mips
 
 namespace ppc {
   bool hasPPCAbiArg(const llvm::opt::ArgList &Args, const char *Value);
@@ -371,7 +371,7 @@ namespace darwin {
                       const char *LinkingOutput) const override;
   };
 
-}
+} // namespace darwin
 
   /// openbsd -- Directly call GNU Binutils assembler and linker
 namespace openbsd {
@@ -516,7 +516,7 @@ namespace gnutools {
                       const llvm::opt::ArgList &TCArgs,
                       const char *LinkingOutput) const override;
   };
-}
+} // namespace gnutools
 
 namespace nacltools {
   class LLVM_LIBRARY_VISIBILITY AssembleARM : public gnutools::Assemble  {
@@ -542,7 +542,7 @@ namespace nacltools {
                               const llvm::opt::ArgList &TCArgs,
                               const char *LinkingOutput) const override;
   };
-}
+} // namespace nacltools
 
   /// minix -- Directly call GNU Binutils assembler and linker
 namespace minix {
@@ -731,7 +731,7 @@ public:
                     const llvm::opt::ArgList &TCArgs,
                     const char *LinkingOutput) const override;
 };
-}
+} // namespace CrossWindows
 
 /// SHAVE tools -- Directly call moviCompile and moviAsm
 namespace SHAVE {
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 0feeaa007f3e3182b6e1034a84a7a2a19b69ade5..7ad2feced234626f4c0c300f0c82548399e9171f 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -293,8 +293,8 @@ template <> struct DocumentListTraits<std::vector<FormatStyle>> {
     return Seq[Index];
   }
 };
-}
-}
+} // namespace yaml
+} // namespace llvm
 
 namespace clang {
 namespace format {
diff --git a/lib/Frontend/ASTConsumers.cpp b/lib/Frontend/ASTConsumers.cpp
index 52776b6a848377dfb4da042ddae025e874699d23..28771e2bc7b929598f56c5321084f270c510faa5 100644
--- a/lib/Frontend/ASTConsumers.cpp
+++ b/lib/Frontend/ASTConsumers.cpp
@@ -158,7 +158,7 @@ namespace {
 
     void HandleTopLevelSingleDecl(Decl *D);
   };
-}
+} // namespace
 
 void ASTViewer::HandleTopLevelSingleDecl(Decl *D) {
   if (isa<FunctionDecl>(D) || isa<ObjCMethodDecl>(D)) {
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp
index 01c56bdc4df94a5ecfde49228dc05e1cd7e5cec8..3cf202d283de763f4a2baae1788a6a9349d4d7a9 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/lib/Frontend/ASTUnit.cpp
@@ -96,7 +96,7 @@ namespace {
     /// \brief Erase temporary files and the preamble file.
     void Cleanup();
   };
-}
+} // namespace
 
 static llvm::sys::SmartMutex<false> &getOnDiskMutex() {
   static llvm::sys::SmartMutex<false> M(/* recursive = */ true);
@@ -972,7 +972,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 std::unique_ptr<ASTConsumer>
 PrecompilePreambleAction::CreateASTConsumer(CompilerInstance &CI,
@@ -2123,7 +2123,7 @@ namespace {
       return Next.getCodeCompletionTUInfo();
     }
   };
-}
+} // namespace
 
 /// \brief Helper function that computes which global names are hidden by the
 /// local code-completion results.
diff --git a/lib/Frontend/ChainedIncludesSource.cpp b/lib/Frontend/ChainedIncludesSource.cpp
index be30d43a843e1c07758992c92bebb4bd1ed91e29..1b20df64ab9480663d6507bdb95b6d15b34833a2 100644
--- a/lib/Frontend/ChainedIncludesSource.cpp
+++ b/lib/Frontend/ChainedIncludesSource.cpp
@@ -71,7 +71,7 @@ protected:
   void ReadMethodPool(Selector Sel) override;
   bool LookupUnqualified(LookupResult &R, Scope *S) override;
 };
-}
+} // namespace
 
 static ASTReader *
 createASTReader(CompilerInstance &CI, StringRef pchFile,
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 34c1a367a3b12b91f03b018b5079b69ec01de88e..7a3391685a472b0aaf0a0c6ec6c7e34609179097 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -1908,7 +1908,7 @@ namespace {
     
     llvm::APInt getAsInteger() const;
   };
-}
+} // namespace
 
 void ModuleSignature::add(uint64_t Value, unsigned int NumBits) {
   CurValue |= Value << CurBit;
diff --git a/lib/Frontend/DependencyFile.cpp b/lib/Frontend/DependencyFile.cpp
index 0995ab4bf0778e83a5e7700da43ab638b0450736..30fdf946a6a1a63fd4e961fd103abd49514cdc52 100644
--- a/lib/Frontend/DependencyFile.cpp
+++ b/lib/Frontend/DependencyFile.cpp
@@ -198,7 +198,7 @@ public:
   bool visitInputFile(StringRef Filename, bool isSystem,
                       bool isOverridden) override;
 };
-}
+} // namespace
 
 DependencyFileGenerator::DependencyFileGenerator(void *Impl)
 : Impl(Impl) { }
diff --git a/lib/Frontend/DependencyGraph.cpp b/lib/Frontend/DependencyGraph.cpp
index 67a977e38be2e8fe1d7f8923c8ba870938807ed8..f384f490e6f83a9bd4e66a3323d58974186fcb85 100644
--- a/lib/Frontend/DependencyGraph.cpp
+++ b/lib/Frontend/DependencyGraph.cpp
@@ -57,7 +57,7 @@ public:
   }
   
 };
-}
+} // namespace
 
 void clang::AttachDependencyGraphGen(Preprocessor &PP, StringRef OutputFile,
                                      StringRef SysRoot) {
diff --git a/lib/Frontend/DiagnosticRenderer.cpp b/lib/Frontend/DiagnosticRenderer.cpp
index c63e98dbe4f1a8fec22a9fa0117f96bc7851b830..52908371d3ea36911326fb59fd38edf578d4bc99 100644
--- a/lib/Frontend/DiagnosticRenderer.cpp
+++ b/lib/Frontend/DiagnosticRenderer.cpp
@@ -87,7 +87,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 static void mergeFixits(ArrayRef<FixItHint> FixItHints,
                         const SourceManager &SM, const LangOptions &LangOpts,
diff --git a/lib/Frontend/FrontendActions.cpp b/lib/Frontend/FrontendActions.cpp
index 6f202a15483a5a562f116e10ea9b061690bbe616..bcfd77e3a866c530c3b5fa57829d3bf5e0226f72 100644
--- a/lib/Frontend/FrontendActions.cpp
+++ b/lib/Frontend/FrontendActions.cpp
@@ -554,7 +554,7 @@ namespace {
     }
 #undef DUMP_BOOLEAN
   };
-}
+} // namespace
 
 void DumpModuleInfoAction::ExecuteAction() {
   // Set up the output file.
diff --git a/lib/Frontend/HeaderIncludeGen.cpp b/lib/Frontend/HeaderIncludeGen.cpp
index 5732e5b3fb73049869855e367028d6a54a0f8976..f0a2cc6300038b9d9b79cdad9136f8a4208bc18b 100644
--- a/lib/Frontend/HeaderIncludeGen.cpp
+++ b/lib/Frontend/HeaderIncludeGen.cpp
@@ -44,7 +44,7 @@ public:
                    SrcMgr::CharacteristicKind FileType,
                    FileID PrevFID) override;
 };
-}
+} // namespace
 
 void clang::AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders,
                                    StringRef OutputPath, bool ShowDepth,
diff --git a/lib/Frontend/ModuleDependencyCollector.cpp b/lib/Frontend/ModuleDependencyCollector.cpp
index 67852dc02036c9af07c67e3a84e7e9e0745f8d65..539f9b008f54aac7f95776a45d9b02b47824a223 100644
--- a/lib/Frontend/ModuleDependencyCollector.cpp
+++ b/lib/Frontend/ModuleDependencyCollector.cpp
@@ -35,7 +35,7 @@ public:
   bool visitInputFile(StringRef Filename, bool IsSystem,
                       bool IsOverridden) override;
 };
-}
+} // namespace
 
 void ModuleDependencyCollector::attachToASTReader(ASTReader &R) {
   R.addListener(llvm::make_unique<ModuleDependencyListener>(*this));
diff --git a/lib/Frontend/Rewrite/FixItRewriter.cpp b/lib/Frontend/Rewrite/FixItRewriter.cpp
index dc787ac9557c41c5a27146580532e4123e3eea0f..3b8a2077c679b0f0d5c0961353488b21b5141e69 100644
--- a/lib/Frontend/Rewrite/FixItRewriter.cpp
+++ b/lib/Frontend/Rewrite/FixItRewriter.cpp
@@ -69,7 +69,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 bool FixItRewriter::WriteFixedFiles(
             std::vector<std::pair<std::string, std::string> > *RewrittenFiles) {
diff --git a/lib/Frontend/Rewrite/HTMLPrint.cpp b/lib/Frontend/Rewrite/HTMLPrint.cpp
index 22ccfe6936b7ad6a8fa9d4657c676708b91cfe53..b2706110d9f65fead8ebe5db9deb7c55fe39c625 100644
--- a/lib/Frontend/Rewrite/HTMLPrint.cpp
+++ b/lib/Frontend/Rewrite/HTMLPrint.cpp
@@ -45,7 +45,7 @@ namespace {
     void Initialize(ASTContext &context) override;
     void HandleTranslationUnit(ASTContext &Ctx) override;
   };
-}
+} // namespace
 
 std::unique_ptr<ASTConsumer> clang::CreateHTMLPrinter(raw_ostream *OS,
                                                       Preprocessor &PP,
diff --git a/lib/Frontend/Rewrite/RewriteModernObjC.cpp b/lib/Frontend/Rewrite/RewriteModernObjC.cpp
index e13cdb3a3e55e24da3c82a3028653efbf8100bc4..cfd790c53f7266ec65b353f9e1af2e0a9828017b 100644
--- a/lib/Frontend/Rewrite/RewriteModernObjC.cpp
+++ b/lib/Frontend/Rewrite/RewriteModernObjC.cpp
@@ -609,7 +609,7 @@ namespace {
     }
   };
   
-}
+} // namespace
 
 void RewriteModernObjC::RewriteBlocksInFunctionProtoType(QualType funcType,
                                                    NamedDecl *D) {
diff --git a/lib/Frontend/Rewrite/RewriteObjC.cpp b/lib/Frontend/Rewrite/RewriteObjC.cpp
index b2a45b407baede6fbb5e54c609c4c4a600c952e8..56f06061960f936c17bb211fe3818f05d7fae8ee 100644
--- a/lib/Frontend/Rewrite/RewriteObjC.cpp
+++ b/lib/Frontend/Rewrite/RewriteObjC.cpp
@@ -540,7 +540,7 @@ namespace {
                                       std::string &Result) override;
     Stmt *RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV) override;
   };
-}
+} // namespace
 
 void RewriteObjC::RewriteBlocksInFunctionProtoType(QualType funcType,
                                                    NamedDecl *D) {
diff --git a/lib/Frontend/SerializedDiagnosticReader.cpp b/lib/Frontend/SerializedDiagnosticReader.cpp
index 0ebbd22af274780ad57088d628059229a7f7a445..75fce89a2a7e74170291b9869a2ff52c7ba9b7b3 100644
--- a/lib/Frontend/SerializedDiagnosticReader.cpp
+++ b/lib/Frontend/SerializedDiagnosticReader.cpp
@@ -287,7 +287,7 @@ class SDErrorCategoryType final : public std::error_category {
     llvm_unreachable("Unknown error type!");
   }
 };
-}
+} // namespace
 
 static llvm::ManagedStatic<SDErrorCategoryType> ErrorCategory;
 const std::error_category &clang::serialized_diags::SDErrorCategory() {
diff --git a/lib/Frontend/VerifyDiagnosticConsumer.cpp b/lib/Frontend/VerifyDiagnosticConsumer.cpp
index 55df9361b58e1418d120422c9166be569486a805..b673efcbabf9001f12c888c66fe8db876faf1783 100644
--- a/lib/Frontend/VerifyDiagnosticConsumer.cpp
+++ b/lib/Frontend/VerifyDiagnosticConsumer.cpp
@@ -301,7 +301,7 @@ private:
   const char *PEnd; // previous next/search subject end (1-past)
 };
 
-} // namespace anonymous
+} // namespace
 
 /// ParseDirective - Go through the comment and see if it indicates expected
 /// diagnostics. If so, then put them in the appropriate directive list.
diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp
index 6c98d01c170bd84adefda30c8290da48c7c2dd90..075a17f68b1659b0bcbbecc7dd453472836adb5e 100644
--- a/lib/Lex/ModuleMap.cpp
+++ b/lib/Lex/ModuleMap.cpp
@@ -1066,7 +1066,7 @@ namespace clang {
     
     bool parseModuleMapFile();
   };
-}
+} // namespace clang
 
 SourceLocation ModuleMapParser::consumeToken() {
 retry:
@@ -1260,7 +1260,7 @@ namespace {
     /// \brief The 'exhaustive' attribute.
     AT_exhaustive
   };
-}
+} // namespace
 
 /// \brief Parse a module declaration.
 ///
diff --git a/lib/Lex/PPExpressions.cpp b/lib/Lex/PPExpressions.cpp
index 44513023395d4136838aaebae191bb74a9215f4d..df7eec248df94006eb439a5348fde89ed107ab6c 100644
--- a/lib/Lex/PPExpressions.cpp
+++ b/lib/Lex/PPExpressions.cpp
@@ -52,7 +52,7 @@ public:
   void setEnd(SourceLocation L) { Range.setEnd(L); }
 };
 
-}
+} // namespace
 
 static bool EvaluateDirectiveSubExpr(PPValue &LHS, unsigned MinPrec,
                                      Token &PeekTok, bool ValueLive,
diff --git a/lib/Lex/PTHLexer.cpp b/lib/Lex/PTHLexer.cpp
index 5f63d35c5be74b528824b8005514548a051452df..c2750f6a802f780db7968aadaae0e0dfce05b1fb 100644
--- a/lib/Lex/PTHLexer.cpp
+++ b/lib/Lex/PTHLexer.cpp
@@ -721,7 +721,7 @@ public:
     return CacheExists;
   }
 };
-}
+} // namespace clang
 
 std::unique_ptr<FileSystemStatCache> PTHManager::createStatCache() {
   return llvm::make_unique<PTHStatCache>(*FileLookup);
diff --git a/lib/Lex/Pragma.cpp b/lib/Lex/Pragma.cpp
index 5eb665549e86ffa1ce7836f48251ce6b1a2ccd7c..9e3d7b0bbed04a03be11910502b417b2e54b7e77 100644
--- a/lib/Lex/Pragma.cpp
+++ b/lib/Lex/Pragma.cpp
@@ -157,7 +157,7 @@ public:
     Failed = true;
   }
 };
-}
+} // namespace
 
 /// Handle_Pragma - Read a _Pragma directive, slice it up, process it, then
 /// return the first token after the directive.  The _Pragma token has just
diff --git a/lib/Lex/PreprocessingRecord.cpp b/lib/Lex/PreprocessingRecord.cpp
index a423041a2d95641106087bb11edfa5fa19efa129..824546a2c887c4005ed3d74e6b543bff3f263bd1 100644
--- a/lib/Lex/PreprocessingRecord.cpp
+++ b/lib/Lex/PreprocessingRecord.cpp
@@ -195,7 +195,7 @@ struct PPEntityComp {
   }
 };
 
-}
+} // namespace
 
 unsigned PreprocessingRecord::findBeginLocalPreprocessedEntity(
                                                      SourceLocation Loc) const {
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index da759c76522cc9a8360e2e4b8585390fe9af710f..6ccd7a9dadca8c7ba719a0293c6194badea6b5a8 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -485,7 +485,7 @@ class CastExpressionIdValidator : public CorrectionCandidateCallback {
   Token NextToken;
   bool AllowNonTypes;
 };
-}
+} // namespace
 
 /// \brief Parse a cast-expression, or, if \pisUnaryExpression is true, parse
 /// a unary-expression.
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index b658cef234ec60c11ec477894a04ae7e8057f13c..d35d658171bfbf2e6f2aff581558a3f91461fc72 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -142,7 +142,7 @@ public:
 private:
   Token NextToken;
 };
-}
+} // namespace
 
 StmtResult
 Parser::ParseStatementOrDeclarationAfterAttributes(StmtVector &Stmts,
diff --git a/lib/Parse/ParseStmtAsm.cpp b/lib/Parse/ParseStmtAsm.cpp
index 8cdae6a74b206dede8e19f63ba6d26fb4c3e7620..b89e446486d4bce5b2da8599f3b80963c25621df 100644
--- a/lib/Parse/ParseStmtAsm.cpp
+++ b/lib/Parse/ParseStmtAsm.cpp
@@ -174,7 +174,7 @@ private:
     TheParser.Diag(Loc, diag::err_inline_ms_asm_parsing) << D.getMessage();
   }
 };
-}
+} // namespace
 
 /// Parse an identifier in an MS-style inline assembly block.
 ///
diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp
index d63cf24bcdb997940949ce98d9879a85b1563d7f..76afcda96a24e099ddaf626077eb4e78e6825659 100644
--- a/lib/Parse/ParseTentative.cpp
+++ b/lib/Parse/ParseTentative.cpp
@@ -1023,7 +1023,7 @@ public:
     return CorrectionCandidateCallback::ValidateCandidate(Candidate);
   }
 };
-}
+} // namespace
 /// isCXXDeclarationSpecifier - Returns TPResult::True if it is a declaration
 /// specifier, TPResult::False if it is not, TPResult::Ambiguous if it could
 /// be either a decl-specifier or a function-style cast, and TPResult::Error
diff --git a/lib/Rewrite/DeltaTree.cpp b/lib/Rewrite/DeltaTree.cpp
index 352fab077a2e8cf94dd2da214d5c31b8c0a5e837..4ff3d7d8bf3edc8d4b330c3bba6cacc3dc95b4e6 100644
--- a/lib/Rewrite/DeltaTree.cpp
+++ b/lib/Rewrite/DeltaTree.cpp
@@ -149,7 +149,7 @@ namespace {
 
     static inline bool classof(const DeltaTreeNode *N) { return !N->isLeaf(); }
   };
-}
+} // namespace
 
 
 /// Destroy - A 'virtual' destructor.
diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp
index 36030b99a30bf0b51ccba10e1dafb07ad9d17f9d..8c5589b43aefb17676ed725e9cd3fbb4fc85effb 100644
--- a/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/lib/Sema/AnalysisBasedWarnings.cpp
@@ -99,7 +99,7 @@ namespace {
       }
     }
   };
-}
+} // namespace
 
 /// CheckUnreachable - Check for unreachable code.
 static void CheckUnreachable(Sema &S, AnalysisDeclContext &AC) {
@@ -493,7 +493,7 @@ struct CheckFallThroughDiagnostics {
   }
 };
 
-}
+} // namespace
 
 /// 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
@@ -601,7 +601,7 @@ public:
 
   bool doesContainReference() const { return FoundReference; }
 };
-}
+} // namespace
 
 static bool SuggestInitializationFixit(Sema &S, const VarDecl *VD) {
   QualType VariableTy = VD->getType().getCanonicalType();
@@ -1059,7 +1059,7 @@ namespace {
     Sema &S;
     llvm::SmallPtrSet<const CFGBlock *, 16> ReachableBlocks;
   };
-}
+} // namespace
 
 static void DiagnoseSwitchLabelsFallthrough(Sema &S, AnalysisDeclContext &AC,
                                             bool PerFunction) {
@@ -1414,7 +1414,7 @@ private:
     });
   }
 };
-}
+} // namespace
 
 namespace clang {
 namespace {
@@ -1432,7 +1432,8 @@ struct SortDiagBySourceLocation {
     return SM.isBeforeInTranslationUnit(left.first.first, right.first.first);
   }
 };
-}}
+} // namespace
+} // namespace clang
 
 //===----------------------------------------------------------------------===//
 // -Wthread-safety
@@ -1793,7 +1794,9 @@ public:
     Warnings.emplace_back(std::move(Warning), OptionalNotes());
   }
 };
-}}}
+} // namespace
+} // namespace consumed
+} // namespace clang
 
 //===----------------------------------------------------------------------===//
 // AnalysisBasedWarnings - Worker object used by Sema to execute analysis-based
diff --git a/lib/Sema/SemaAccess.cpp b/lib/Sema/SemaAccess.cpp
index 0e973cc5ebaae6fd9975b8bed5b8c0422678ccf8..1d7d27c0f0ee71e8b1e71277bb463e4e3860a8c1 100644
--- a/lib/Sema/SemaAccess.cpp
+++ b/lib/Sema/SemaAccess.cpp
@@ -248,7 +248,7 @@ private:
   const CXXRecordDecl *DeclaringClass;
 };
 
-}
+} // namespace
 
 /// Checks whether one class might instantiate to the other.
 static bool MightInstantiateTo(const CXXRecordDecl *From,
@@ -679,7 +679,7 @@ struct ProtectedFriendContext {
     return findFriendship(Cur, 0);
   }
 };
-}
+} // namespace
 
 /// Search for a class P that EC is a friend of, under the constraint
 ///   InstanceContext <= P
diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp
index 9e146ed3a6427b006767102408ce8951b0fec7cb..aeea26b4e3e68f8aabb531e39efa9569579474c0 100644
--- a/lib/Sema/SemaCXXScopeSpec.cpp
+++ b/lib/Sema/SemaCXXScopeSpec.cpp
@@ -419,7 +419,7 @@ class NestedNameSpecifierValidatorCCC : public CorrectionCandidateCallback {
   Sema &SRef;
 };
 
-}
+} // namespace
 
 /// \brief Build a new nested-name-specifier for "identifier::", as described
 /// by ActOnCXXNestedNameSpecifier.
diff --git a/lib/Sema/SemaCast.cpp b/lib/Sema/SemaCast.cpp
index d9dc4df9f271a73570f78cde9d17699ceb4a027f..db3f19607fda75195e1923161490a22efda0c820 100644
--- a/lib/Sema/SemaCast.cpp
+++ b/lib/Sema/SemaCast.cpp
@@ -140,7 +140,7 @@ namespace {
       PlaceholderKind = (BuiltinType::Kind) 0;
     }
   };
-}
+} // namespace
 
 // The Try functions attempt a specific way of casting. If they succeed, they
 // return TC_Success. If their way of casting is not appropriate for the given
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index f76727cad881981808d6fdd47158b986c947dd03..af49994b26129208211817b8492a872d9eff0db7 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -3198,7 +3198,7 @@ protected:
                             bool IsStringLocation, Range StringRange,
                             ArrayRef<FixItHint> Fixit = None);
 };
-}
+} // namespace
 
 SourceRange CheckFormatHandler::getFormatStringRange() {
   return OrigFormatExpr->getSourceRange();
@@ -3552,7 +3552,7 @@ public:
                            const Expr *E);
 
 };  
-}
+} // namespace
 
 bool CheckPrintfHandler::HandleInvalidPrintfConversionSpecifier(
                                       const analyze_printf::PrintfSpecifier &FS,
@@ -4275,7 +4275,7 @@ public:
 
   void HandleIncompleteScanList(const char *start, const char *end) override;
 };
-}
+} // namespace
 
 void CheckScanfHandler::HandleIncompleteScanList(const char *start,
                                                  const char *end) {
@@ -7944,7 +7944,7 @@ public:
       Tree.merge(Elts[I]);
   }
 };
-}
+} // namespace
 
 void Sema::CheckUnsequencedOperations(Expr *E) {
   SmallVector<Expr *, 8> WorkList;
@@ -8338,7 +8338,7 @@ namespace {
       Range = e->getSourceRange();
     }
   };
-}
+} // namespace
 
 /// Consider whether capturing the given variable can possibly lead to
 /// a retain cycle.
@@ -8484,7 +8484,7 @@ namespace {
       }
     }
   };
-}
+} // namespace
 
 /// Check whether the given argument is a block which captures a
 /// variable.
@@ -9322,7 +9322,7 @@ bool isLayoutCompatible(ASTContext &C, QualType T1, QualType T2) {
 
   return false;
 }
-}
+} // namespace
 
 //===--- CHECK: pointer_with_type_tag attribute: datatypes should match ----//
 
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index ebb6bbcd3454be0e19a386b536be0e00a939bb33..284f7cf8d554df27fcf8896d371bd44b4a88e028 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -342,7 +342,7 @@ namespace {
     bool IsImpossibleToSatisfy(const NamedDecl *ND) const;
     //@}    
   };  
-}
+} // namespace
 
 class ResultBuilder::ShadowMapEntry::iterator {
   llvm::PointerUnion<const NamedDecl *, const DeclIndexPair *> DeclOrIterator;
@@ -1264,7 +1264,7 @@ namespace {
       Results.AddResult(Result, CurContext, Hiding, InBaseClass);
     }
   };
-}
+} // namespace
 
 /// \brief Add type specifiers for the current language as keyword results.
 static void AddTypeSpecifierResults(const LangOptions &LangOpts,
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index f750638ea1e1ced635f20cce12a288cbb79e4947..2e62ea66a5f8c61cbc3dd340c5b21f930bc829b1 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -89,7 +89,7 @@ class TypeNameValidatorCCC : public CorrectionCandidateCallback {
   bool AllowClassTemplates;
 };
 
-}
+} // namespace
 
 /// \brief Determine whether the token kind starts a simple-type-specifier.
 bool Sema::isSimpleTypeSpecifier(tok::TokenKind Kind) const {
@@ -2501,7 +2501,7 @@ struct GNUCompatibleParamWarning {
   QualType PromotedType;
 };
 
-}
+} // namespace
 
 /// getSpecialMember - get the special member enum for a method.
 Sema::CXXSpecialMember Sema::getSpecialMember(const CXXMethodDecl *MD) {
@@ -6606,7 +6606,7 @@ class DifferentNameValidatorCCC : public CorrectionCandidateCallback {
   CXXRecordDecl *ExpectedParent;
 };
 
-}
+} // namespace
 
 /// \brief Generate diagnostics for an invalid function redeclaration.
 ///
@@ -8758,7 +8758,7 @@ namespace {
 
     SelfReferenceChecker(S, OrigDecl).CheckExpr(E);
   }
-}
+} // namespace
 
 /// AddInitializerToDecl - Adds the initializer Init to the
 /// declaration dcl. If DirectInit is true, this is C++ direct
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 7ed9bfcb9796f5b97de9402852c375ab644c7d54..471a03e123a4388343e9e92dbd235f3a3488e061 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -145,7 +145,7 @@ namespace {
     return S->Diag(Lambda->getLocStart(), 
                    diag::err_lambda_capture_default_arg);
   }
-}
+} // namespace
 
 void
 Sema::ImplicitExceptionSpecification::CalledDecl(SourceLocation CallLoc,
@@ -2834,7 +2834,7 @@ private:
   CXXRecordDecl *ClassDecl;
 };
 
-}
+} // namespace
 
 /// \brief Handle a C++ member initializer.
 MemInitResult
@@ -3756,7 +3756,7 @@ struct BaseAndFieldInfo {
     return false;
   }
 };
-}
+} // namespace
 
 /// \brief Determine whether the given type is an incomplete or zero-lenfgth
 /// array type.
@@ -4215,7 +4215,7 @@ bool CheckRedundantUnionInit(Sema &S,
 
   return false;
 }
-}
+} // namespace
 
 /// ActOnMemInitializers - Handle the member initializers for a constructor.
 void Sema::ActOnMemInitializers(Decl *ConstructorDecl,
@@ -4637,7 +4637,7 @@ void AbstractUsageInfo::CheckType(const NamedDecl *D, TypeLoc TL,
   CheckAbstractUsage(*this, D).Visit(TL, Sel);
 }
 
-}
+} // namespace
 
 /// Check for invalid uses of an abstract type in a method declaration.
 static void CheckAbstractClassUsage(AbstractUsageInfo &Info,
@@ -5508,7 +5508,7 @@ struct SpecialMemberDeletionInfo {
 
   bool isAccessible(Subobject Subobj, CXXMethodDecl *D);
 };
-}
+} // namespace
 
 /// Is the given special member inaccessible when used on the given
 /// sub-object.
@@ -7517,7 +7517,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 static bool TryNamespaceTypoCorrection(Sema &S, LookupResult &R, Scope *Sc,
                                        CXXScopeSpec &SS,
@@ -8883,7 +8883,7 @@ struct DeclaringSpecialMember {
     return WasAlreadyBeingDeclared;
   }
 };
-}
+} // namespace
 
 CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor(
                                                      CXXRecordDecl *ClassDecl) {
@@ -9267,7 +9267,7 @@ private:
   typedef llvm::DenseMap<const Type *, InheritingConstructorsForType> MapType;
   MapType Map;
 };
-}
+} // namespace
 
 void Sema::DeclareInheritingConstructors(CXXRecordDecl *ClassDecl) {
   // Defer declaring the inheriting constructors until the class is
@@ -13484,7 +13484,7 @@ namespace {
       return false;
     }
   };
-}
+} // namespace
 
 bool Sema::checkThisInStaticMemberFunctionType(CXXMethodDecl *Method) {
   TypeSourceInfo *TSInfo = Method->getTypeSourceInfo();
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 543566fdb7cc71846844a32710a9000db16482cd..6ca4734dfe97f6ab8186e84a065f77975d4e46d7 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -446,7 +446,7 @@ class ObjCInterfaceValidatorCCC : public CorrectionCandidateCallback {
   ObjCInterfaceDecl *CurrentIDecl;
 };
 
-}
+} // namespace
 
 static void diagnoseUseOfProtocols(Sema &TheSema,
                                    ObjCContainerDecl *CD,
@@ -3059,7 +3059,7 @@ private:
     searchFromContainer(container);
   }
 };
-}
+} // namespace
 
 void Sema::CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod,
                                     ObjCInterfaceDecl *CurrentClass,
@@ -3717,7 +3717,7 @@ namespace {
       return true;
     }
   };
-}
+} // namespace
 
 void Sema::DiagnoseUnusedBackingIvarInAccessor(Scope *S,
                                           const ObjCImplementationDecl *ImplD) {
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index ffa47eeb5871d696e2d76ab9731fb612227a7de7..f26b5368a349f8064b3512d45ed33a2d13c121ec 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1138,7 +1138,7 @@ ExprResult doComplexIntegralCast(Sema &S, Expr *op, QualType toType) {
   return S.ImpCastExprToType(op, S.Context.getComplexType(toType),
                              CK_IntegralComplexCast);
 }
-}
+} // namespace
 
 /// \brief Handle integer arithmetic conversions.  Helper function of
 /// UsualArithmeticConversions()
@@ -4257,7 +4257,7 @@ public:
 private:
   const IdentifierInfo *const FunctionName;
 };
-}
+} // namespace
 
 static TypoCorrection TryTypoCorrectionForCall(Sema &S, Expr *Fn,
                                                FunctionDecl *FDecl,
@@ -11974,7 +11974,7 @@ namespace {
       return E;
     }
   };
-}
+} // namespace
 
 ExprResult Sema::TransformToPotentiallyEvaluated(Expr *E) {
   assert(isUnevaluatedContext() &&
@@ -13310,7 +13310,7 @@ namespace {
     bool TraverseTemplateArgument(const TemplateArgument &Arg);
     bool TraverseRecordType(RecordType *T);
   };
-}
+} // namespace
 
 bool MarkReferencedDecls::TraverseTemplateArgument(
     const TemplateArgument &Arg) {
@@ -13409,7 +13409,7 @@ namespace {
         S.UpdateMarkingForLValueToRValue(E->getSubExpr());
     }
   };
-}
+} // namespace
 
 /// \brief Mark any declarations that appear within this expression or any
 /// potentially-evaluated subexpressions as "referenced".
@@ -13705,7 +13705,7 @@ namespace {
       return resolveDecl(E, E->getDecl());
     }
   };
-}
+} // namespace
 
 /// Given a function expression of unknown-any type, try to rebuild it
 /// to have a function type.
@@ -13796,7 +13796,7 @@ namespace {
       return resolveDecl(E, E->getDecl());
     }
   };
-}
+} // namespace
 
 /// Rebuilds a call expression which yielded __unknown_anytype.
 ExprResult RebuildUnknownAnyExpr::VisitCallExpr(CallExpr *E) {
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 6c839f356fdc26cf4d815adab035766893923ba3..43c097e39edff117170db3a4c19f8270c2b44f16 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -2424,7 +2424,7 @@ private:
   /// in-class initializer.
   MismatchResult analyzeInClassInitializer();
 };
-}
+} // namespace
 
 MismatchingNewDeleteDetector::MismatchResult
 MismatchingNewDeleteDetector::analyzeDeleteExpr(const CXXDeleteExpr *DE) {
@@ -6571,7 +6571,7 @@ public:
     return CacheEntry = ExprError();
   }
 };
-}
+} // namespace
 
 ExprResult
 Sema::CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl,
diff --git a/lib/Sema/SemaExprMember.cpp b/lib/Sema/SemaExprMember.cpp
index e421349338b17f7e46556d0e7a67b481f5ad9d39..d01640a36924be057e4a53e9f61a485d271f107f 100644
--- a/lib/Sema/SemaExprMember.cpp
+++ b/lib/Sema/SemaExprMember.cpp
@@ -579,7 +579,7 @@ private:
   const RecordDecl *const Record;
 };
 
-}
+} // namespace
 
 static bool LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R,
                                      Expr *BaseExpr,
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index 9947fad70dd3cbc1bd71b33c10ebc9c7034a0845..f6a5a067ddb14f3979834859dd02f6075fb825c2 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -1895,7 +1895,7 @@ class ObjCInterfaceOrSuperCCC : public CorrectionCandidateCallback {
   }
 };
 
-}
+} // namespace
 
 Sema::ObjCMessageKind Sema::getObjCMessageKind(Scope *S,
                                                IdentifierInfo *Name,
@@ -3184,7 +3184,7 @@ namespace {
       }
     }
   };
-}
+} // namespace
 
 bool Sema::isKnownName(StringRef name) {
   if (name.empty())
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 821d7f64b25347f13a957caa571de4def94aaf36..5c149e116a3466339cf61522f4cb45d00f9a5a95 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -1915,7 +1915,7 @@ class FieldInitializerValidatorCCC : public CorrectionCandidateCallback {
   RecordDecl *Record;
 };
 
-}
+} // namespace
 
 /// @brief Check the well-formedness of a C99 designated initializer.
 ///
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp
index 3fd1f21ba3fdfb447ca5ebad8090f77bb92fc789..b13b99237ded3572c2c94585d304677f4e8410e8 100644
--- a/lib/Sema/SemaLookup.cpp
+++ b/lib/Sema/SemaLookup.cpp
@@ -204,7 +204,7 @@ namespace {
                                                UnqualUsingEntry::Comparator()));
     }
   };
-}
+} // namespace
 
 // Retrieve the set of identifier namespaces that correspond to a
 // specific kind of name lookup.
@@ -875,7 +875,7 @@ struct FindLocalExternScope {
   LookupResult &R;
   bool OldFindLocalExtern;
 };
-}
+} // namespace
 
 bool Sema::CppLookupName(LookupResult &R, Scope *S) {
   assert(getLangOpts().CPlusPlus && "Can perform only C++ lookup");
@@ -2121,7 +2121,7 @@ namespace {
     Sema::AssociatedClassSet &Classes;
     SourceLocation InstantiationLoc;
   };
-}
+} // namespace
 
 static void
 addAssociatedClassesAndNamespaces(AssociatedLookup &Result, QualType T);
diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp
index e609fcf1d9bec1b51b34ceb04cb17aff36590d55..b6559b2e217caed6f2ee617d6ff69ae0923dfc84 100644
--- a/lib/Sema/SemaOpenMP.cpp
+++ b/lib/Sema/SemaOpenMP.cpp
@@ -4924,7 +4924,7 @@ public:
       Diags.popMappings(SavedLoc);
   }
 };
-}
+} // namespace
 
 OMPClause *Sema::ActOnOpenMPFirstprivateClause(ArrayRef<Expr *> VarList,
                                                SourceLocation StartLoc,
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index a0fdcd78e596bd39214a9ae08c6512b1785b52a6..072dc55c0a63c6c96a0551afe8005d09e9fd4195 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -536,7 +536,7 @@ namespace {
   struct DFIParamWithArguments : DFIArguments {
     TemplateParameter Param;
   };
-}
+} // namespace
 
 /// \brief Convert from Sema's representation of template deduction information
 /// to the form used in overload-candidate information.
@@ -794,7 +794,7 @@ namespace {
         *i->Addr = i->Saved;
     }
   };
-}
+} // namespace
 
 /// checkPlaceholderForOverload - Do any interesting placeholder-like
 /// preprocessing on the given expression.
@@ -9555,7 +9555,7 @@ struct CompareOverloadCandidatesForDisplay {
     return S.SourceMgr.isBeforeInTranslationUnit(LLoc, RLoc);
   }
 };
-}
+} // namespace
 
 /// CompleteNonViableCandidate - Normally, overload resolution only
 /// computes up to the first. Produces the FixIt set if possible.
@@ -9747,7 +9747,7 @@ struct CompareTemplateSpecCandidatesForDisplay {
     return S.SourceMgr.isBeforeInTranslationUnit(LLoc, RLoc);
   }
 };
-}
+} // namespace
 
 /// Diagnose a template argument deduction failure.
 /// We are treating these failures as overload failures due to bad
@@ -10165,7 +10165,7 @@ public:
     return &Matches[0].first;
   }
 };
-}
+} // namespace
 
 /// ResolveAddressOfOverloadedFunction - Try to resolve the address of
 /// an overloaded function (C++ [over.over]), where @p From is an
@@ -10632,7 +10632,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 static std::unique_ptr<CorrectionCandidateCallback>
 MakeValidator(Sema &SemaRef, MemberExpr *ME, size_t NumArgs,
diff --git a/lib/Sema/SemaPseudoObject.cpp b/lib/Sema/SemaPseudoObject.cpp
index 3e465af9632c875746bdbb0de33fd1b5d8ee7019..a3899883d17bacdd61fc7f441ed78845d45cfe18 100644
--- a/lib/Sema/SemaPseudoObject.cpp
+++ b/lib/Sema/SemaPseudoObject.cpp
@@ -338,7 +338,7 @@ namespace {
    ExprResult buildGet() override;
    ExprResult buildSet(Expr *op, SourceLocation, bool) override;
  };
-}
+} // namespace
 
 /// Capture the given expression in an OpaqueValueExpr.
 OpaqueValueExpr *PseudoOpBuilder::capture(Expr *e) {
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 50e4345216a6ceb2a1fa8f83c771232460094ef9..a7e56e7d06b4577f08dab2bc22e7042e4c6502e5 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -530,7 +530,7 @@ namespace {
       return LHS < RHS.first;
     }
   };
-}
+} // namespace
 
 /// CmpCaseVals - Comparison predicate for sorting case values.
 ///
@@ -1904,7 +1904,7 @@ VarDecl *BuildForRangeVarDecl(Sema &SemaRef, SourceLocation Loc,
   return Decl;
 }
 
-}
+} // namespace
 
 static bool ObjCEnumerationCollection(Expr *Collection) {
   return !Collection->isTypeDependent()
@@ -2116,7 +2116,7 @@ struct InvalidateOnErrorScope {
   Decl *D;
   bool Enabled;
 };
-}
+} // namespace
 
 /// BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
 StmtResult
@@ -2952,7 +2952,7 @@ bool LocalTypedefNameReferencer::VisitRecordType(const RecordType *RT) {
         S.MarkAnyDeclReferenced(T->getLocation(), T, /*OdrUse=*/false);
   return true;
 }
-}
+} // namespace
 
 TypeLoc Sema::getReturnTypeLoc(FunctionDecl *FD) const {
   TypeLoc TL = FD->getTypeSourceInfo()->getTypeLoc().IgnoreParens();
@@ -3489,7 +3489,7 @@ template <> struct DenseMapInfo<CatchHandlerType> {
 template <> struct isPodLike<CatchHandlerType> {
   static const bool value = true;
 };
-}
+} // namespace llvm
 
 namespace {
 class CatchTypePublicBases {
@@ -3526,7 +3526,7 @@ public:
     return false;
   }
 };
-}
+} // namespace
 
 /// ActOnCXXTryBlock - Takes a try compound-statement and a number of
 /// handlers and creates a try statement from them.
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index f4740a5cd8558d734af5c7696822fc40253c5c9b..5c3a015889140b0289961d0e259ecd7a61600800 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -1549,7 +1549,7 @@ struct DependencyChecker : RecursiveASTVisitor<DependencyChecker> {
     return TraverseType(T->getInjectedSpecializationType());
   }
 };
-}
+} // namespace
 
 /// Determines whether a given type depends on the given parameter
 /// list.
@@ -3953,7 +3953,7 @@ namespace {
     bool VisitTagDecl(const TagDecl *Tag);
     bool VisitNestedNameSpecifier(NestedNameSpecifier *NNS);
   };
-}
+} // namespace
 
 bool UnnamedLocalNoLinkageFinder::VisitBuiltinType(const BuiltinType*) {
   return false;
@@ -8220,7 +8220,7 @@ namespace {
       return E;
     }
   };
-}
+} // namespace
 
 /// \brief Rebuilds a type within the context of the current instantiation.
 ///
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp
index 6f676ad7c55de987a8d97385d601d4d8443a0f0a..c5b73f53c5517df36cc8671de3d716b4fdaea8ea 100644
--- a/lib/Sema/SemaTemplateDeduction.cpp
+++ b/lib/Sema/SemaTemplateDeduction.cpp
@@ -58,7 +58,7 @@ namespace clang {
     /// terms of noreturn and default calling convention adjustments.
     TDF_InOverloadResolution = 0x20
   };
-}
+} // namespace clang
 
 using namespace clang;
 
@@ -3913,7 +3913,7 @@ namespace {
       return TransformType(TLB, TL);
     }
   };
-}
+} // namespace
 
 Sema::DeduceAutoResult
 Sema::DeduceAutoType(TypeSourceInfo *Type, Expr *&Init, QualType &Result) {
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index 82ff7c0ca4f50774e0151d3a71f8a19c2064eed4..b9890d0fd3f4892ecb5d8ae4fce55de52c263a9e 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -844,7 +844,7 @@ namespace {
                                                SourceLocation loc,
                                                TemplateArgument arg);
   };
-}
+} // namespace
 
 bool TemplateInstantiator::AlreadyTransformed(QualType T) {
   if (T.isNull())
diff --git a/lib/Sema/SemaTemplateVariadic.cpp b/lib/Sema/SemaTemplateVariadic.cpp
index fd3ba3549b4cc65a9af97f972a37dfb2bc42c0ae..6a31125c1f8f62766ffc14ae81596286b30050fb 100644
--- a/lib/Sema/SemaTemplateVariadic.cpp
+++ b/lib/Sema/SemaTemplateVariadic.cpp
@@ -195,7 +195,7 @@ namespace {
       return true;
     }
   };
-}
+} // namespace
 
 /// \brief Determine whether it's possible for an unexpanded parameter pack to
 /// be valid in this location. This only happens when we're in a declaration
@@ -806,7 +806,7 @@ class ParameterPackValidatorCCC : public CorrectionCandidateCallback {
   }
 };
 
-}
+} // namespace
 
 /// \brief Called when an expression computing the size of a parameter pack
 /// is parsed.
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index d72f2595abe7a9ee037023893f41701c28cb2666..88633d21ac41b209ae2fb92c8a2b3c70628cc037 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -242,7 +242,7 @@ namespace {
       savedAttrs.back()->setNext(nullptr);
     }
   };
-}
+} // namespace
 
 static void spliceAttrIntoList(AttributeList &attr, AttributeList *&head) {
   attr.setNext(head);
@@ -1409,7 +1409,7 @@ namespace {
 ///
 /// The values of this enum are used in diagnostics.
 enum QualifiedFunctionKind { QFK_BlockPointer, QFK_Pointer, QFK_Reference };
-}
+} // namespace
 
 /// Check whether the type T is a qualified function type, and if it is,
 /// diagnose that it cannot be contained within the given kind of declarator.
@@ -4399,7 +4399,7 @@ namespace {
       llvm_unreachable("unsupported TypeLoc kind in declarator!");
     }
   };
-}
+} // namespace
 
 static void fillAtomicQualLoc(AtomicTypeLoc ATL, const DeclaratorChunk &Chunk) {
   SourceLocation Loc;
@@ -4990,7 +4990,7 @@ namespace {
       llvm_unreachable("unknown wrapping kind");
     }
   };
-}
+} // namespace
 
 static bool handleMSPointerTypeQualifierAttr(TypeProcessingState &State,
                                              AttributeList &Attr,
@@ -5897,7 +5897,7 @@ namespace {
       S.Diag(Loc, DiagID) << T;
     }
   };
-}
+} // namespace
 
 bool Sema::RequireCompleteExprType(Expr *E, unsigned DiagID) {
   TypeDiagnoserDiag Diagnoser(DiagID);
diff --git a/lib/Sema/TypeLocBuilder.h b/lib/Sema/TypeLocBuilder.h
index 82844b391467182a7ac50881fd2f3b3aef9b32b2..ed948676b671bdeb5047e4aa1766620aa0ee7495 100644
--- a/lib/Sema/TypeLocBuilder.h
+++ b/lib/Sema/TypeLocBuilder.h
@@ -146,6 +146,6 @@ private:
   }
 };
 
-}
+} // namespace clang
 
 #endif
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index 7242793be22025966ed35ec24860ce03fa0b24e0..5ecedc7df0deb8de70e34a4de0331d0130a35dec 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -1686,7 +1686,7 @@ namespace {
     // files.
     IdentifierInfo *getIdentifierInfo() const { return Found; }
   };
-}
+} // namespace
 
 void ASTReader::updateOutOfDateIdentifier(IdentifierInfo &II) {
   // Note that we are loading an identifier.
@@ -3954,7 +3954,7 @@ namespace {
                                       SuggestedPredefines, ExistingLangOpts);
     }
   };
-}
+} // namespace
 
 bool ASTReader::readASTFileControlBlock(
     StringRef Filename, FileManager &FileMgr,
@@ -4739,7 +4739,7 @@ struct PPEntityComp {
   }
 };
 
-}
+} // namespace
 
 PreprocessedEntityID ASTReader::findPreprocessedEntity(SourceLocation Loc,
                                                        bool EndsAfter) const {
@@ -4859,7 +4859,7 @@ namespace {
     
     Optional<HeaderFileInfo> getHeaderFileInfo() const { return HFI; }
   };
-}
+} // namespace
 
 HeaderFileInfo ASTReader::GetHeaderFileInfo(const FileEntry *FE) {
   HeaderFileInfoVisitor Visitor(FE);
@@ -6192,7 +6192,7 @@ namespace {
       return false;
     }
   };
-}
+} // namespace
 
 ExternalLoadResult ASTReader::FindExternalLexicalDecls(const DeclContext *DC,
                                          bool (*isKindWeWant)(Decl::Kind),
@@ -6237,7 +6237,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 void ASTReader::FindFileRegionDecls(FileID File,
                                     unsigned Offset, unsigned Length,
@@ -6355,7 +6355,7 @@ namespace {
       return FoundAnything;
     }
   };
-}
+} // namespace
 
 /// \brief Retrieve the "definitive" module file for the definition of the
 /// given declaration context, if there is one.
@@ -6504,7 +6504,7 @@ namespace {
       return FoundAnything && !This->VisitAll;
     }
   };
-}
+} // namespace
 
 void ASTReader::completeVisibleDeclsMap(const DeclContext *DC) {
   if (!DC->hasExternalVisibleStorage())
@@ -6848,7 +6848,7 @@ namespace clang {
 
     StringRef Next() override;
   };
-}
+} // namespace clang
 
 ASTIdentifierIterator::ASTIdentifierIterator(const ASTReader &Reader)
   : Reader(Reader), Index(Reader.ModuleMgr.size() - 1) {
@@ -6960,7 +6960,8 @@ namespace clang { namespace serialization {
     }
     bool factoryHasMoreThanOneDecl() const { return FactoryHasMoreThanOneDecl; }
   };
-} } // end namespace clang::serialization
+} // namespace serialization
+ } // namespace clang
 
 /// \brief Add the given set of methods to the method list.
 static void addMethodsToPool(Sema &S, ArrayRef<ObjCMethodDecl *> Methods,
diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp
index 00ebd3ebe8e441fc4d9e9305bf257d5a3b797cee..136ef1a4253079ed71558702e350e368d7292f92 100644
--- a/lib/Serialization/ASTReaderDecl.cpp
+++ b/lib/Serialization/ASTReaderDecl.cpp
@@ -387,7 +387,7 @@ namespace clang {
       }
     }
   };
-}
+} // namespace clang
 
 namespace {
 /// Iterator over the redeclarations of a declaration that have already
@@ -423,7 +423,7 @@ public:
     return A.Current != B.Current;
   }
 };
-}
+} // namespace
 template<typename DeclT>
 llvm::iterator_range<MergedRedeclIterator<DeclT>> merged_redecls(DeclT *D) {
   return llvm::iterator_range<MergedRedeclIterator<DeclT>>(
@@ -2934,7 +2934,7 @@ void ASTDeclReader::attachPreviousDeclImpl(ASTReader &Reader,
           std::make_pair(Canon, IsUnresolved ? PrevFD : FD));
   }
 }
-}
+} // namespace clang
 void ASTDeclReader::attachPreviousDeclImpl(ASTReader &Reader, ...) {
   llvm_unreachable("attachPreviousDecl on non-redeclarable declaration");
 }
@@ -3490,7 +3490,7 @@ namespace {
       return Chain;
     }
   };
-}
+} // namespace
 
 void ASTReader::loadPendingDeclChain(Decl *CanonDecl) {
   // The decl might have been merged into something else after being added to
@@ -3647,7 +3647,7 @@ namespace {
       return true;
     }
   };
-}
+} // namespace
 
 void ASTReader::loadObjCCategories(serialization::GlobalDeclID ID,
                                    ObjCInterfaceDecl *D,
diff --git a/lib/Serialization/ASTReaderInternals.h b/lib/Serialization/ASTReaderInternals.h
index d1b032b27ac22208dabfddc9987631ac2fa763bd..9a1532780a0498809085a4798a8d52279d6b7582 100644
--- a/lib/Serialization/ASTReaderInternals.h
+++ b/lib/Serialization/ASTReaderInternals.h
@@ -241,8 +241,8 @@ public:
 typedef llvm::OnDiskChainedHashTable<HeaderFileInfoTrait>
   HeaderFileInfoLookupTable;
   
-} // end namespace clang::serialization::reader
-} // end namespace clang::serialization
+} // namespace reader
+} // namespace serialization
 } // end namespace clang
 
 
diff --git a/lib/Serialization/ASTReaderStmt.cpp b/lib/Serialization/ASTReaderStmt.cpp
index c15f6b0b552fa99eb3d1a6bfdde952325d627dae..ae22101b99da8a659106564965023ce34ea63b31 100644
--- a/lib/Serialization/ASTReaderStmt.cpp
+++ b/lib/Serialization/ASTReaderStmt.cpp
@@ -103,7 +103,7 @@ namespace clang {
     void Visit##Type(Type *);
 #include "clang/AST/StmtNodes.inc"
   };
-}
+} // namespace clang
 
 void ASTStmtReader::
 ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args,
@@ -1699,7 +1699,7 @@ public:
 #include "clang/Basic/OpenMPKinds.def"
   OMPClause *readClause();
 };
-}
+} // namespace clang
 
 OMPClause *OMPClauseReader::readClause() {
   OMPClause *C;
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index 5bb0bec4f5690b1200fb92588ac133812aa6818e..45ab99cc11663a63620fbc36d12023dbc8bad3fe 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -98,7 +98,7 @@ namespace {
 #define ABSTRACT_TYPE(Class, Base)
 #include "clang/AST/TypeNodes.def"
   };
-}
+} // namespace
 
 void ASTTypeWriter::VisitBuiltinType(const BuiltinType *T) {
   llvm_unreachable("Built-in types are never serialized");
@@ -458,7 +458,7 @@ public:
   void VisitFunctionTypeLoc(FunctionTypeLoc TyLoc);
 };
 
-}
+} // namespace
 
 void TypeLocWriter::VisitQualifiedTypeLoc(QualifiedTypeLoc TL) {
   // nothing to do
diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp
index 6c5bc5bbd483b8b79c20c57a513646849fec2fbe..0f813302f8f3ec3ef38444e9d0fee9757ffca4d6 100644
--- a/lib/Serialization/ASTWriterDecl.cpp
+++ b/lib/Serialization/ASTWriterDecl.cpp
@@ -193,7 +193,7 @@ namespace clang {
       Record.append(LazySpecializations.begin(), LazySpecializations.end());
     }
   };
-}
+} // namespace clang
 
 void ASTDeclWriter::Visit(Decl *D) {
   DeclVisitor<ASTDeclWriter>::Visit(D);
diff --git a/lib/Serialization/ASTWriterStmt.cpp b/lib/Serialization/ASTWriterStmt.cpp
index a461d3f663906d2c4ebebb65778861c1e5e75139..f58ce5fae4e2bbabf75f885d13f16a8cba6c77f4 100644
--- a/lib/Serialization/ASTWriterStmt.cpp
+++ b/lib/Serialization/ASTWriterStmt.cpp
@@ -47,7 +47,7 @@ namespace clang {
     void Visit##Type(Type *);
 #include "clang/AST/StmtNodes.inc"
   };
-}
+} // namespace clang
 
 void ASTStmtWriter::
 AddTemplateKWAndArgsInfo(const ASTTemplateKWAndArgsInfo &Args) {
@@ -1708,7 +1708,7 @@ public:
 #include "clang/Basic/OpenMPKinds.def"
   void writeClause(OMPClause *C);
 };
-}
+} // namespace clang
 
 void OMPClauseWriter::writeClause(OMPClause *C) {
   Record.push_back(C->getClauseKind());
diff --git a/lib/Serialization/GlobalModuleIndex.cpp b/lib/Serialization/GlobalModuleIndex.cpp
index 2c7da3e82a4417256e0f98c4cd53debc72b51702..1a6fc78c5b2b1cfbb65270a1157d545e77de543a 100644
--- a/lib/Serialization/GlobalModuleIndex.cpp
+++ b/lib/Serialization/GlobalModuleIndex.cpp
@@ -52,7 +52,7 @@ namespace {
     /// \brief The index for identifiers.
     IDENTIFIER_INDEX
   };
-}
+} // namespace
 
 /// \brief The name of the global index file.
 static const char * const IndexFileName = "modules.idx";
@@ -121,7 +121,7 @@ public:
 typedef llvm::OnDiskIterableChainedHashTable<IdentifierIndexReaderTrait>
     IdentifierIndexTable;
 
-}
+} // namespace
 
 GlobalModuleIndex::GlobalModuleIndex(std::unique_ptr<llvm::MemoryBuffer> Buffer,
                                      llvm::BitstreamCursor Cursor)
@@ -430,7 +430,7 @@ namespace {
     /// \brief Write the index to the given bitstream.
     void writeIndex(llvm::BitstreamWriter &Stream);
   };
-}
+} // namespace
 
 static void emitBlockID(unsigned ID, const char *Name,
                         llvm::BitstreamWriter &Stream,
@@ -493,7 +493,7 @@ namespace {
       return std::make_pair(k, IsInteresting);
     }
   };
-}
+} // namespace
 
 bool GlobalModuleIndexBuilder::loadModuleFile(const FileEntry *File) {
   // Open the module file.
@@ -684,7 +684,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 void GlobalModuleIndexBuilder::writeIndex(llvm::BitstreamWriter &Stream) {
   using namespace llvm;
@@ -882,7 +882,7 @@ namespace {
       return Result;
     }
   };
-}
+} // namespace
 
 IdentifierIterator *GlobalModuleIndex::createIdentifierIterator() const {
   IdentifierIndexTable &Table =
diff --git a/lib/Serialization/ModuleManager.cpp b/lib/Serialization/ModuleManager.cpp
index 03d8ed0e2467e1d45d22cc6daa1b59657d55a66b..f5dff2c1658eff7365d1fe9d294d130ced47a436 100644
--- a/lib/Serialization/ModuleManager.cpp
+++ b/lib/Serialization/ModuleManager.cpp
@@ -534,7 +534,7 @@ namespace llvm {
       return M->ModuleName;
     }
   };
-}
+} // namespace llvm
 
 void ModuleManager::viewGraph() {
   llvm::ViewGraph(*this, "Modules");
diff --git a/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp b/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp
index e462e2b2f15e77fbc4985164d3ec15f4cc94307a..6c83bdbf24f282ef94b17a0e142f226f07e7e569 100644
--- a/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp
+++ b/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp
@@ -63,7 +63,7 @@ public:
   void dump() const;
   void dumpToStream(raw_ostream &os) const;
 };
-}
+} // namespace
 
 static SVal computeExtentBegin(SValBuilder &svalBuilder, 
                                const MemRegion *region) {
diff --git a/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp b/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
index 3fd55760bc5f52a6ae56b592f0cf97c9dfc4ac4a..780d80a4b72fc87db7251ebf7fe2e1031ca2f440 100644
--- a/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
+++ b/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
@@ -132,7 +132,7 @@ namespace {
     void checkPostStmt(const ObjCArrayLiteral *AL,
                        CheckerContext &C) const;
   };
-}
+} // namespace
 
 void NilArgChecker::warnIfNilExpr(const Expr *E,
                                   const char *Msg,
@@ -631,7 +631,7 @@ class ClassReleaseChecker : public Checker<check::PreObjCMessage> {
 public:
   void checkPreObjCMessage(const ObjCMethodCall &msg, CheckerContext &C) const;
 };
-}
+} // namespace
 
 void ClassReleaseChecker::checkPreObjCMessage(const ObjCMethodCall &msg,
                                               CheckerContext &C) const {
@@ -692,7 +692,7 @@ class VariadicMethodTypeChecker : public Checker<check::PreObjCMessage> {
 public:
   void checkPreObjCMessage(const ObjCMethodCall &msg, CheckerContext &C) const;
 };
-}
+} // namespace
 
 /// isVariadicMessage - Returns whether the given message is a variadic message,
 /// where all arguments must be Objective-C types.
@@ -855,7 +855,7 @@ public:
                                      const CallEvent *Call,
                                      PointerEscapeKind Kind) const;
 };
-}
+} // namespace
 
 static bool isKnownNonNilCollectionType(QualType T) {
   const ObjCObjectPointerType *PT = T->getAs<ObjCObjectPointerType>();
@@ -1208,7 +1208,7 @@ public:
 
   void checkPostObjCMessage(const ObjCMethodCall &M, CheckerContext &C) const;
 };
-}
+} // namespace
 
 ProgramStateRef
 ObjCNonNilReturnValueChecker::assumeExprIsNonNull(const Expr *NonNullExpr,
diff --git a/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp b/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp
index abfb971d4ccc6608c4f7d726eff6ffd95eb34388..f698d1beb453dcca23ff1ddb3c46e1203fe040c9 100644
--- a/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp
@@ -184,7 +184,7 @@ public:
     walker.Visit(D->getBody());
   }
 };
-}
+} // namespace
 
 void ento::registerCStringSyntaxChecker(CheckerManager &mgr) {
   mgr.registerChecker<CStringSyntaxChecker>();
diff --git a/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp b/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
index 339af8f033245ecf22e991d2c59f0c0de8b7d20d..5b5fe1ca0541eaeb3b9348de656f263ee0d3a618 100644
--- a/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
+++ b/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
@@ -241,7 +241,7 @@ public:
                      BR);
   }
 };
-}
+} // namespace
 
 void ento::registerObjCDeallocChecker(CheckerManager &mgr) {
   mgr.registerChecker<ObjCDeallocChecker>();
diff --git a/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp b/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
index 0beb917833d64e8d7bab83c1edb4e264ed8f1cd7..81cd028668ccc5d65c1a7103f78a9e46599ada61 100644
--- a/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
+++ b/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
@@ -756,7 +756,7 @@ public:
     walker.Visit(D->getBody());
   }
 };
-}
+} // namespace
 
 #define REGISTER_CHECKER(name)                                                 \
   void ento::register##name(CheckerManager &mgr) {                             \
diff --git a/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp b/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp
index a61e658f69c9afcbf1b1dcbaaf0d69b046ab1bd4..60826642393205a89eae7ac41d20c86d47b88c48 100644
--- a/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp
+++ b/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp
@@ -34,7 +34,7 @@ public:
   void VisitStmt(Stmt *S) { VisitChildren(S); }
   void VisitChildren(Stmt *S);
 };
-}
+} // namespace
 
 void WalkAST::VisitChildren(Stmt *S) {
   for (Stmt::child_iterator I = S->child_begin(), E = S->child_end(); I!=E; ++I)
diff --git a/lib/StaticAnalyzer/Checkers/ClangSACheckers.h b/lib/StaticAnalyzer/Checkers/ClangSACheckers.h
index 05b4a61c5af12fabf45eb0ba44888f8b7885c82b..81cb6a603277888e5e17d8228bfe083f3b6ff02d 100644
--- a/lib/StaticAnalyzer/Checkers/ClangSACheckers.h
+++ b/lib/StaticAnalyzer/Checkers/ClangSACheckers.h
@@ -30,8 +30,8 @@ class CheckerRegistry;
 #undef CHECKER
 #undef GET_CHECKERS
 
-} // end ento namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
index f4be5b3e82f433b89d68fbe6f7dd370b6e1adf03..1494dccaa052ec156bceac2b4790af76bb10aa8b 100644
--- a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
@@ -77,7 +77,7 @@ public:
     return reachable[block->getBlockID()];
   }
 };
-}
+} // namespace
 
 void ReachableCode::computeReachableBlocks() {
   if (!cfg.getNumBlockIDs())
@@ -445,7 +445,7 @@ public:
     }
   }
 };
-}
+} // namespace
 
 void ento::registerDeadStoresChecker(CheckerManager &mgr) {
   mgr.registerChecker<DeadStoresChecker>();
diff --git a/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp b/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp
index 51e7a3d3ce34c5157352214e95fcaae27acb880c..ee486b246edbacbabd3f272e178725376535f566 100644
--- a/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp
+++ b/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp
@@ -40,7 +40,7 @@ public:
     }
   }
 };
-}
+} // namespace
 
 void ento::registerDominatorsTreeDumper(CheckerManager &mgr) {
   mgr.registerChecker<DominatorsTreeDumper>();
@@ -60,7 +60,7 @@ public:
     }
   }
 };
-}
+} // namespace
 
 void ento::registerLiveVariablesDumper(CheckerManager &mgr) {
   mgr.registerChecker<LiveVariablesDumper>();
@@ -80,7 +80,7 @@ public:
     }
   }
 };
-}
+} // namespace
 
 void ento::registerCFGViewer(CheckerManager &mgr) {
   mgr.registerChecker<CFGViewer>();
@@ -106,7 +106,7 @@ public:
     }
   }
 };
-}
+} // namespace
 
 void ento::registerCFGDumper(CheckerManager &mgr) {
   mgr.registerChecker<CFGDumper>();
@@ -126,7 +126,7 @@ public:
     CG.viewGraph();
   }
 };
-}
+} // namespace
 
 void ento::registerCallGraphViewer(CheckerManager &mgr) {
   mgr.registerChecker<CallGraphViewer>();
@@ -146,7 +146,7 @@ public:
     CG.dump();
   }
 };
-}
+} // namespace
 
 void ento::registerCallGraphDumper(CheckerManager &mgr) {
   mgr.registerChecker<CallGraphDumper>();
@@ -185,7 +185,7 @@ public:
     llvm::errs() << "[stats]\n" << "num-entries = " << Keys.size() << '\n';
   }
 };
-}
+} // namespace
 
 void ento::registerConfigDumper(CheckerManager &mgr) {
   mgr.registerChecker<ConfigDumper>();
diff --git a/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp b/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp
index 0bcebf6e7744733c81797feb85cf0f9259117cf4..7696fabe5b8e4e3d4655d49d3c9beb864fd4d228 100644
--- a/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp
+++ b/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp
@@ -205,7 +205,7 @@ void DirectIvarAssignment::MethodCrawler::VisitBinaryOperator(
     }
   }
 }
-}
+} // namespace
 
 // Register the checker that checks for direct accesses in all functions,
 // except for the initialization and copy routines.
diff --git a/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp b/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
index 43a281218775d51ad0477ace1ee52495cbc9f9e5..6317e37d88f8340258f13a9b6b991619a3429cd1 100644
--- a/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
+++ b/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
@@ -41,7 +41,7 @@ public:
   void checkPostStmt(const ImplicitCastExpr *CastE, CheckerContext &C) const;
   void checkPostStmt(const CXXNewExpr *NewE, CheckerContext &C) const;
 };
-}
+} // namespace
 
 static void recordFixedType(const MemRegion *Region, const CXXMethodDecl *MD,
                             CheckerContext &C) {
diff --git a/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp b/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp
index f36ec2c687f5b3f3d1d3b8573583c1993a0915f1..ef7ba1670c42b205f82d1fee41c8c75670e588de 100644
--- a/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp
@@ -31,7 +31,7 @@ class ExprInspectionChecker : public Checker< eval::Call > {
 public:
   bool evalCall(const CallExpr *CE, CheckerContext &C) const;
 };
-}
+} // namespace
 
 bool ExprInspectionChecker::evalCall(const CallExpr *CE,
                                      CheckerContext &C) const {
diff --git a/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp b/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp
index 02c12095b5a59a1e39123e2340b9d2220c5712df..e71fb14e8dfc22c407d3ca7b637c38cc1064896e 100644
--- a/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp
@@ -722,7 +722,7 @@ void IvarInvalidationCheckerImpl::MethodCrawler::VisitObjCMessageExpr(
 
   VisitStmt(ME);
 }
-}
+} // namespace
 
 // Register the checkers.
 namespace {
@@ -738,7 +738,7 @@ public:
     Walker.visit(D);
   }
 };
-}
+} // namespace
 
 #define REGISTER_CHECKER(name)                                                 \
   void ento::register##name(CheckerManager &mgr) {                             \
diff --git a/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp b/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp
index 0b7375a4b61465c275e0e03a7a73016e9d4f6abe..68ffb26f0685a66ce290363099df45274f3c9cd9 100644
--- a/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp
@@ -312,7 +312,7 @@ public:
     CheckStringRefAssignedTemporary(D, BR, this);
   }
 };
-}
+} // namespace
 
 void ento::registerLLVMConventionsChecker(CheckerManager &mgr) {
   mgr.registerChecker<LLVMConventionsChecker>();
diff --git a/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp b/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
index 52e29368cea380e180b89e440c3b2c625a8daa10..1ff43c5e251d55bbb6d1e7f434d03f0aa79c6a1e 100644
--- a/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
@@ -151,7 +151,7 @@ private:
                                    BugReport &BR) override;
   };
 };
-}
+} // namespace
 
 /// ProgramState traits to store the currently allocated (and not yet freed)
 /// symbols. This is a map from the allocated content symbol to the
diff --git a/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp b/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
index e91347999dc171f4231d6ac685ad1964fe5d3ab6..817122e50ad404480543626092193e9d5e7be355 100644
--- a/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
@@ -187,7 +187,7 @@ private:
       toScanFor(v), Context(ctx)
     { }
   };
-}
+} // namespace
 
 // OutputPossibleOverflows - We've found a possible overflow earlier,
 // now check whether Body might contain a comparison which might be
diff --git a/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp b/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp
index 296aec66805a444ffc1789e5881791ec2f398660..cf255772d30ede6f8615db3b61e69a75f3df7be3 100644
--- a/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp
@@ -246,7 +246,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 void ento::registerMallocSizeofChecker(CheckerManager &mgr) {
   mgr.registerChecker<MallocSizeofChecker>();
diff --git a/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp b/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
index 2be7f1d4ab8c74acea82ab4865a80536eb82564d..9d0638dee5c1cef04901d7ec1c9f2783730e05cb 100644
--- a/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
@@ -47,7 +47,7 @@ public:
   void checkASTDecl(const ObjCMethodDecl *D,
                     AnalysisManager &mgr, BugReporter &BR) const;
 };
-}
+} // namespace
 
 void NSErrorMethodChecker::checkASTDecl(const ObjCMethodDecl *D,
                                         AnalysisManager &mgr,
@@ -94,7 +94,7 @@ public:
   void checkASTDecl(const FunctionDecl *D,
                     AnalysisManager &mgr, BugReporter &BR) const;
 };
-}
+} // namespace
 
 void CFErrorFunctionChecker::checkASTDecl(const FunctionDecl *D,
                                         AnalysisManager &mgr,
@@ -146,7 +146,7 @@ public:
                 "Coding conventions (Apple)") {}
 };
 
-}
+} // namespace
 
 namespace {
 class NSOrCFErrorDerefChecker
@@ -164,7 +164,7 @@ public:
                      CheckerContext &C) const;
   void checkEvent(ImplicitNullDerefEvent event) const;
 };
-}
+} // namespace
 
 typedef llvm::ImmutableMap<SymbolRef, unsigned> ErrorOutFlag;
 REGISTER_TRAIT_WITH_PROGRAMSTATE(NSErrorOut, ErrorOutFlag)
diff --git a/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp b/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
index ba82d1d1d41f7f29b6996317aa1f043ded4c1bf6..6773b58161a4662ddfa0aab6b894e957d9d1aebd 100644
--- a/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
@@ -36,7 +36,7 @@ public:
   void checkPostObjCMessage(const ObjCMethodCall &msg, CheckerContext &C) const;
 };
 
-}
+} // namespace
 
 void NoReturnFunctionChecker::checkPostCall(const CallEvent &CE,
                                             CheckerContext &C) const {
diff --git a/lib/StaticAnalyzer/Checkers/ObjCContainersASTChecker.cpp b/lib/StaticAnalyzer/Checkers/ObjCContainersASTChecker.cpp
index e3fc611a7e00dbe3798f2ce11a832440657da5ae..159fb8f7b91f46e7020566f5d54c078b464058e9 100644
--- a/lib/StaticAnalyzer/Checkers/ObjCContainersASTChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/ObjCContainersASTChecker.cpp
@@ -168,7 +168,7 @@ public:
     walker.Visit(D->getBody());
   }
 };
-}
+} // namespace
 
 void ento::registerObjCContainersASTChecker(CheckerManager &mgr) {
   mgr.registerChecker<ObjCContainersASTChecker>();
diff --git a/lib/StaticAnalyzer/Checkers/ObjCMissingSuperCallChecker.cpp b/lib/StaticAnalyzer/Checkers/ObjCMissingSuperCallChecker.cpp
index a2cf8e10d09b6db40105446ab906a410559a2721..a398832e7ffbce58c2f2511e68a1928bd4e86ab2 100644
--- a/lib/StaticAnalyzer/Checkers/ObjCMissingSuperCallChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/ObjCMissingSuperCallChecker.cpp
@@ -81,7 +81,7 @@ private:
   mutable bool IsInitialized;
 };
 
-}
+} // namespace
 
 /// \brief Determine whether the given class has a superclass that we want
 /// to check. The name of the found superclass is stored in SuperclassName.
diff --git a/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
index 49eef236e90641c11fc0407aa570311e05ed7485..c794de8cfb5cda32307ed7daf3ca51fa5eaa0531 100644
--- a/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
@@ -61,7 +61,7 @@ template <> struct FoldingSetTrait<RetEffect> {
     ID.AddInteger((unsigned) X.getObjKind());
 }
 };
-} // end llvm namespace
+} // namespace llvm
 
 //===----------------------------------------------------------------------===//
 // Reference-counting logic (typestate + counts).
@@ -484,7 +484,7 @@ public:
   IdentifierInfo *getIdentifier() const { return II; }
   Selector getSelector() const { return S; }
 };
-}
+} // namespace
 
 namespace llvm {
 template <> struct DenseMapInfo<ObjCSummaryKey> {
@@ -510,7 +510,7 @@ template <> struct DenseMapInfo<ObjCSummaryKey> {
   }
 
 };
-} // end llvm namespace
+} // namespace llvm
 
 namespace {
 class ObjCSummaryCache {
@@ -4032,4 +4032,6 @@ CallEffects CallEffects::getEffect(const FunctionDecl *FD) {
 
 #undef createCallEffect
 
-}}}
+} // namespace objc_retain
+} // namespace ento
+} // namespace clang
diff --git a/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp b/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp
index 6622313c991f6a5c252e7bb13056f4266c32431b..fb135bd80025df82e437bb9661c1d082d5d149f2 100644
--- a/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp
@@ -34,7 +34,7 @@ class ReturnUndefChecker : public Checker< check::PreStmt<ReturnStmt> > {
 public:
   void checkPreStmt(const ReturnStmt *RS, CheckerContext &C) const;
 };
-}
+} // namespace
 
 void ReturnUndefChecker::checkPreStmt(const ReturnStmt *RS,
                                       CheckerContext &C) const {
diff --git a/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp b/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
index 327a9e0ac435ae2442efb4f2a7c9e287d88f6a59..c21f71e65498fe1c735f73fd8eb441b35fce874c 100644
--- a/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
@@ -40,7 +40,7 @@ private:
   static SourceRange genName(raw_ostream &os, const MemRegion *R,
                              ASTContext &Ctx);
 };
-}
+} // namespace
 
 SourceRange StackAddrEscapeChecker::genName(raw_ostream &os, const MemRegion *R,
                                             ASTContext &Ctx) {
diff --git a/lib/StaticAnalyzer/Checkers/TaintTesterChecker.cpp b/lib/StaticAnalyzer/Checkers/TaintTesterChecker.cpp
index d33c977826a5bc507a1d0be14543f95b7916b1f3..22f4304b05bcab4a4ba38ccfab66029e3ca9a7f4 100644
--- a/lib/StaticAnalyzer/Checkers/TaintTesterChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/TaintTesterChecker.cpp
@@ -34,7 +34,7 @@ class TaintTesterChecker : public Checker< check::PostStmt<Expr> > {
 public:
   void checkPostStmt(const Expr *E, CheckerContext &C) const;
 };
-}
+} // namespace
 
 inline void TaintTesterChecker::initBugType() const {
   if (!BT)
diff --git a/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp b/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
index fc49a46eae58d0eec9f4952f4c5d4391b32aef33..9be10ba863e86842c5042025a8d64abe5ba57217 100644
--- a/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
@@ -56,7 +56,7 @@ public:
   void checkBranchCondition(const Stmt *Condition, CheckerContext &Ctx) const;
 };
 
-}
+} // namespace
 
 void UndefBranchChecker::checkBranchCondition(const Stmt *Condition,
                                               CheckerContext &Ctx) const {
diff --git a/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp b/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
index d78de3c6f3a844307392cb1ad668f52af468c0b9..5f7f9ed020d1972af9761aab6efc6635076f5b79 100644
--- a/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
@@ -48,7 +48,7 @@ private:
   static bool isInvalidPath(const CFGBlock *CB, const ParentMap &PM);
   static inline bool isEmptyCFGBlock(const CFGBlock *CB);
 };
-}
+} // namespace
 
 void UnreachableCodeChecker::checkEndAnalysis(ExplodedGraph &G,
                                               BugReporter &B,
diff --git a/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp b/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
index 7e1fc1eb54adfe221499eca01830e44d895bf51c..5bffc41174cdea48d37a81a48ffe7973c2be353f 100644
--- a/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
@@ -239,7 +239,7 @@ public:
       }
   }
 };
-}
+} // namespace
 
 void ento::registerVirtualCallChecker(CheckerManager &mgr) {
   mgr.registerChecker<VirtualCallChecker>();
diff --git a/lib/StaticAnalyzer/Core/BasicValueFactory.cpp b/lib/StaticAnalyzer/Core/BasicValueFactory.cpp
index 0e90566839ca7d029c31636fa8181eb2015680e7..7e3c09095375e3ed02c6a03ba496e217ad9257dc 100644
--- a/lib/StaticAnalyzer/Core/BasicValueFactory.cpp
+++ b/lib/StaticAnalyzer/Core/BasicValueFactory.cpp
@@ -50,7 +50,7 @@ template<> struct FoldingSetTrait<SValPair> {
     X.second.Profile(ID);
   }
 };
-}
+} // namespace llvm
 
 typedef llvm::FoldingSet<llvm::FoldingSetNodeWrapper<SValData> >
   PersistentSValsTy;
diff --git a/lib/StaticAnalyzer/Core/BlockCounter.cpp b/lib/StaticAnalyzer/Core/BlockCounter.cpp
index c1ac03d5ab97d9ad92cb7207feba8c9013a19d59..64478875601689e84b224ddb2a2af08c19ae1f1b 100644
--- a/lib/StaticAnalyzer/Core/BlockCounter.cpp
+++ b/lib/StaticAnalyzer/Core/BlockCounter.cpp
@@ -43,7 +43,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 typedef llvm::ImmutableMap<CountKey, unsigned> CountMap;
 
diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp
index 97e97ef8c4d68aeabb5922dab57a9f99da6f6d1e..fce72dd9e9cb3920a62d53e64455aefceb250a07 100644
--- a/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -2847,7 +2847,7 @@ public:
 
   bool popNextReportGraph(ReportGraph &GraphWrapper);
 };
-}
+} // namespace
 
 TrimmedGraph::TrimmedGraph(const ExplodedGraph *OriginalGraph,
                            ArrayRef<const ExplodedNode *> Nodes) {
diff --git a/lib/StaticAnalyzer/Core/CheckerManager.cpp b/lib/StaticAnalyzer/Core/CheckerManager.cpp
index 2684cc78be75069fd931c46979752531bc1f2ea2..7a4d24608c8d5f78d6a7317dd7dd29e9d8e192b9 100644
--- a/lib/StaticAnalyzer/Core/CheckerManager.cpp
+++ b/lib/StaticAnalyzer/Core/CheckerManager.cpp
@@ -160,7 +160,7 @@ namespace {
       checkFn(S, C);
     }
   };
-}
+} // namespace
 
 /// \brief Run checkers for visiting Stmts.
 void CheckerManager::runCheckersForStmt(bool isPreVisit,
@@ -199,7 +199,7 @@ namespace {
       checkFn(*Msg.cloneWithState<ObjCMethodCall>(Pred->getState()), C);
     }
   };
-}
+} // namespace
 
 /// \brief Run checkers for visiting obj-c messages.
 void CheckerManager::runCheckersForObjCMessage(bool isPreVisit,
@@ -242,7 +242,7 @@ namespace {
       checkFn(*Call.cloneWithState(Pred->getState()), C);
     }
   };
-}
+} // namespace
 
 /// \brief Run checkers for visiting an abstract call event.
 void CheckerManager::runCheckersForCallEvent(bool isPreVisit,
@@ -290,7 +290,7 @@ namespace {
       checkFn(Loc, IsLoad, BoundEx, C);
     }
   };
-}
+} // namespace
 
 /// \brief Run checkers for load/store of a location.
 
@@ -331,7 +331,7 @@ namespace {
       checkFn(Loc, Val, S, C);
     }
   };
-}
+} // namespace
 
 /// \brief Run checkers for binding of a value to a location.
 void CheckerManager::runCheckersForBind(ExplodedNodeSet &Dst,
@@ -395,7 +395,7 @@ namespace {
       checkFn(Condition, C);
     }
   };
-}
+} // namespace
 
 /// \brief Run checkers for branch condition.
 void CheckerManager::runCheckersForBranchCondition(const Stmt *Condition,
@@ -444,7 +444,7 @@ namespace {
       checkFn(SR, C);
     }
   };
-}
+} // namespace
 
 /// \brief Run checkers for dead symbols.
 void CheckerManager::runCheckersForDeadSymbols(ExplodedNodeSet &Dst,
diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp
index ef515fb5937b60fe2274739ef7e2103616085bcc..4c255c1e2629a17059289ca3a18167572ac4bac7 100644
--- a/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -2648,7 +2648,7 @@ struct DOTGraphTraits<ExplodedNode*> :
     return Out.str();
   }
 };
-} // end llvm namespace
+} // namespace llvm
 #endif
 
 void ExprEngine::ViewGraph(bool trim) {
diff --git a/lib/StaticAnalyzer/Core/PrettyStackTraceLocationContext.h b/lib/StaticAnalyzer/Core/PrettyStackTraceLocationContext.h
index e7cc23ca823455c3efb8435d644c4a90180557b1..c1baddd13029a8cdc931db00b55bc0bd283dbc69 100644
--- a/lib/StaticAnalyzer/Core/PrettyStackTraceLocationContext.h
+++ b/lib/StaticAnalyzer/Core/PrettyStackTraceLocationContext.h
@@ -39,7 +39,7 @@ public:
   }
 };
 
-} // end ento namespace
-} // end clang namespace
+} // namespace ento
+} // namespace clang
 
 #endif
diff --git a/lib/StaticAnalyzer/Core/ProgramState.cpp b/lib/StaticAnalyzer/Core/ProgramState.cpp
index 60b32c722ebf8f92cae9d42e7f1e7aa119b84290..5f3e18feee6bd3bd1ae650b3f91c7407911df422 100644
--- a/lib/StaticAnalyzer/Core/ProgramState.cpp
+++ b/lib/StaticAnalyzer/Core/ProgramState.cpp
@@ -40,7 +40,8 @@ void ProgramStateRelease(const ProgramState *state) {
     Mgr.freeStates.push_back(s);
   }
 }
-}}
+} // namespace ento
+} // namespace clang
 
 ProgramState::ProgramState(ProgramStateManager *mgr, const Environment& env,
                  StoreRef st, GenericDataMap gdm)
diff --git a/lib/StaticAnalyzer/Core/RegionStore.cpp b/lib/StaticAnalyzer/Core/RegionStore.cpp
index 6d41fc2146fe4ca66298f55711ca12fcf31152be..dd0f6125e52730d42e596107e6395bf2e818ea04 100644
--- a/lib/StaticAnalyzer/Core/RegionStore.cpp
+++ b/lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -131,7 +131,7 @@ namespace llvm {
   template <> struct isPodLike<BindingKey> {
     static const bool value = true;
   };
-} // end llvm namespace
+} // namespace llvm
 
 LLVM_DUMP_METHOD void BindingKey::dump() const { llvm::errs() << *this; }
 
@@ -309,7 +309,7 @@ public:
 
   bool supportsFields() const { return SupportsFields; }
 };
-}
+} // namespace
 
 //===----------------------------------------------------------------------===//
 // Main RegionStore logic.
@@ -737,7 +737,7 @@ public:
     static_cast<DERIVED*>(this)->VisitCluster(BaseR, C);
   }
 };
-}
+} // namespace
 
 //===----------------------------------------------------------------------===//
 // Binding invalidation.
@@ -963,7 +963,7 @@ public:
   void VisitCluster(const MemRegion *baseR, const ClusterBindings *C);
   void VisitBinding(SVal V);
 };
-}
+} // namespace
 
 void invalidateRegionsWorker::VisitBinding(SVal V) {
   // A symbol?  Mark it touched by the invalidation.
@@ -2196,7 +2196,7 @@ public:
   bool UpdatePostponed();
   void VisitBinding(SVal V);
 };
-}
+} // namespace
 
 void removeDeadBindingsWorker::VisitAddedToCluster(const MemRegion *baseR,
                                                    const ClusterBindings &C) {
diff --git a/lib/StaticAnalyzer/Core/SimpleConstraintManager.h b/lib/StaticAnalyzer/Core/SimpleConstraintManager.h
index 135cd4ef86492397153dff78fe9bdfa34d297b03..9911a8f2bcad1be8f839f6291785e459baf7b997 100644
--- a/lib/StaticAnalyzer/Core/SimpleConstraintManager.h
+++ b/lib/StaticAnalyzer/Core/SimpleConstraintManager.h
@@ -93,8 +93,8 @@ protected:
                                          bool Assumption);
 };
 
-} // end GR namespace
+} // namespace ento
 
-} // end clang namespace
+} // namespace clang
 
 #endif
diff --git a/lib/StaticAnalyzer/Frontend/ModelInjector.h b/lib/StaticAnalyzer/Frontend/ModelInjector.h
index e23bf8abf3846faa42124bc8976ae9fac2baeeac..196925030f9a38375ec038b24e24453c98de2426 100644
--- a/lib/StaticAnalyzer/Frontend/ModelInjector.h
+++ b/lib/StaticAnalyzer/Frontend/ModelInjector.h
@@ -68,7 +68,7 @@ private:
   // BodyFarm.
   llvm::StringMap<Stmt *> Bodies;
 };
-}
-}
+} // namespace ento
+} // namespace clang
 
 #endif
diff --git a/lib/Tooling/Tooling.cpp b/lib/Tooling/Tooling.cpp
index f9cb7c64134473a6842ec3c5facd755e96dad3f9..5e373d664e1250c12f09d1a258e586543f3a5494 100644
--- a/lib/Tooling/Tooling.cpp
+++ b/lib/Tooling/Tooling.cpp
@@ -173,7 +173,7 @@ public:
   FrontendAction *create() override { return Action; }
 };
 
-}
+} // namespace
 
 ToolInvocation::ToolInvocation(
     std::vector<std::string> CommandLine, ToolAction *Action,
@@ -406,7 +406,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 int ClangTool::buildASTs(std::vector<std::unique_ptr<ASTUnit>> &ASTs) {
   ASTBuilderAction Action(ASTs);
diff --git a/tools/diagtool/DiagTool.h b/tools/diagtool/DiagTool.h
index 04b926df3b603f9a5798e49dcb29ec9fd0a86099..c1ae0e54279aed15b933150b3d541ffaf4edacb6 100644
--- a/tools/diagtool/DiagTool.h
+++ b/tools/diagtool/DiagTool.h
@@ -54,7 +54,7 @@ public:
   RegisterDiagTool() { diagTools->registerTool(new DIAGTOOL()); }
 };
 
-} // end diagtool namespace
+} // namespace diagtool
 
 #define DEF_DIAGTOOL(NAME, DESC, CLSNAME)\
 namespace {\
diff --git a/tools/diagtool/ListWarnings.cpp b/tools/diagtool/ListWarnings.cpp
index 3e6e88306e24712ef7273a2ff2ccd50227b17cd1..10c86b4d96bba2d15931728d0d384e4e6d32753f 100644
--- a/tools/diagtool/ListWarnings.cpp
+++ b/tools/diagtool/ListWarnings.cpp
@@ -37,7 +37,7 @@ struct Entry {
   
   bool operator<(const Entry &x) const { return DiagName < x.DiagName; }
 };
-}
+} // namespace
 
 static void printEntries(std::vector<Entry> &entries, llvm::raw_ostream &out) {
   for (std::vector<Entry>::iterator it = entries.begin(), ei = entries.end();
diff --git a/tools/diagtool/ShowEnabledWarnings.cpp b/tools/diagtool/ShowEnabledWarnings.cpp
index 06f74320b7fc5b918e8d3ea97180e65947da19a9..67094a5836ecc59d696a15b8f30858d95fcc7798 100644
--- a/tools/diagtool/ShowEnabledWarnings.cpp
+++ b/tools/diagtool/ShowEnabledWarnings.cpp
@@ -34,7 +34,7 @@ namespace {
 
     bool operator<(const PrettyDiag &x) const { return Name < x.Name; }
   };
-}
+} // namespace
 
 static void printUsage() {
   llvm::errs() << "Usage: diagtool show-enabled [<flags>] <single-input.c>\n";
diff --git a/tools/driver/cc1as_main.cpp b/tools/driver/cc1as_main.cpp
index 3b55441e18889f1f2af503b021e9adf479043f8b..73883c4f60a8e1472cbaa6b154ef12ac0b299d24 100644
--- a/tools/driver/cc1as_main.cpp
+++ b/tools/driver/cc1as_main.cpp
@@ -149,7 +149,7 @@ public:
                              DiagnosticsEngine &Diags);
 };
 
-}
+} // namespace
 
 bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
                                          ArrayRef<const char *> Argv,
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 2216ec61afa74e67a3fcfe0c112cf2502486ec6a..857e276f8cab355c639f75dd3088f588da628964 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -1897,7 +1897,7 @@ private:
   void EnqueueChildren(const Stmt *S);
   void EnqueueChildren(const OMPClause *S);
 };
-} // end anonyous namespace
+} // namespace
 
 void EnqueueVisitor::AddDeclarationNameInfo(const Stmt *S) {
   // 'S' should always be non-null, since it comes from the
@@ -2098,7 +2098,7 @@ OMPClauseEnqueue::VisitOMPCopyprivateClause(const OMPCopyprivateClause *C) {
 void OMPClauseEnqueue::VisitOMPFlushClause(const OMPFlushClause *C) {
   VisitOMPClauseList(C);
 }
-}
+} // namespace
 
 void EnqueueVisitor::EnqueueChildren(const OMPClause *S) {
   unsigned size = WL.size();
@@ -2783,7 +2783,7 @@ buildPieces(unsigned NameFlags, bool IsMemberRefExpr,
 
   return Pieces;  
 }
-}
+} // namespace
 
 //===----------------------------------------------------------------------===//
 // Misc. API hooks.
@@ -5616,7 +5616,7 @@ public:
     assert(PostChildrenInfos.empty());
   }
 };
-}
+} // namespace
 
 void AnnotateTokensWorker::AnnotateTokens() {
   // Walk the AST within the region of interest, annotating tokens
@@ -7116,7 +7116,7 @@ void SetSafetyThreadStackSize(unsigned Value) {
   SafetyStackThreadSize = Value;
 }
 
-}
+} // namespace clang
 
 void clang::setThreadBackgroundPriority() {
   if (getenv("LIBCLANG_BGPRIO_DISABLE"))
diff --git a/tools/libclang/CIndexCodeCompletion.cpp b/tools/libclang/CIndexCodeCompletion.cpp
index a7b8e292047bb6074c1a7de025b372423af017d0..6637abbf86687730c87e651b6fc5fc311587421b 100644
--- a/tools/libclang/CIndexCodeCompletion.cpp
+++ b/tools/libclang/CIndexCodeCompletion.cpp
@@ -644,7 +644,7 @@ namespace {
       StoredResults.clear();
     }
   };
-}
+} // namespace
 
 extern "C" {
 struct CodeCompleteAtInfo {
@@ -996,7 +996,7 @@ namespace {
       return result < 0;
     }
   };
-}
+} // namespace
 
 extern "C" {
   void clang_sortCodeCompletionResults(CXCompletionResult *Results,
diff --git a/tools/libclang/CIndexDiagnostic.cpp b/tools/libclang/CIndexDiagnostic.cpp
index 9ba36a6a0f8a600ef5e6bfeec71e8214d0e8d788..24d8af8060c212d2614ccd475fb6c2a97e0c3305 100644
--- a/tools/libclang/CIndexDiagnostic.cpp
+++ b/tools/libclang/CIndexDiagnostic.cpp
@@ -155,7 +155,7 @@ public:
   CXDiagnosticSetImpl *CurrentSet;
   CXDiagnosticSetImpl *MainSet;
 };  
-}
+} // namespace
 
 CXDiagnosticSetImpl *cxdiag::lazyCreateDiags(CXTranslationUnit TU,
                                              bool checkIfChanged) {
diff --git a/tools/libclang/CIndexer.h b/tools/libclang/CIndexer.h
index 8a306cde67ca576ef2dbcd9eb9e3d1e70baced7b..3e16f32db7fa4a8095d8f19499c61a318ac86e5c 100644
--- a/tools/libclang/CIndexer.h
+++ b/tools/libclang/CIndexer.h
@@ -120,7 +120,7 @@ public:
     MacroDefinitionRecord *checkForMacroInMacroDefinition(const MacroInfo *MI,
                                                           const Token &Tok,
                                                           CXTranslationUnit TU);
-    }
-    }
+    } // namespace cxindex
+    } // namespace clang
 
 #endif
diff --git a/tools/libclang/CLog.h b/tools/libclang/CLog.h
index b9309ed192399aa58b310088a7f69bfe3062f014..6a6e90abea96c74bdde83aaf17b7e74f851da4ac 100644
--- a/tools/libclang/CLog.h
+++ b/tools/libclang/CLog.h
@@ -87,8 +87,8 @@ public:
   Logger &operator<<(const llvm::format_object_base &Fmt);
 };
 
-}
-}
+} // namespace cxindex
+} // namespace clang
 
 /// \brief Macros to automate common uses of Logger. Like this:
 /// \code
diff --git a/tools/libclang/CXCursor.cpp b/tools/libclang/CXCursor.cpp
index b8bb28ed8530f4071284381ae94c1e9914d70b86..2950451ac3b36b546e1e616d7370be3b25687591 100644
--- a/tools/libclang/CXCursor.cpp
+++ b/tools/libclang/CXCursor.cpp
@@ -1249,7 +1249,7 @@ public:
            x.data[1] == y.data[1];
   }
 };
-}
+} // namespace llvm
 
 extern "C" {
 CXCursorSet clang_createCXCursorSet() {
@@ -1325,7 +1325,7 @@ namespace {
       }
     }
   };
-}
+} // namespace
 
 void *cxcursor::createOverridenCXCursorsPool() {
   return new OverridenCursorsPool();
diff --git a/tools/libclang/CXCursor.h b/tools/libclang/CXCursor.h
index 083b86934d1657a429df81e4095480807f16468d..ec88d53bb7d6249eb8158e9fabe377e4efd46396 100644
--- a/tools/libclang/CXCursor.h
+++ b/tools/libclang/CXCursor.h
@@ -294,6 +294,7 @@ inline bool operator!=(CXCursor X, CXCursor Y) {
 /// first in a declaration group.
 bool isFirstInDeclGroup(CXCursor C);
 
-}} // end namespace: clang::cxcursor
+} // namespace cxcursor
+} // namespace clang
 
 #endif
diff --git a/tools/libclang/CXLoadedDiagnostic.cpp b/tools/libclang/CXLoadedDiagnostic.cpp
index 754ad55a66040838023d0bb58286fd440de0bcb3..746e4579daa9979c1a4666ca3c67789b69a3216e 100644
--- a/tools/libclang/CXLoadedDiagnostic.cpp
+++ b/tools/libclang/CXLoadedDiagnostic.cpp
@@ -56,7 +56,7 @@ public:
     return mem;
   }
 };
-}
+} // namespace
 
 //===----------------------------------------------------------------------===//
 // Cleanup.
@@ -246,7 +246,7 @@ public:
 
   CXDiagnosticSet load(const char *file);
 };
-}
+} // namespace
 
 CXDiagnosticSet DiagLoader::load(const char *file) {
   TopDiags = llvm::make_unique<CXLoadedDiagnosticSetImpl>();
diff --git a/tools/libclang/CXLoadedDiagnostic.h b/tools/libclang/CXLoadedDiagnostic.h
index d5006a4444a437e2908fdd5217ca0dc0338c3cf0..b68392783fe115d52b1a961c55f18bf6a341ce8f 100644
--- a/tools/libclang/CXLoadedDiagnostic.h
+++ b/tools/libclang/CXLoadedDiagnostic.h
@@ -89,6 +89,6 @@ public:
   unsigned severity;
   unsigned category;
 };
-}
+} // namespace clang
 
 #endif
diff --git a/tools/libclang/CXSourceLocation.h b/tools/libclang/CXSourceLocation.h
index f0b3f4954919bf905f75ed232d71665b4df2e5a2..3cb78d23a1f8529d0a0e23c66b9095b717887692 100644
--- a/tools/libclang/CXSourceLocation.h
+++ b/tools/libclang/CXSourceLocation.h
@@ -73,6 +73,7 @@ static inline SourceRange translateCXSourceRange(CXSourceRange R) {
 }
 
 
-}} // end namespace: clang::cxloc
+} // namespace cxloc
+} // namespace clang
 
 #endif
diff --git a/tools/libclang/CXString.h b/tools/libclang/CXString.h
index 72ac0cf46914a5dbebcf81074d2d6ea967035328..3d54690ddef28b92a83b303310c48da24b136e45 100644
--- a/tools/libclang/CXString.h
+++ b/tools/libclang/CXString.h
@@ -96,12 +96,12 @@ CXStringBuf *getCXStringBuf(CXTranslationUnit TU);
 /// \brief Returns true if the CXString data is managed by a pool.
 bool isManagedByPool(CXString str);
 
-}
+} // namespace cxstring
 
 static inline StringRef getContents(const CXUnsavedFile &UF) {
   return StringRef(UF.Contents, UF.Length);
 }
-}
+} // namespace clang
 
 #endif
 
diff --git a/tools/libclang/CXTranslationUnit.h b/tools/libclang/CXTranslationUnit.h
index 6022c9dab1b5c1270bb88c60307fc5f56ceb0642..9054c509103a38aeb5ff9e6ee83098875ffd9f39 100644
--- a/tools/libclang/CXTranslationUnit.h
+++ b/tools/libclang/CXTranslationUnit.h
@@ -78,6 +78,7 @@ public:
 };
 
 
-}} // end namespace clang::cxtu
+} // namespace cxtu
+} // namespace clang
 
 #endif
diff --git a/tools/libclang/CursorVisitor.h b/tools/libclang/CursorVisitor.h
index 1b2a922204f8ca8452699f3db91df7b848aa5aaf..a00fc98573380c75baec84fb7ba8f5100366b51c 100644
--- a/tools/libclang/CursorVisitor.h
+++ b/tools/libclang/CursorVisitor.h
@@ -263,8 +263,8 @@ public:
   LLVM_ATTRIBUTE_NOINLINE bool Visit(const Stmt *S);
 };
 
-}
-}
+} // namespace cxcursor
+} // namespace clang
 
 #endif
 
diff --git a/tools/libclang/Indexing.cpp b/tools/libclang/Indexing.cpp
index e35640029e62c8e0cfeb85ce466c1c6062150ed9..c1e3378438a53a425dbcd3b2fff3f91f7a5d1175 100644
--- a/tools/libclang/Indexing.cpp
+++ b/tools/libclang/Indexing.cpp
@@ -141,7 +141,7 @@ namespace llvm {
       return LHS == RHS;
     }
   };
-}
+} // namespace llvm
 
 namespace {
 
diff --git a/tools/libclang/IndexingContext.h b/tools/libclang/IndexingContext.h
index 4da6aebaf6480e60048f54a5e019f6a0c8c2c798..5f29e0b4cb8b162f51b63219892538d16d33e18e 100644
--- a/tools/libclang/IndexingContext.h
+++ b/tools/libclang/IndexingContext.h
@@ -519,6 +519,7 @@ inline T *ScratchAlloc::allocate() {
   return IdxCtx.StrScratch.Allocate<T>();
 }
 
-}} // end clang::cxindex
+} // namespace cxindex
+} // namespace clang
 
 #endif
diff --git a/unittests/AST/EvaluateAsRValueTest.cpp b/unittests/AST/EvaluateAsRValueTest.cpp
index 820edbc7c3e888cda869780ea127ea3aca733920..f1d3eb5296f077d3e4440439eddd9b5b88c2b0cc 100644
--- a/unittests/AST/EvaluateAsRValueTest.cpp
+++ b/unittests/AST/EvaluateAsRValueTest.cpp
@@ -79,7 +79,7 @@ class EvaluateConstantInitializersAction : public clang::ASTFrontendAction {
     }
   };
 };
-}
+} // namespace
 
 TEST(EvaluateAsRValue, FailsGracefullyForUnknownTypes) {
   // This is a regression test; the AST library used to trigger assertion
diff --git a/unittests/Basic/DiagnosticTest.cpp b/unittests/Basic/DiagnosticTest.cpp
index fa2b56e083419761ce07fc6f66c4991ea92f9a1f..100fda4af5ae7debefafdc0f16cf17dce84eafc4 100644
--- a/unittests/Basic/DiagnosticTest.cpp
+++ b/unittests/Basic/DiagnosticTest.cpp
@@ -46,4 +46,4 @@ TEST(DiagnosticTest, suppressAndTrap) {
   EXPECT_FALSE(Diags.hasUnrecoverableErrorOccurred());
 }
 
-}
+} // namespace
diff --git a/unittests/Basic/SourceManagerTest.cpp b/unittests/Basic/SourceManagerTest.cpp
index 494c27a2f1cdfb42eeebaf095208ff4e2f97ab8f..f087b69118d40c74311690bbeddd33562a7502fb 100644
--- a/unittests/Basic/SourceManagerTest.cpp
+++ b/unittests/Basic/SourceManagerTest.cpp
@@ -271,7 +271,7 @@ public:
   }
 };
 
-}
+} // namespace
 
 TEST_F(SourceManagerTest, isBeforeInTranslationUnitWithMacroInInclude) {
   const char *header =
diff --git a/unittests/Basic/VirtualFileSystemTest.cpp b/unittests/Basic/VirtualFileSystemTest.cpp
index 71d2d2b60c04ce9ea4e4baa1e28bb4883d59ea60..fc3004ee7990867610576f0c0854123dd6580758 100644
--- a/unittests/Basic/VirtualFileSystemTest.cpp
+++ b/unittests/Basic/VirtualFileSystemTest.cpp
@@ -279,7 +279,7 @@ struct ScopedDir {
   }
   operator StringRef() { return Path.str(); }
 };
-}
+} // namespace
 
 TEST(VirtualFileSystemTest, BasicRealFSIteration) {
   ScopedDir TestDirectory("virtual-file-system-test", /*Unique*/true);
diff --git a/unittests/CodeGen/BufferSourceTest.cpp b/unittests/CodeGen/BufferSourceTest.cpp
index b2a8ba580844ee434680abab3cc6971a4b8c8739..00f067753145e9dec98d96dc0b37105ea0bc010f 100644
--- a/unittests/CodeGen/BufferSourceTest.cpp
+++ b/unittests/CodeGen/BufferSourceTest.cpp
@@ -74,4 +74,4 @@ TEST(BufferSourceTest, EmitCXXGlobalInitFunc) {
     clang::ParseAST(compiler.getSema(), false, false);
 }
 
-}
+} // namespace
diff --git a/unittests/Format/FormatTestJS.cpp b/unittests/Format/FormatTestJS.cpp
index 15d62eb66c339a9a7d5082f4ebd967d468514698..715d0cb17e3722626ac6c209a7470f2cc1bac621 100644
--- a/unittests/Format/FormatTestJS.cpp
+++ b/unittests/Format/FormatTestJS.cpp
@@ -893,5 +893,5 @@ TEST_F(FormatTestJS, IndexSignature) {
   verifyFormat("var x: {[k: string]: v};");
 }
 
-} // end namespace tooling
+} // namespace format
 } // end namespace clang
diff --git a/unittests/Format/FormatTestJava.cpp b/unittests/Format/FormatTestJava.cpp
index 4c161e0180af076eb98749e9dbea8d40b929393d..35b3b6ce2e9efa92b04f835ac8cadf8dccf56604 100644
--- a/unittests/Format/FormatTestJava.cpp
+++ b/unittests/Format/FormatTestJava.cpp
@@ -501,5 +501,5 @@ TEST_F(FormatTestJava, AlignsBlockComments) {
                    "  void f() {}"));
 }
 
-} // end namespace tooling
+} // namespace format
 } // end namespace clang
diff --git a/unittests/Format/FormatTestProto.cpp b/unittests/Format/FormatTestProto.cpp
index ac8fcbdda4fcf3a36d5f8ca44b4ab981fa75f9ba..e90c29f24cb52dfbf9440fddee0fe3ea48c29c08 100644
--- a/unittests/Format/FormatTestProto.cpp
+++ b/unittests/Format/FormatTestProto.cpp
@@ -152,5 +152,5 @@ TEST_F(FormatTestProto, FormatsService) {
                "};");
 }
 
-} // end namespace tooling
+} // namespace format
 } // end namespace clang
diff --git a/unittests/Lex/PPCallbacksTest.cpp b/unittests/Lex/PPCallbacksTest.cpp
index 94812fc93de97ef543e85bfa5e85fcc223e2991c..6ae71ebcfcf6c3b9d6067715da9141d00bef3ff6 100644
--- a/unittests/Lex/PPCallbacksTest.cpp
+++ b/unittests/Lex/PPCallbacksTest.cpp
@@ -346,4 +346,4 @@ TEST_F(PPCallbacksTest, OpenCLExtensionPragmaDisabled) {
   ASSERT_EQ(ExpectedState, Parameters.State);
 }
 
-} // anonoymous namespace
+} // namespace
diff --git a/unittests/Tooling/RefactoringCallbacksTest.cpp b/unittests/Tooling/RefactoringCallbacksTest.cpp
index c2b331c70afc66254900f3f1a8185068b57fecb2..ea4d8da92a282f1379c3b6747f53214373a96204 100644
--- a/unittests/Tooling/RefactoringCallbacksTest.cpp
+++ b/unittests/Tooling/RefactoringCallbacksTest.cpp
@@ -96,5 +96,5 @@ TEST(RefactoringCallbacksTest, RemovesEntireIfOnEmptyElse) {
       Callback);
 }
 
-} // end namespace ast_matchers
+} // namespace tooling
 } // end namespace clang
diff --git a/unittests/Tooling/TestVisitor.h b/unittests/Tooling/TestVisitor.h
index f4a00394487bcfbe0e2e4ae460947246a0e0afe5..77a42af55ab85004812b74c147690474cc227765 100644
--- a/unittests/Tooling/TestVisitor.h
+++ b/unittests/Tooling/TestVisitor.h
@@ -229,6 +229,6 @@ protected:
   std::vector<MatchCandidate> DisallowedMatches;
   std::vector<ExpectedMatch> ExpectedMatches;
 };
-}
+} // namespace clang
 
 #endif
diff --git a/unittests/libclang/LibclangTest.cpp b/unittests/libclang/LibclangTest.cpp
index e827ebc0da86bc9dd24f4f99feb95a8274bb989c..650d28b622f51fbab005d152af3d1e735ddb7ac3 100644
--- a/unittests/libclang/LibclangTest.cpp
+++ b/unittests/libclang/LibclangTest.cpp
@@ -68,7 +68,7 @@ struct TestVFO {
     clang_VirtualFileOverlay_dispose(VFO);
   }
 };
-}
+} // namespace
 
 TEST(libclang, VirtualFileOverlay_Basic) {
   const char *contents =
diff --git a/utils/TableGen/ClangAttrEmitter.cpp b/utils/TableGen/ClangAttrEmitter.cpp
index f79c4a5f92123d92c369d660cef015e73b6c7631..29727104e155ca1129167ec5f2dad0da0b00334f 100644
--- a/utils/TableGen/ClangAttrEmitter.cpp
+++ b/utils/TableGen/ClangAttrEmitter.cpp
@@ -1016,7 +1016,7 @@ namespace {
           getType(), "SA->get" + std::string(getUpperName()) + "Loc()");
     }
   };
-}
+} // namespace
 
 static std::unique_ptr<Argument>
 createArgument(const Record &Arg, StringRef Attr,
diff --git a/utils/TableGen/NeonEmitter.cpp b/utils/TableGen/NeonEmitter.cpp
index 7644ae2c04dad1910e1af7f81e9d704969f186da..4f39459929e444e074e26fcf3c2b3d0c068b53d8 100644
--- a/utils/TableGen/NeonEmitter.cpp
+++ b/utils/TableGen/NeonEmitter.cpp
@@ -89,7 +89,7 @@ enum EltType {
   Float32,
   Float64
 };
-}
+} // namespace NeonTypeFlags
 
 class Intrinsic;
 class NeonEmitter;
diff --git a/utils/TableGen/TableGen.cpp b/utils/TableGen/TableGen.cpp
index 4484e65097cfd778c7ac99bc2bd9bf2a420fbf89..d232823a5630f8149f32b90f6b11db07380e9047 100644
--- a/utils/TableGen/TableGen.cpp
+++ b/utils/TableGen/TableGen.cpp
@@ -237,7 +237,7 @@ bool ClangTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
 
   return false;
 }
-}
+} // namespace
 
 int main(int argc, char **argv) {
   sys::PrintStackTraceOnErrorSignal();