[analyzer] Refactoring: Move stuff into namespace 'GR'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122423 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Analysis/DomainSpecific/CocoaConventions.h b/include/clang/Analysis/DomainSpecific/CocoaConventions.h
index 81b71a7..0212cbf 100644
--- a/include/clang/Analysis/DomainSpecific/CocoaConventions.h
+++ b/include/clang/Analysis/DomainSpecific/CocoaConventions.h
@@ -17,6 +17,7 @@
 #include "clang/AST/Type.h"
 
 namespace clang {
+namespace GR {
 namespace cocoa {
  
   enum NamingConvention { NoConvention, CreateRule, InitRule };
@@ -34,6 +35,6 @@
   
   bool isCocoaObjectRef(QualType T);
 
-}}
+}}}
 
 #endif
diff --git a/include/clang/GR/AnalysisConsumer.h b/include/clang/GR/AnalysisConsumer.h
index c236766..8056388 100644
--- a/include/clang/GR/AnalysisConsumer.h
+++ b/include/clang/GR/AnalysisConsumer.h
@@ -12,8 +12,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_CHECKER_ANALYSISCONSUMER_H
-#define LLVM_CLANG_CHECKER_ANALYSISCONSUMER_H
+#ifndef LLVM_CLANG_GR_ANALYSISCONSUMER_H
+#define LLVM_CLANG_GR_ANALYSISCONSUMER_H
 
 #include <string>
 
@@ -23,6 +23,8 @@
 class ASTConsumer;
 class Preprocessor;
 
+namespace GR {
+
 /// CreateAnalysisConsumer - Creates an ASTConsumer to run various code
 /// analysis passes.  (The set of analyses run is controlled by command-line
 /// options.)
@@ -30,6 +32,8 @@
                                     const std::string &output,
                                     const AnalyzerOptions& Opts);
 
-}
+} // end GR namespace
+
+} // end clang namespace
 
 #endif
diff --git a/include/clang/GR/BugReporter/BugReporter.h b/include/clang/GR/BugReporter/BugReporter.h
index 0b23ae6..b0afc5f 100644
--- a/include/clang/GR/BugReporter/BugReporter.h
+++ b/include/clang/GR/BugReporter/BugReporter.h
@@ -12,8 +12,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_BUGREPORTER
-#define LLVM_CLANG_ANALYSIS_BUGREPORTER
+#ifndef LLVM_CLANG_GR_BUGREPORTER
+#define LLVM_CLANG_GR_BUGREPORTER
 
 #include "clang/Basic/SourceLocation.h"
 #include "clang/GR/PathSensitive/GRState.h"
@@ -25,20 +25,23 @@
 
 namespace clang {
 
+class ASTContext;
+class Diagnostic;
+class Stmt;
+class ParentMap;
+
+namespace GR {
+
 class PathDiagnostic;
 class PathDiagnosticPiece;
 class PathDiagnosticClient;
-class ASTContext;
-class Diagnostic;
 class ExplodedNode;
 class ExplodedGraph;
 class BugReporter;
 class BugReporterContext;
 class GRExprEngine;
 class GRState;
-class Stmt;
 class BugType;
-class ParentMap;
 
 //===----------------------------------------------------------------------===//
 // Interface for individual bug reports.
@@ -476,6 +479,8 @@
 
 //===----------------------------------------------------------------------===//
 
+} // end GR namespace
+
 } // end clang namespace
 
 #endif
diff --git a/include/clang/GR/BugReporter/BugType.h b/include/clang/GR/BugReporter/BugType.h
index 8d105bf..0ed03c5 100644
--- a/include/clang/GR/BugReporter/BugType.h
+++ b/include/clang/GR/BugReporter/BugType.h
@@ -20,6 +20,8 @@
 
 namespace clang {
 
+namespace GR {
+
 class ExplodedNode;
 class GRExprEngine;
 
@@ -68,5 +70,7 @@
   llvm::StringRef getDescription() const { return desc; }
 };
 
+} // end GR namespace
+
 } // end clang namespace
 #endif
diff --git a/include/clang/GR/BugReporter/PathDiagnostic.h b/include/clang/GR/BugReporter/PathDiagnostic.h
index 24c75ce..c19bb75 100644
--- a/include/clang/GR/BugReporter/PathDiagnostic.h
+++ b/include/clang/GR/BugReporter/PathDiagnostic.h
@@ -27,6 +27,8 @@
 class SourceManager;
 class Stmt;
 
+namespace GR {
+
 //===----------------------------------------------------------------------===//
 // High-level interface for handlers of path-sensitive diagnostics.
 //===----------------------------------------------------------------------===//
@@ -490,5 +492,9 @@
   
   void Profile(llvm::FoldingSetNodeID &ID) const;
 };  
+
+} // end GR namespace
+
 } //end clang namespace
+
 #endif
diff --git a/include/clang/GR/Checkers/DereferenceChecker.h b/include/clang/GR/Checkers/DereferenceChecker.h
index a84183e..163a4c9 100644
--- a/include/clang/GR/Checkers/DereferenceChecker.h
+++ b/include/clang/GR/Checkers/DereferenceChecker.h
@@ -13,19 +13,23 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_DEREFCHECKER
-#define LLVM_CLANG_DEREFCHECKER
+#ifndef LLVM_CLANG_GR_DEREFCHECKER
+#define LLVM_CLANG_GR_DEREFCHECKER
 
 #include <utility>
 
 namespace clang {
 
+namespace GR {
+
 class GRExprEngine;
 class ExplodedNode;
 
 std::pair<ExplodedNode * const *, ExplodedNode * const *>
 GetImplicitNullDereferences(GRExprEngine &Eng);
 
+} // end GR namespace
+
 } // end clang namespace
 
 #endif
diff --git a/include/clang/GR/Checkers/LocalCheckers.h b/include/clang/GR/Checkers/LocalCheckers.h
index 4a9e381..ddb16c1 100644
--- a/include/clang/GR/Checkers/LocalCheckers.h
+++ b/include/clang/GR/Checkers/LocalCheckers.h
@@ -12,8 +12,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_LOCALCHECKERS_H
-#define LLVM_CLANG_ANALYSIS_LOCALCHECKERS_H
+#ifndef LLVM_CLANG_GR_LOCALCHECKERS_H
+#define LLVM_CLANG_GR_LOCALCHECKERS_H
 
 namespace clang {
 
@@ -21,18 +21,21 @@
 class Decl;
 class Diagnostic;
 class ASTContext;
-class PathDiagnosticClient;
-class GRTransferFuncs;
-class BugType;
 class LangOptions;
 class ParentMap;
 class LiveVariables;
-class BugReporter;
 class ObjCImplementationDecl;
 class LangOptions;
-class GRExprEngine;
 class TranslationUnitDecl;
 
+namespace GR {
+
+class PathDiagnosticClient;
+class GRTransferFuncs;
+class BugType;
+class BugReporter;
+class GRExprEngine;
+
 void CheckDeadStores(CFG &cfg, LiveVariables &L, ParentMap &map, 
                      BugReporter& BR);
 
@@ -56,6 +59,9 @@
 void CheckSizeofPointer(const Decl *D, BugReporter &BR);
 
 void RegisterCallInliner(GRExprEngine &Eng);
+
+} // end GR namespace
+
 } // end namespace clang
 
 #endif
diff --git a/include/clang/GR/FrontendActions.h b/include/clang/GR/FrontendActions.h
index 1c0bbb7..dd4a549 100644
--- a/include/clang/GR/FrontendActions.h
+++ b/include/clang/GR/FrontendActions.h
@@ -7,13 +7,15 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_CHECKER_FRONTENDACTIONS_H
-#define LLVM_CLANG_CHECKER_FRONTENDACTIONS_H
+#ifndef LLVM_CLANG_GR_FRONTENDACTIONS_H
+#define LLVM_CLANG_GR_FRONTENDACTIONS_H
 
 #include "clang/Frontend/FrontendAction.h"
 
 namespace clang {
 
+namespace GR {
+
 //===----------------------------------------------------------------------===//
 // AST Consumer Actions
 //===----------------------------------------------------------------------===//
@@ -24,6 +26,8 @@
                                          llvm::StringRef InFile);
 };
 
-}  // end namespace clang
+} // end GR namespace
+
+} // end namespace clang
 
 #endif
diff --git a/include/clang/GR/ManagerRegistry.h b/include/clang/GR/ManagerRegistry.h
index 1266c79..30c487d 100644
--- a/include/clang/GR/ManagerRegistry.h
+++ b/include/clang/GR/ManagerRegistry.h
@@ -11,13 +11,15 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_MANAGER_REGISTRY_H
-#define LLVM_CLANG_ANALYSIS_MANAGER_REGISTRY_H
+#ifndef LLVM_CLANG_GR_MANAGER_REGISTRY_H
+#define LLVM_CLANG_GR_MANAGER_REGISTRY_H
 
 #include "clang/GR/PathSensitive/GRState.h"
 
 namespace clang {
 
+namespace GR {
+
 /// ManagerRegistry - This class records manager creators registered at
 /// runtime. The information is communicated to AnalysisManager through static
 /// members. Better design is expected.
@@ -49,5 +51,8 @@
   }
 };
 
-}
+} // end GR namespace
+
+} // end clang namespace
+
 #endif
diff --git a/include/clang/GR/PathDiagnosticClients.h b/include/clang/GR/PathDiagnosticClients.h
index a036010..612dfb1 100644
--- a/include/clang/GR/PathDiagnosticClients.h
+++ b/include/clang/GR/PathDiagnosticClients.h
@@ -11,16 +11,19 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_CHECKER_PATH_DIAGNOSTIC_CLIENTS_H
-#define LLVM_CLANG_CHECKER_PATH_DIAGNOSTIC_CLiENTS_H
+#ifndef LLVM_CLANG_GR_PATH_DIAGNOSTIC_CLIENTS_H
+#define LLVM_CLANG_GR_PATH_DIAGNOSTIC_CLiENTS_H
 
 #include <string>
 
 namespace clang {
 
-class PathDiagnosticClient;
 class Preprocessor;
 
+namespace GR {
+
+class PathDiagnosticClient;
+
 PathDiagnosticClient*
 createHTMLDiagnosticClient(const std::string& prefix, const Preprocessor &PP);
 
@@ -32,5 +35,8 @@
 createTextPathDiagnosticClient(const std::string& prefix,
                                const Preprocessor &PP);
 
+} // end GR namespace
+
 } // end clang namespace
+
 #endif
diff --git a/include/clang/GR/PathSensitive/AnalysisManager.h b/include/clang/GR/PathSensitive/AnalysisManager.h
index 42221f2..59bf416 100644
--- a/include/clang/GR/PathSensitive/AnalysisManager.h
+++ b/include/clang/GR/PathSensitive/AnalysisManager.h
@@ -12,8 +12,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_ANALYSISMANAGER_H
-#define LLVM_CLANG_ANALYSIS_ANALYSISMANAGER_H
+#ifndef LLVM_CLANG_GR_ANALYSISMANAGER_H
+#define LLVM_CLANG_GR_ANALYSISMANAGER_H
 
 #include "clang/Analysis/AnalysisContext.h"
 #include "clang/GR/BugReporter/BugReporter.h"
@@ -26,6 +26,8 @@
   class TranslationUnit; 
 }
 
+namespace GR {
+
 class AnalysisManager : public BugReporterData {
   AnalysisContextManager AnaCtxMgr;
   LocationContextManager LocCtxMgr;
@@ -199,6 +201,8 @@
   }
 };
 
-}
+} // end GR namespace
+
+} // end clang namespace
 
 #endif
diff --git a/include/clang/GR/PathSensitive/BasicValueFactory.h b/include/clang/GR/PathSensitive/BasicValueFactory.h
index 846082e..b95d7b2 100644
--- a/include/clang/GR/PathSensitive/BasicValueFactory.h
+++ b/include/clang/GR/PathSensitive/BasicValueFactory.h
@@ -13,8 +13,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_BASICVALUEFACTORY_H
-#define LLVM_CLANG_ANALYSIS_BASICVALUEFACTORY_H
+#ifndef LLVM_CLANG_GR_BASICVALUEFACTORY_H
+#define LLVM_CLANG_GR_BASICVALUEFACTORY_H
 
 #include "clang/GR/PathSensitive/SVals.h"
 #include "clang/AST/ASTContext.h"
@@ -24,6 +24,8 @@
 
 namespace clang {
 
+namespace GR {
+
   class GRState;
 
 class CompoundValData : public llvm::FoldingSetNode {
@@ -192,6 +194,8 @@
   const SVal* getPersistentSVal(SVal X);
 };
 
+} // end GR namespace
+
 } // end clang namespace
 
 #endif
diff --git a/include/clang/GR/PathSensitive/Checker.h b/include/clang/GR/PathSensitive/Checker.h
index 4e4cd58..ac3fb18 100644
--- a/include/clang/GR/PathSensitive/Checker.h
+++ b/include/clang/GR/PathSensitive/Checker.h
@@ -12,8 +12,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_CHECKER
-#define LLVM_CLANG_ANALYSIS_CHECKER
+#ifndef LLVM_CLANG_GR_CHECKER
+#define LLVM_CLANG_GR_CHECKER
 
 #include "clang/Analysis/Support/SaveAndRestore.h"
 #include "clang/GR/PathSensitive/GRExprEngine.h"
@@ -24,6 +24,8 @@
 
 namespace clang {
 
+namespace GR {
+
 class CheckerContext {
   ExplodedNodeSet &Dst;
   GRStmtNodeBuilder &B;
@@ -298,6 +300,9 @@
   virtual void VisitEndAnalysis(ExplodedGraph &G, BugReporter &B,
                                 GRExprEngine &Eng) {}
 };
+
+} // end GR namespace
+
 } // end clang namespace
 
 #endif
diff --git a/include/clang/GR/PathSensitive/CheckerHelpers.h b/include/clang/GR/PathSensitive/CheckerHelpers.h
index ea3c842..7afd67d 100644
--- a/include/clang/GR/PathSensitive/CheckerHelpers.h
+++ b/include/clang/GR/PathSensitive/CheckerHelpers.h
@@ -11,13 +11,15 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_CHECKER_PATHSENSITIVE_CHECKERHELPERS
-#define LLVM_CLANG_CHECKER_PATHSENSITIVE_CHECKERHELPERS
+#ifndef LLVM_CLANG_GR_PATHSENSITIVE_CHECKERHELPERS
+#define LLVM_CLANG_GR_PATHSENSITIVE_CHECKERHELPERS
 
 #include "clang/AST/Stmt.h"
 
 namespace clang {
 
+namespace GR {
+
 bool containsMacro(const Stmt *S);
 bool containsEnum(const Stmt *S);
 bool containsStaticLocal(const Stmt *S);
@@ -35,6 +37,8 @@
   return false;
 }
 
-}
+} // end GR namespace
+
+} // end clang namespace
 
 #endif
diff --git a/include/clang/GR/PathSensitive/CheckerVisitor.h b/include/clang/GR/PathSensitive/CheckerVisitor.h
index 9980ac9..26f85d7 100644
--- a/include/clang/GR/PathSensitive/CheckerVisitor.h
+++ b/include/clang/GR/PathSensitive/CheckerVisitor.h
@@ -11,12 +11,14 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_CHECKERVISITOR
-#define LLVM_CLANG_ANALYSIS_CHECKERVISITOR
+#ifndef LLVM_CLANG_GR_CHECKERVISITOR
+#define LLVM_CLANG_GR_CHECKERVISITOR
 #include "clang/GR/PathSensitive/Checker.h"
 
 namespace clang {
 
+namespace GR {
+
 //===----------------------------------------------------------------------===//
 // Checker visitor interface.  Used by subclasses of Checker to specify their
 // own checker visitor logic.
@@ -102,6 +104,8 @@
 #include "clang/GR/PathSensitive/CheckerVisitor.def"
 };
 
+} // end GR namespace
+
 } // end clang namespace
 
 #endif
diff --git a/include/clang/GR/PathSensitive/ConstraintManager.h b/include/clang/GR/PathSensitive/ConstraintManager.h
index c845a44..38d4293 100644
--- a/include/clang/GR/PathSensitive/ConstraintManager.h
+++ b/include/clang/GR/PathSensitive/ConstraintManager.h
@@ -11,8 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_CONSTRAINT_MANAGER_H
-#define LLVM_CLANG_ANALYSIS_CONSTRAINT_MANAGER_H
+#ifndef LLVM_CLANG_GR_CONSTRAINT_MANAGER_H
+#define LLVM_CLANG_GR_CONSTRAINT_MANAGER_H
 
 // FIXME: Typedef LiveSymbolsTy/DeadSymbolsTy at a more appropriate place.
 #include "clang/GR/PathSensitive/Store.h"
@@ -23,6 +23,8 @@
 
 namespace clang {
 
+namespace GR {
+
 class GRState;
 class GRStateManager;
 class GRSubEngine;
@@ -67,6 +69,8 @@
 ConstraintManager* CreateRangeConstraintManager(GRStateManager& statemgr,
                                                 GRSubEngine &subengine);
 
+} // end GR namespace
+
 } // end clang namespace
 
 #endif
diff --git a/include/clang/GR/PathSensitive/Environment.h b/include/clang/GR/PathSensitive/Environment.h
index 46996ba..36f26e0 100644
--- a/include/clang/GR/PathSensitive/Environment.h
+++ b/include/clang/GR/PathSensitive/Environment.h
@@ -11,8 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_ENVIRONMENT_H
-#define LLVM_CLANG_ANALYSIS_ENVIRONMENT_H
+#ifndef LLVM_CLANG_GR_ENVIRONMENT_H
+#define LLVM_CLANG_GR_ENVIRONMENT_H
 
 #include "clang/GR/PathSensitive/Store.h"
 #include "clang/GR/PathSensitive/SVals.h"
@@ -20,9 +20,12 @@
 
 namespace clang {
 
+class LiveVariables;
+
+namespace GR {
+
 class EnvironmentManager;
 class SValBuilder;
-class LiveVariables;
 
 /// Environment - An immutable map from Stmts to their current
 ///  symbolic values (SVals).
@@ -96,6 +99,8 @@
                           llvm::SmallVectorImpl<const MemRegion*>& RegionRoots);
 };
 
+} // end GR namespace
+
 } // end clang namespace
 
 #endif
diff --git a/include/clang/GR/PathSensitive/ExplodedGraph.h b/include/clang/GR/PathSensitive/ExplodedGraph.h
index c875a23..778d509 100644
--- a/include/clang/GR/PathSensitive/ExplodedGraph.h
+++ b/include/clang/GR/PathSensitive/ExplodedGraph.h
@@ -16,8 +16,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_EXPLODEDGRAPH
-#define LLVM_CLANG_ANALYSIS_EXPLODEDGRAPH
+#ifndef LLVM_CLANG_GR_EXPLODEDGRAPH
+#define LLVM_CLANG_GR_EXPLODEDGRAPH
 
 #include "clang/Analysis/ProgramPoint.h"
 #include "clang/Analysis/AnalysisContext.h"
@@ -34,8 +34,11 @@
 
 namespace clang {
 
-class GRState;
 class CFG;
+
+namespace GR {
+
+class GRState;
 class ExplodedGraph;
 
 //===----------------------------------------------------------------------===//
@@ -368,13 +371,15 @@
   inline const_iterator end()   const { return Impl.end();   }
 };
 
+} // end GR namespace
+
 } // end clang namespace
 
 // GraphTraits
 
 namespace llvm {
-  template<> struct GraphTraits<clang::ExplodedNode*> {
-    typedef clang::ExplodedNode NodeType;
+  template<> struct GraphTraits<clang::GR::ExplodedNode*> {
+    typedef clang::GR::ExplodedNode NodeType;
     typedef NodeType::succ_iterator  ChildIteratorType;
     typedef llvm::df_iterator<NodeType*>      nodes_iterator;
 
@@ -399,8 +404,8 @@
     }
   };
 
-  template<> struct GraphTraits<const clang::ExplodedNode*> {
-    typedef const clang::ExplodedNode NodeType;
+  template<> struct GraphTraits<const clang::GR::ExplodedNode*> {
+    typedef const clang::GR::ExplodedNode NodeType;
     typedef NodeType::const_succ_iterator   ChildIteratorType;
     typedef llvm::df_iterator<NodeType*>       nodes_iterator;
 
diff --git a/include/clang/GR/PathSensitive/GRBlockCounter.h b/include/clang/GR/PathSensitive/GRBlockCounter.h
index b7d0e8a..7abc034 100644
--- a/include/clang/GR/PathSensitive/GRBlockCounter.h
+++ b/include/clang/GR/PathSensitive/GRBlockCounter.h
@@ -13,8 +13,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_GRBLOCKCOUNTER
-#define LLVM_CLANG_ANALYSIS_GRBLOCKCOUNTER
+#ifndef LLVM_CLANG_GR_GRBLOCKCOUNTER
+#define LLVM_CLANG_GR_GRBLOCKCOUNTER
 
 namespace llvm {
   class BumpPtrAllocator;
@@ -24,6 +24,8 @@
 
 class StackFrameContext;
 
+namespace GR {
+
 class GRBlockCounter {
   void* Data;
 
@@ -50,6 +52,8 @@
   friend class Factory;
 };
 
+} // end GR namespace
+
 } // end clang namespace
 
 #endif
diff --git a/include/clang/GR/PathSensitive/GRCoreEngine.h b/include/clang/GR/PathSensitive/GRCoreEngine.h
index 882c825..79e4827 100644
--- a/include/clang/GR/PathSensitive/GRCoreEngine.h
+++ b/include/clang/GR/PathSensitive/GRCoreEngine.h
@@ -12,8 +12,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_GRENGINE
-#define LLVM_CLANG_ANALYSIS_GRENGINE
+#ifndef LLVM_CLANG_GR_GRENGINE
+#define LLVM_CLANG_GR_GRENGINE
 
 #include "clang/AST/Expr.h"
 #include "clang/GR/PathSensitive/ExplodedGraph.h"
@@ -24,6 +24,8 @@
 
 namespace clang {
 
+namespace GR {
+
 //===----------------------------------------------------------------------===//
 /// GRCoreEngine - Implements the core logic of the graph-reachability
 ///   analysis. It traverses the CFG and generates the ExplodedGraph.
@@ -532,6 +534,9 @@
 
   void generateNode(const GRState *state);
 }; 
+
+} // end GR namespace
+
 } // end clang namespace
 
 #endif
diff --git a/include/clang/GR/PathSensitive/GRExprEngine.h b/include/clang/GR/PathSensitive/GRExprEngine.h
index ee0ad8b..8498065 100644
--- a/include/clang/GR/PathSensitive/GRExprEngine.h
+++ b/include/clang/GR/PathSensitive/GRExprEngine.h
@@ -13,8 +13,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_GREXPRENGINE
-#define LLVM_CLANG_ANALYSIS_GREXPRENGINE
+#ifndef LLVM_CLANG_GR_GREXPRENGINE
+#define LLVM_CLANG_GR_GREXPRENGINE
 
 #include "clang/GR/PathSensitive/AnalysisManager.h"
 #include "clang/GR/PathSensitive/GRSubEngine.h"
@@ -28,9 +28,13 @@
 #include "clang/AST/StmtObjC.h"
 
 namespace clang {
+
+class ObjCForCollectionStmt;
+
+namespace GR {
+
 class AnalysisManager;
 class Checker;
-class ObjCForCollectionStmt;
 
 class GRExprEngine : public GRSubEngine {
   AnalysisManager &AMgr;
@@ -533,6 +537,8 @@
   bool InlineCall(ExplodedNodeSet &Dst, const CallExpr *CE, ExplodedNode *Pred);
 };
 
+} // end GR namespace
+
 } // end clang namespace
 
 #endif
diff --git a/include/clang/GR/PathSensitive/GRExprEngineBuilders.h b/include/clang/GR/PathSensitive/GRExprEngineBuilders.h
index 052893c..bb104f4 100644
--- a/include/clang/GR/PathSensitive/GRExprEngineBuilders.h
+++ b/include/clang/GR/PathSensitive/GRExprEngineBuilders.h
@@ -12,13 +12,15 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_GREXPRENGINE_BUILDERS
-#define LLVM_CLANG_ANALYSIS_GREXPRENGINE_BUILDERS
+#ifndef LLVM_CLANG_GR_GREXPRENGINE_BUILDERS
+#define LLVM_CLANG_GR_GREXPRENGINE_BUILDERS
 #include "clang/GR/PathSensitive/GRExprEngine.h"
 #include "clang/Analysis/Support/SaveAndRestore.h"
 
 namespace clang {
 
+namespace GR {
+
 class GRStmtNodeBuilderRef {
   ExplodedNodeSet &Dst;
   GRStmtNodeBuilder &B;
@@ -72,5 +74,8 @@
   }
 };
 
+} // end GR namespace
+
 } // end clang namespace
+
 #endif
diff --git a/include/clang/GR/PathSensitive/GRState.h b/include/clang/GR/PathSensitive/GRState.h
index 5212615..4dfa65b 100644
--- a/include/clang/GR/PathSensitive/GRState.h
+++ b/include/clang/GR/PathSensitive/GRState.h
@@ -11,8 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_VALUESTATE_H
-#define LLVM_CLANG_ANALYSIS_VALUESTATE_H
+#ifndef LLVM_CLANG_GR_VALUESTATE_H
+#define LLVM_CLANG_GR_VALUESTATE_H
 
 #include "clang/GR/PathSensitive/ConstraintManager.h"
 #include "clang/GR/PathSensitive/Environment.h"
@@ -30,6 +30,9 @@
 
 namespace clang {
 class ASTContext;
+
+namespace GR {
+
 class GRStateManager;
 class Checker;
 
@@ -749,6 +752,9 @@
   scanReachableSymbols(beg, end, cb);
   return cb;
 }
+
+} // end GR namespace
+
 } // end clang namespace
 
 #endif
diff --git a/include/clang/GR/PathSensitive/GRStateTrait.h b/include/clang/GR/PathSensitive/GRStateTrait.h
index 25be33f..5c17392 100644
--- a/include/clang/GR/PathSensitive/GRStateTrait.h
+++ b/include/clang/GR/PathSensitive/GRStateTrait.h
@@ -14,8 +14,8 @@
 //===----------------------------------------------------------------------===//
 
 
-#ifndef LLVM_CLANG_ANALYSIS_GRSTATETRAIT_H
-#define LLVM_CLANG_ANALYSIS_GRSTATETRAIT_H
+#ifndef LLVM_CLANG_GR_GRSTATETRAIT_H
+#define LLVM_CLANG_GR_GRSTATETRAIT_H
 
 namespace llvm {
   class BumpPtrAllocator;
@@ -26,6 +26,8 @@
 }
 
 namespace clang {
+
+namespace GR {
   template <typename T> struct GRStatePartialTrait;
 
   // Partial-specialization for ImmutableMap.
@@ -143,6 +145,8 @@
       delete (typename data_type::Factory*) Ctx;
     }
   };
+} // end GR namespace
+
 } // end clang namespace
 
 #endif
diff --git a/include/clang/GR/PathSensitive/GRSubEngine.h b/include/clang/GR/PathSensitive/GRSubEngine.h
index bba44ab..5c74968 100644
--- a/include/clang/GR/PathSensitive/GRSubEngine.h
+++ b/include/clang/GR/PathSensitive/GRSubEngine.h
@@ -10,16 +10,21 @@
 // This file defines the interface of a subengine of the GRCoreEngine.
 //
 //===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_ANALYSIS_GRSUBENGINE_H
-#define LLVM_CLANG_ANALYSIS_GRSUBENGINE_H
+#ifndef LLVM_CLANG_GR_GRSUBENGINE_H
+#define LLVM_CLANG_GR_GRSUBENGINE_H
 
 #include "clang/GR/PathSensitive/SVals.h"
 
 namespace clang {
 
-class AnalysisManager;
 class CFGBlock;
 class CFGElement;
+class LocationContext;
+class Stmt;
+
+namespace GR {
+
+class AnalysisManager;
 class ExplodedNode;
 class GRState;
 class GRStateManager;
@@ -31,9 +36,7 @@
 class GREndPathNodeBuilder;
 class GRCallEnterNodeBuilder;
 class GRCallExitNodeBuilder;
-class LocationContext;
 class MemRegion;
-class Stmt;
 
 class GRSubEngine {
 public:
@@ -102,6 +105,9 @@
   //  maximum number of analysis steps have been reached.
   virtual void ProcessEndWorklist(bool hasWorkRemaining) = 0;
 };
-}
+
+} // end GR namespace
+
+} // end clang namespace
 
 #endif
diff --git a/include/clang/GR/PathSensitive/GRTransferFuncs.h b/include/clang/GR/PathSensitive/GRTransferFuncs.h
index 9e509df..268f168 100644
--- a/include/clang/GR/PathSensitive/GRTransferFuncs.h
+++ b/include/clang/GR/PathSensitive/GRTransferFuncs.h
@@ -12,21 +12,23 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_GRTF
-#define LLVM_CLANG_ANALYSIS_GRTF
+#ifndef LLVM_CLANG_GR_TRANSFERFUNCS
+#define LLVM_CLANG_GR_TRANSFERFUNCS
 
 #include "clang/GR/PathSensitive/GRState.h"
 #include "clang/GR/PathSensitive/SVals.h"
 #include <vector>
 
 namespace clang {
+class ObjCMessageExpr;
+
+namespace GR {
 class ExplodedNode;
 class ExplodedNodeSet;
 class GREndPathNodeBuilder;
 class GRExprEngine;
 class GRStmtNodeBuilder;
 class GRStmtNodeBuilderRef;
-class ObjCMessageExpr;
 
 class GRTransferFuncs {
 public:
@@ -82,6 +84,9 @@
     return state;
   }  
 };
+
+} // end GR namespace
+
 } // end clang namespace
 
 #endif
diff --git a/include/clang/GR/PathSensitive/GRWorkList.h b/include/clang/GR/PathSensitive/GRWorkList.h
index 062df94..87a3b36 100644
--- a/include/clang/GR/PathSensitive/GRWorkList.h
+++ b/include/clang/GR/PathSensitive/GRWorkList.h
@@ -12,8 +12,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_GRWORKLIST
-#define LLVM_CLANG_ANALYSIS_GRWORKLIST
+#ifndef LLVM_CLANG_GR_GRWORKLIST
+#define LLVM_CLANG_GR_GRWORKLIST
 
 #include "clang/GR/PathSensitive/GRBlockCounter.h"
 #include <cstddef>
@@ -21,6 +21,9 @@
 namespace clang {
   
 class CFGBlock;
+
+namespace GR {
+
 class ExplodedNode;
 class ExplodedNodeImpl;
 
@@ -83,5 +86,9 @@
   static GRWorkList *MakeBFS();
   static GRWorkList *MakeBFSBlockDFSContents();
 };
+
+} // end GR namespace
+
 } // end clang namespace
+
 #endif
diff --git a/include/clang/GR/PathSensitive/MemRegion.h b/include/clang/GR/PathSensitive/MemRegion.h
index 348acbd..59e8060 100644
--- a/include/clang/GR/PathSensitive/MemRegion.h
+++ b/include/clang/GR/PathSensitive/MemRegion.h
@@ -13,8 +13,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_MEMREGION_H
-#define LLVM_CLANG_ANALYSIS_MEMREGION_H
+#ifndef LLVM_CLANG_GR_MEMREGION_H
+#define LLVM_CLANG_GR_MEMREGION_H
 
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclObjC.h"
@@ -31,10 +31,13 @@
 
 namespace clang {
 
-class MemRegionManager;
-class MemSpaceRegion;
 class LocationContext;
 class StackFrameContext;
+
+namespace GR {
+
+class MemRegionManager;
+class MemSpaceRegion;
 class SValBuilder;
 class VarRegion;
 class CodeTextRegion;
@@ -1055,6 +1058,8 @@
   return getMemRegionManager()->getContext();
 }
   
+} // end GR namespace
+
 } // end clang namespace
 
 //===----------------------------------------------------------------------===//
@@ -1063,7 +1068,7 @@
 
 namespace llvm {
 static inline raw_ostream& operator<<(raw_ostream& os,
-                                      const clang::MemRegion* R) {
+                                      const clang::GR::MemRegion* R) {
   R->dumpToStream(os);
   return os;
 }
diff --git a/include/clang/GR/PathSensitive/SValBuilder.h b/include/clang/GR/PathSensitive/SValBuilder.h
index 1b5fac3..2869a2f 100644
--- a/include/clang/GR/PathSensitive/SValBuilder.h
+++ b/include/clang/GR/PathSensitive/SValBuilder.h
@@ -12,8 +12,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_SVALBUILDER
-#define LLVM_CLANG_ANALYSIS_SVALBUILDER
+#ifndef LLVM_CLANG_GR_SVALBUILDER
+#define LLVM_CLANG_GR_SVALBUILDER
 
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
@@ -23,6 +23,8 @@
 
 namespace clang {
 
+namespace GR {
+
 class GRState;
 
 class SValBuilder {
@@ -242,5 +244,8 @@
                                      ASTContext &context,
                                      GRStateManager &stateMgr);
 
+} // end GR namespace
+
 } // end clang namespace
+
 #endif
diff --git a/include/clang/GR/PathSensitive/SVals.h b/include/clang/GR/PathSensitive/SVals.h
index 336093a..2081461 100644
--- a/include/clang/GR/PathSensitive/SVals.h
+++ b/include/clang/GR/PathSensitive/SVals.h
@@ -12,8 +12,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_RVALUE_H
-#define LLVM_CLANG_ANALYSIS_RVALUE_H
+#ifndef LLVM_CLANG_GR_RVALUE_H
+#define LLVM_CLANG_GR_RVALUE_H
 
 #include "clang/GR/PathSensitive/SymbolManager.h"
 #include "llvm/Support/Casting.h"
@@ -29,6 +29,8 @@
 
 namespace clang {
 
+namespace GR {
+
 class CompoundValData;
 class LazyCompoundValData;
 class GRState;
@@ -340,7 +342,7 @@
 };
 
 class LocAsInteger : public NonLoc {
-  friend class clang::SValBuilder;
+  friend class GR::SValBuilder;
 
   explicit LocAsInteger(const std::pair<SVal, uintptr_t>& data) :
     NonLoc(LocAsIntegerKind, &data) {
@@ -374,7 +376,7 @@
 };
 
 class CompoundVal : public NonLoc {
-  friend class clang::SValBuilder;
+  friend class GR::SValBuilder;
 
   explicit CompoundVal(const CompoundValData* D) : NonLoc(CompoundValKind, D) {}
 
@@ -397,7 +399,7 @@
 };
 
 class LazyCompoundVal : public NonLoc {
-  friend class clang::SValBuilder;
+  friend class GR::SValBuilder;
 
   explicit LazyCompoundVal(const LazyCompoundValData *D)
     : NonLoc(LazyCompoundValKind, D) {}
@@ -417,7 +419,7 @@
   }
 };
 
-} // end namespace clang::nonloc
+} // end namespace GR::nonloc
 
 //==------------------------------------------------------------------------==//
 //  Subclasses of Loc.
@@ -503,14 +505,18 @@
   }
 };
 
-} // end clang::loc namespace
+} // end GR::loc namespace
+} // end GR namespace
+
 } // end clang namespace
 
 namespace llvm {
 static inline llvm::raw_ostream& operator<<(llvm::raw_ostream& os,
-                                            clang::SVal V) {
+                                            clang::GR::SVal V) {
   V.dumpToStream(os);
   return os;
 }
+
 } // end llvm namespace
+
 #endif
diff --git a/include/clang/GR/PathSensitive/Store.h b/include/clang/GR/PathSensitive/Store.h
index 0899799..34f2b4d 100644
--- a/include/clang/GR/PathSensitive/Store.h
+++ b/include/clang/GR/PathSensitive/Store.h
@@ -11,8 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_STORE_H
-#define LLVM_CLANG_ANALYSIS_STORE_H
+#ifndef LLVM_CLANG_GR_STORE_H
+#define LLVM_CLANG_GR_STORE_H
 
 #include "clang/GR/PathSensitive/MemRegion.h"
 #include "clang/GR/PathSensitive/SValBuilder.h"
@@ -21,6 +21,13 @@
 
 namespace clang {
 
+class Stmt;
+class Expr;
+class ObjCIvarDecl;
+class StackFrameContext;
+
+namespace GR {
+
 /// Store - This opaque type encapsulates an immutable mapping from
 ///  locations to values.  At a high-level, it represents the symbolic
 ///  memory model.  Different subclasses of StoreManager may choose
@@ -29,11 +36,7 @@
 
 class GRState;
 class GRStateManager;
-class Stmt;
-class Expr;
-class ObjCIvarDecl;
 class SubRegionMap;
-class StackFrameContext;
 
 class StoreManager {
 protected:
@@ -248,6 +251,9 @@
 StoreManager *CreateRegionStoreManager(GRStateManager& StMgr);
 StoreManager *CreateFieldsOnlyRegionStoreManager(GRStateManager& StMgr);
 StoreManager *CreateFlatStoreManager(GRStateManager &StMgr);
+
+} // end GR namespace
+
 } // end clang namespace
 
 #endif
diff --git a/include/clang/GR/PathSensitive/SummaryManager.h b/include/clang/GR/PathSensitive/SummaryManager.h
index fd23189..8f01ce2 100644
--- a/include/clang/GR/PathSensitive/SummaryManager.h
+++ b/include/clang/GR/PathSensitive/SummaryManager.h
@@ -12,14 +12,16 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_CHECKER_SUMMARY
-#define LLVM_CLANG_CHECKER_SUMMARY
+#ifndef LLVM_CLANG_GR_SUMMARY
+#define LLVM_CLANG_GR_SUMMARY
 
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/Support/Allocator.h"
 
 namespace clang {
 
+namespace GR {
+
 namespace summMgr {
 
   
@@ -52,6 +54,8 @@
   
 };
 
+} // end GR namespace
+
 } // end clang namespace
 
 #endif
diff --git a/include/clang/GR/PathSensitive/SymbolManager.h b/include/clang/GR/PathSensitive/SymbolManager.h
index 948795b..045534b 100644
--- a/include/clang/GR/PathSensitive/SymbolManager.h
+++ b/include/clang/GR/PathSensitive/SymbolManager.h
@@ -12,8 +12,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_SYMMGR_H
-#define LLVM_CLANG_ANALYSIS_SYMMGR_H
+#ifndef LLVM_CLANG_GR_SYMMGR_H
+#define LLVM_CLANG_GR_SYMMGR_H
 
 #include "clang/AST/Decl.h"
 #include "clang/AST/Expr.h"
@@ -29,12 +29,14 @@
 
 namespace clang {
   class ASTContext;
+  class StackFrameContext;
+
+namespace GR {
   class BasicValueFactory;
   class MemRegion;
   class SubRegion;
   class TypedRegion;
   class VarRegion;
-  class StackFrameContext;
 
 class SymExpr : public llvm::FoldingSetNode {
 public:
@@ -473,11 +475,13 @@
   virtual ~SymbolVisitor();
 };
 
+} // end GR namespace
+
 } // end clang namespace
 
 namespace llvm {
 static inline llvm::raw_ostream& operator<<(llvm::raw_ostream& os,
-                                            const clang::SymExpr *SE) {
+                                            const clang::GR::SymExpr *SE) {
   SE->dumpToStream(os);
   return os;
 }
diff --git a/lib/Analysis/CocoaConventions.cpp b/lib/Analysis/CocoaConventions.cpp
index ad359aa..5fb58de 100644
--- a/lib/Analysis/CocoaConventions.cpp
+++ b/lib/Analysis/CocoaConventions.cpp
@@ -18,6 +18,7 @@
 #include "llvm/ADT/StringExtras.h"
 
 using namespace clang;
+using namespace GR;
 
 using llvm::StringRef;
 
diff --git a/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/lib/FrontendTool/ExecuteCompilerInvocation.cpp
index ed9ff75..84bebf5 100644
--- a/lib/FrontendTool/ExecuteCompilerInvocation.cpp
+++ b/lib/FrontendTool/ExecuteCompilerInvocation.cpp
@@ -80,7 +80,7 @@
   case RewriteMacros:          return new RewriteMacrosAction();
   case RewriteObjC:            return new RewriteObjCAction();
   case RewriteTest:            return new RewriteTestAction();
-  case RunAnalysis:            return new AnalysisAction();
+  case RunAnalysis:            return new GR::AnalysisAction();
   case RunPreprocessorOnly:    return new PreprocessOnlyAction();
   }
 }
diff --git a/lib/GR/AggExprVisitor.cpp b/lib/GR/AggExprVisitor.cpp
index b8ec92f..7f873bc 100644
--- a/lib/GR/AggExprVisitor.cpp
+++ b/lib/GR/AggExprVisitor.cpp
@@ -16,6 +16,7 @@
 #include "clang/AST/StmtVisitor.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 /// AggExprVisitor is designed after AggExprEmitter of the CodeGen module.  It
diff --git a/lib/GR/AnalysisConsumer.cpp b/lib/GR/AnalysisConsumer.cpp
index 850a440..0b28451 100644
--- a/lib/GR/AnalysisConsumer.cpp
+++ b/lib/GR/AnalysisConsumer.cpp
@@ -43,6 +43,7 @@
 #include "llvm/ADT/OwningPtr.h"
 
 using namespace clang;
+using namespace GR;
 
 static ExplodedNode::Auditor* CreateUbiViz();
 
@@ -473,7 +474,7 @@
 // AnalysisConsumer creation.
 //===----------------------------------------------------------------------===//
 
-ASTConsumer* clang::CreateAnalysisConsumer(const Preprocessor& pp,
+ASTConsumer* GR::CreateAnalysisConsumer(const Preprocessor& pp,
                                            const std::string& OutDir,
                                            const AnalyzerOptions& Opts) {
   llvm::OwningPtr<AnalysisConsumer> C(new AnalysisConsumer(pp, OutDir, Opts));
diff --git a/lib/GR/AnalysisManager.cpp b/lib/GR/AnalysisManager.cpp
index 736cf1d..b0942e1 100644
--- a/lib/GR/AnalysisManager.cpp
+++ b/lib/GR/AnalysisManager.cpp
@@ -12,6 +12,7 @@
 #include "clang/Index/Indexer.h"
 
 using namespace clang;
+using namespace GR;
 
 AnalysisContext *
 AnalysisManager::getAnalysisContextInAnotherTU(const Decl *D) {
diff --git a/lib/GR/AnalyzerStatsChecker.cpp b/lib/GR/AnalyzerStatsChecker.cpp
index 2aa1515..cc9fcb7 100644
--- a/lib/GR/AnalyzerStatsChecker.cpp
+++ b/lib/GR/AnalyzerStatsChecker.cpp
@@ -20,6 +20,7 @@
 #include "llvm/ADT/SmallPtrSet.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class AnalyzerStatsChecker : public CheckerVisitor<AnalyzerStatsChecker> {
@@ -37,7 +38,7 @@
   return &x;
 }
 
-void clang::RegisterAnalyzerStatsChecker(GRExprEngine &Eng) {
+void GR::RegisterAnalyzerStatsChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new AnalyzerStatsChecker());
 }
 
diff --git a/lib/GR/BasicConstraintManager.cpp b/lib/GR/BasicConstraintManager.cpp
index 0166968..ac289b8 100644
--- a/lib/GR/BasicConstraintManager.cpp
+++ b/lib/GR/BasicConstraintManager.cpp
@@ -19,6 +19,7 @@
 #include "llvm/Support/raw_ostream.h"
 
 using namespace clang;
+using namespace GR;
 
 
 namespace { class ConstNotEq {}; }
@@ -31,6 +32,7 @@
 static int ConstNotEqIndex = 0;
 
 namespace clang {
+namespace GR {
 template<>
 struct GRStateTrait<ConstNotEq> : public GRStatePartialTrait<ConstNotEqTy> {
   static inline void* GDMIndex() { return &ConstNotEqIndex; }
@@ -41,6 +43,7 @@
   static inline void* GDMIndex() { return &ConstEqIndex; }
 };
 }
+}
 
 namespace {
 // BasicConstraintManager only tracks equality and inequality constraints of
@@ -95,7 +98,7 @@
 
 } // end anonymous namespace
 
-ConstraintManager* clang::CreateBasicConstraintManager(GRStateManager& statemgr,
+ConstraintManager* GR::CreateBasicConstraintManager(GRStateManager& statemgr,
                                                        GRSubEngine &subengine) {
   return new BasicConstraintManager(statemgr, subengine);
 }
diff --git a/lib/GR/BasicStore.cpp b/lib/GR/BasicStore.cpp
index e9e85b9..2a673e2 100644
--- a/lib/GR/BasicStore.cpp
+++ b/lib/GR/BasicStore.cpp
@@ -19,6 +19,7 @@
 #include "llvm/ADT/ImmutableMap.h"
 
 using namespace clang;
+using namespace GR;
 
 typedef llvm::ImmutableMap<const MemRegion*,SVal> BindingsTy;
 
@@ -103,7 +104,7 @@
 } // end anonymous namespace
 
 
-StoreManager* clang::CreateBasicStoreManager(GRStateManager& StMgr) {
+StoreManager* GR::CreateBasicStoreManager(GRStateManager& StMgr) {
   return new BasicStoreManager(StMgr);
 }
 
diff --git a/lib/GR/BasicValueFactory.cpp b/lib/GR/BasicValueFactory.cpp
index 9352816..6e94a2a 100644
--- a/lib/GR/BasicValueFactory.cpp
+++ b/lib/GR/BasicValueFactory.cpp
@@ -16,6 +16,7 @@
 #include "clang/GR/PathSensitive/BasicValueFactory.h"
 
 using namespace clang;
+using namespace GR;
 
 void CompoundValData::Profile(llvm::FoldingSetNodeID& ID, QualType T,
                               llvm::ImmutableList<SVal> L) {
diff --git a/lib/GR/BugReporter.cpp b/lib/GR/BugReporter.cpp
index 41381d7..4321823 100644
--- a/lib/GR/BugReporter.cpp
+++ b/lib/GR/BugReporter.cpp
@@ -30,6 +30,7 @@
 #include <queue>
 
 using namespace clang;
+using namespace GR;
 
 BugReporterVisitor::~BugReporterVisitor() {}
 BugReporterContext::~BugReporterContext() {
diff --git a/lib/GR/BugReporterVisitors.cpp b/lib/GR/BugReporterVisitors.cpp
index 6641006..f56d053 100644
--- a/lib/GR/BugReporterVisitors.cpp
+++ b/lib/GR/BugReporterVisitors.cpp
@@ -20,12 +20,13 @@
 #include "clang/GR/PathSensitive/GRState.h"
 
 using namespace clang;
+using namespace GR;
 
 //===----------------------------------------------------------------------===//
 // Utility functions.
 //===----------------------------------------------------------------------===//
 
-const Stmt *clang::bugreporter::GetDerefExpr(const ExplodedNode *N) {
+const Stmt *bugreporter::GetDerefExpr(const ExplodedNode *N) {
   // Pattern match for a few useful cases (do something smarter later):
   //   a[0], p->f, *p
   const Stmt *S = N->getLocationAs<PostStmt>()->getStmt();
@@ -46,16 +47,14 @@
   return NULL;
 }
 
-const Stmt*
-clang::bugreporter::GetDenomExpr(const ExplodedNode *N) {
+const Stmt *bugreporter::GetDenomExpr(const ExplodedNode *N) {
   const Stmt *S = N->getLocationAs<PreStmt>()->getStmt();
   if (const BinaryOperator *BE = dyn_cast<BinaryOperator>(S))
     return BE->getRHS();
   return NULL;
 }
 
-const Stmt*
-clang::bugreporter::GetCalleeExpr(const ExplodedNode *N) {
+const Stmt *bugreporter::GetCalleeExpr(const ExplodedNode *N) {
   // Callee is checked as a PreVisit to the CallExpr.
   const Stmt *S = N->getLocationAs<PreStmt>()->getStmt();
   if (const CallExpr *CE = dyn_cast<CallExpr>(S))
@@ -63,8 +62,7 @@
   return NULL;
 }
 
-const Stmt*
-clang::bugreporter::GetRetValExpr(const ExplodedNode *N) {
+const Stmt *bugreporter::GetRetValExpr(const ExplodedNode *N) {
   const Stmt *S = N->getLocationAs<PostStmt>()->getStmt();
   if (const ReturnStmt *RS = dyn_cast<ReturnStmt>(S))
     return RS->getRetValue();
@@ -306,9 +304,9 @@
   BRC.addVisitor(new TrackConstraintBRVisitor(Constraint, Assumption));
 }
 
-void clang::bugreporter::registerTrackNullOrUndefValue(BugReporterContext& BRC,
-                                                       const void *data,
-                                                       const ExplodedNode* N) {
+void bugreporter::registerTrackNullOrUndefValue(BugReporterContext& BRC,
+                                                const void *data,
+                                                const ExplodedNode* N) {
 
   const Stmt *S = static_cast<const Stmt*>(data);
 
@@ -354,9 +352,9 @@
   }
 }
 
-void clang::bugreporter::registerFindLastStore(BugReporterContext& BRC,
-                                               const void *data,
-                                               const ExplodedNode* N) {
+void bugreporter::registerFindLastStore(BugReporterContext& BRC,
+                                        const void *data,
+                                        const ExplodedNode* N) {
 
   const MemRegion *R = static_cast<const MemRegion*>(data);
 
@@ -417,12 +415,12 @@
 };
 } // end anonymous namespace
 
-void clang::bugreporter::registerNilReceiverVisitor(BugReporterContext &BRC) {
+void bugreporter::registerNilReceiverVisitor(BugReporterContext &BRC) {
   BRC.addVisitor(new NilReceiverVisitor());
 }
 
 // Registers every VarDecl inside a Stmt with a last store vistor.
-void clang::bugreporter::registerVarDeclsLastStore(BugReporterContext &BRC,
+void bugreporter::registerVarDeclsLastStore(BugReporterContext &BRC,
                                                    const void *stmt,
                                                    const ExplodedNode *N) {
   const Stmt *S = static_cast<const Stmt *>(stmt);
diff --git a/lib/GR/CFRefCount.cpp b/lib/GR/CFRefCount.cpp
index 211c265..55d11a5 100644
--- a/lib/GR/CFRefCount.cpp
+++ b/lib/GR/CFRefCount.cpp
@@ -34,6 +34,7 @@
 #include <stdarg.h>
 
 using namespace clang;
+using namespace GR;
 using llvm::StringRef;
 using llvm::StrInStrNoCase;
 
@@ -396,6 +397,7 @@
 typedef llvm::ImmutableMap<SymbolRef, RefVal> RefBindings;
 
 namespace clang {
+namespace GR {
   template<>
   struct GRStateTrait<RefBindings> : public GRStatePartialTrait<RefBindings> {
     static void* GDMIndex() {
@@ -404,6 +406,7 @@
     }
   };
 }
+}
 
 //===----------------------------------------------------------------------===//
 // Summaries
@@ -1576,6 +1579,7 @@
 namespace { class AutoreleaseStack {}; }
 
 namespace clang {
+namespace GR {
 template<> struct GRStateTrait<AutoreleaseStack>
   : public GRStatePartialTrait<ARStack> {
   static inline void* GDMIndex() { return &AutoRBIndex; }
@@ -1585,6 +1589,7 @@
   : public GRStatePartialTrait<ARPoolContents> {
   static inline void* GDMIndex() { return &AutoRCIndex; }
 };
+} // end GR namespace
 } // end clang namespace
 
 static SymbolRef GetCurrentAutoreleasePool(const GRState* state) {
@@ -3489,7 +3494,7 @@
   Eng.registerCheck(new RetainReleaseChecker(this));
 }
 
-GRTransferFuncs* clang::MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
+GRTransferFuncs* GR::MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
                                          const LangOptions& lopts) {
   return new CFRefCount(Ctx, GCEnabled, lopts);
 }
diff --git a/lib/GR/Checker.cpp b/lib/GR/Checker.cpp
index 00976db..521d9e2 100644
--- a/lib/GR/Checker.cpp
+++ b/lib/GR/Checker.cpp
@@ -14,6 +14,7 @@
 
 #include "clang/GR/PathSensitive/Checker.h"
 using namespace clang;
+using namespace GR;
 
 Checker::~Checker() {}
 
diff --git a/lib/GR/CheckerHelpers.cpp b/lib/GR/CheckerHelpers.cpp
index 3819ed3..23144a3 100644
--- a/lib/GR/CheckerHelpers.cpp
+++ b/lib/GR/CheckerHelpers.cpp
@@ -15,7 +15,7 @@
 #include "clang/AST/Expr.h"
 
 // Recursively find any substatements containing macros
-bool clang::containsMacro(const Stmt *S) {
+bool clang::GR::containsMacro(const Stmt *S) {
   if (S->getLocStart().isMacroID())
     return true;
 
@@ -32,7 +32,7 @@
 }
 
 // Recursively find any substatements containing enum constants
-bool clang::containsEnum(const Stmt *S) {
+bool clang::GR::containsEnum(const Stmt *S) {
   const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(S);
 
   if (DR && isa<EnumConstantDecl>(DR->getDecl()))
@@ -48,7 +48,7 @@
 }
 
 // Recursively find any substatements containing static vars
-bool clang::containsStaticLocal(const Stmt *S) {
+bool clang::GR::containsStaticLocal(const Stmt *S) {
   const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(S);
 
   if (DR)
@@ -66,7 +66,7 @@
 }
 
 // Recursively find any substatements containing __builtin_offsetof
-bool clang::containsBuiltinOffsetOf(const Stmt *S) {
+bool clang::GR::containsBuiltinOffsetOf(const Stmt *S) {
   if (isa<OffsetOfExpr>(S))
     return true;
 
diff --git a/lib/GR/Checkers/AdjustedReturnValueChecker.cpp b/lib/GR/Checkers/AdjustedReturnValueChecker.cpp
index 281d74f..d9cfd3c 100644
--- a/lib/GR/Checkers/AdjustedReturnValueChecker.cpp
+++ b/lib/GR/Checkers/AdjustedReturnValueChecker.cpp
@@ -19,6 +19,7 @@
 #include "clang/GR/PathSensitive/CheckerVisitor.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class AdjustedReturnValueChecker : 
@@ -34,7 +35,7 @@
 };
 }
 
-void clang::RegisterAdjustedReturnValueChecker(GRExprEngine &Eng) {
+void GR::RegisterAdjustedReturnValueChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new AdjustedReturnValueChecker());
 }
 
diff --git a/lib/GR/Checkers/ArrayBoundChecker.cpp b/lib/GR/Checkers/ArrayBoundChecker.cpp
index a36e13e..f97adf3 100644
--- a/lib/GR/Checkers/ArrayBoundChecker.cpp
+++ b/lib/GR/Checkers/ArrayBoundChecker.cpp
@@ -18,6 +18,7 @@
 #include "clang/GR/PathSensitive/GRExprEngine.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class ArrayBoundChecker : 
@@ -30,7 +31,7 @@
 };
 }
 
-void clang::RegisterArrayBoundChecker(GRExprEngine &Eng) {
+void GR::RegisterArrayBoundChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new ArrayBoundChecker());
 }
 
diff --git a/lib/GR/Checkers/AttrNonNullChecker.cpp b/lib/GR/Checkers/AttrNonNullChecker.cpp
index 5be1278..baf209e 100644
--- a/lib/GR/Checkers/AttrNonNullChecker.cpp
+++ b/lib/GR/Checkers/AttrNonNullChecker.cpp
@@ -17,6 +17,7 @@
 #include "clang/GR/PathSensitive/CheckerVisitor.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class AttrNonNullChecker
@@ -32,7 +33,7 @@
 };
 } // end anonymous namespace
 
-void clang::RegisterAttrNonNullChecker(GRExprEngine &Eng) {
+void GR::RegisterAttrNonNullChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new AttrNonNullChecker());
 }
 
diff --git a/lib/GR/Checkers/BasicObjCFoundationChecks.cpp b/lib/GR/Checkers/BasicObjCFoundationChecks.cpp
index dc53695..93c8bab 100644
--- a/lib/GR/Checkers/BasicObjCFoundationChecks.cpp
+++ b/lib/GR/Checkers/BasicObjCFoundationChecks.cpp
@@ -29,6 +29,7 @@
 #include "clang/AST/ASTContext.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class APIMisuse : public BugType {
@@ -510,7 +511,7 @@
 // Check registration.
 //===----------------------------------------------------------------------===//
   
-void clang::RegisterAppleChecks(GRExprEngine& Eng, const Decl &D) {
+void GR::RegisterAppleChecks(GRExprEngine& Eng, const Decl &D) {
   Eng.registerCheck(new NilArgChecker());
   Eng.registerCheck(new CFNumberCreateChecker());
   RegisterNSErrorChecks(Eng.getBugReporter(), Eng, D);
diff --git a/lib/GR/Checkers/BasicObjCFoundationChecks.h b/lib/GR/Checkers/BasicObjCFoundationChecks.h
index 6ad850b..7fdccdc 100644
--- a/lib/GR/Checkers/BasicObjCFoundationChecks.h
+++ b/lib/GR/Checkers/BasicObjCFoundationChecks.h
@@ -13,19 +13,24 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_BASICOBJCFOUNDATIONCHECKS
-#define LLVM_CLANG_ANALYSIS_BASICOBJCFOUNDATIONCHECKS
+#ifndef LLVM_CLANG_GR_BASICOBJCFOUNDATIONCHECKS
+#define LLVM_CLANG_GR_BASICOBJCFOUNDATIONCHECKS
 
 namespace clang {
 
 class ASTContext;
-class BugReporter;
 class Decl;
+
+namespace GR {
+
+class BugReporter;
 class GRExprEngine;
 
 void RegisterNSErrorChecks(BugReporter& BR, GRExprEngine &Eng, const Decl &D);
 void RegisterNSAutoreleasePoolChecks(GRExprEngine &Eng);
 
+} // end GR namespace
+
 } // end clang namespace
 
 #endif
diff --git a/lib/GR/Checkers/BuiltinFunctionChecker.cpp b/lib/GR/Checkers/BuiltinFunctionChecker.cpp
index 08fcbd6..dc55a65 100644
--- a/lib/GR/Checkers/BuiltinFunctionChecker.cpp
+++ b/lib/GR/Checkers/BuiltinFunctionChecker.cpp
@@ -16,6 +16,7 @@
 #include "clang/Basic/Builtins.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 
@@ -27,7 +28,7 @@
 
 }
 
-void clang::RegisterBuiltinFunctionChecker(GRExprEngine &Eng) {
+void GR::RegisterBuiltinFunctionChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new BuiltinFunctionChecker());
 }
 
diff --git a/lib/GR/Checkers/CStringChecker.cpp b/lib/GR/Checkers/CStringChecker.cpp
index db4d86f..da0bba3 100644
--- a/lib/GR/Checkers/CStringChecker.cpp
+++ b/lib/GR/Checkers/CStringChecker.cpp
@@ -19,6 +19,7 @@
 #include "llvm/ADT/StringSwitch.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class CStringChecker : public CheckerVisitor<CStringChecker> {
@@ -99,14 +100,16 @@
 } //end anonymous namespace
 
 namespace clang {
+namespace GR {
   template <>
   struct GRStateTrait<CStringLength> 
     : public GRStatePartialTrait<CStringLength::EntryMap> {
     static void *GDMIndex() { return CStringChecker::getTag(); }
   };
 }
+}
 
-void clang::RegisterCStringChecker(GRExprEngine &Eng) {
+void GR::RegisterCStringChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new CStringChecker());
 }
 
diff --git a/lib/GR/Checkers/CallAndMessageChecker.cpp b/lib/GR/Checkers/CallAndMessageChecker.cpp
index e68569c..8b8f75f 100644
--- a/lib/GR/Checkers/CallAndMessageChecker.cpp
+++ b/lib/GR/Checkers/CallAndMessageChecker.cpp
@@ -19,6 +19,7 @@
 #include "clang/GR/PathSensitive/CheckerVisitor.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class CallAndMessageChecker
@@ -61,7 +62,7 @@
 };
 } // end anonymous namespace
 
-void clang::RegisterCallAndMessageChecker(GRExprEngine &Eng) {
+void GR::RegisterCallAndMessageChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new CallAndMessageChecker());
 }
 
diff --git a/lib/GR/Checkers/CastSizeChecker.cpp b/lib/GR/Checkers/CastSizeChecker.cpp
index 1248d12..bcbb894 100644
--- a/lib/GR/Checkers/CastSizeChecker.cpp
+++ b/lib/GR/Checkers/CastSizeChecker.cpp
@@ -17,6 +17,7 @@
 #include "GRExprEngineInternalChecks.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class CastSizeChecker : public CheckerVisitor<CastSizeChecker> {
@@ -85,6 +86,6 @@
 }
 
 
-void clang::RegisterCastSizeChecker(GRExprEngine &Eng) {
+void GR::RegisterCastSizeChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new CastSizeChecker());
 }
diff --git a/lib/GR/Checkers/CastToStructChecker.cpp b/lib/GR/Checkers/CastToStructChecker.cpp
index 2a010b2..0bcba28 100644
--- a/lib/GR/Checkers/CastToStructChecker.cpp
+++ b/lib/GR/Checkers/CastToStructChecker.cpp
@@ -18,6 +18,7 @@
 #include "GRExprEngineInternalChecks.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class CastToStructChecker 
@@ -73,6 +74,6 @@
   }
 }
 
-void clang::RegisterCastToStructChecker(GRExprEngine &Eng) {
+void GR::RegisterCastToStructChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new CastToStructChecker());
 }
diff --git a/lib/GR/Checkers/CheckDeadStores.cpp b/lib/GR/Checkers/CheckDeadStores.cpp
index 7e90781..44fdb3a 100644
--- a/lib/GR/Checkers/CheckDeadStores.cpp
+++ b/lib/GR/Checkers/CheckDeadStores.cpp
@@ -24,6 +24,7 @@
 #include "llvm/ADT/SmallPtrSet.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 
@@ -280,7 +281,7 @@
 } // end anonymous namespace
 
 
-void clang::CheckDeadStores(CFG &cfg, LiveVariables &L, ParentMap &pmap, 
+void GR::CheckDeadStores(CFG &cfg, LiveVariables &L, ParentMap &pmap, 
                             BugReporter& BR) {
   FindEscaped FS(&cfg);
   FS.getCFG().VisitBlockStmts(FS);
diff --git a/lib/GR/Checkers/CheckObjCDealloc.cpp b/lib/GR/Checkers/CheckObjCDealloc.cpp
index c3d511b..f8ec7f6 100644
--- a/lib/GR/Checkers/CheckObjCDealloc.cpp
+++ b/lib/GR/Checkers/CheckObjCDealloc.cpp
@@ -23,6 +23,7 @@
 #include "llvm/Support/raw_ostream.h"
 
 using namespace clang;
+using namespace GR;
 
 static bool scan_dealloc(Stmt* S, Selector Dealloc) {
 
@@ -93,8 +94,8 @@
   return false;
 }
 
-void clang::CheckObjCDealloc(const ObjCImplementationDecl* D,
-                             const LangOptions& LOpts, BugReporter& BR) {
+void GR::CheckObjCDealloc(const ObjCImplementationDecl* D,
+                          const LangOptions& LOpts, BugReporter& BR) {
 
   assert (LOpts.getGCMode() != LangOptions::GCOnly);
 
diff --git a/lib/GR/Checkers/CheckObjCInstMethSignature.cpp b/lib/GR/Checkers/CheckObjCInstMethSignature.cpp
index 2b83d13..b2be375 100644
--- a/lib/GR/Checkers/CheckObjCInstMethSignature.cpp
+++ b/lib/GR/Checkers/CheckObjCInstMethSignature.cpp
@@ -24,6 +24,7 @@
 #include "llvm/Support/raw_ostream.h"
 
 using namespace clang;
+using namespace GR;
 
 static bool AreTypesCompatible(QualType Derived, QualType Ancestor,
                                ASTContext& C) {
@@ -69,8 +70,8 @@
   }
 }
 
-void clang::CheckObjCInstMethSignature(const ObjCImplementationDecl* ID,
-                                       BugReporter& BR) {
+void GR::CheckObjCInstMethSignature(const ObjCImplementationDecl* ID,
+                                    BugReporter& BR) {
 
   const ObjCInterfaceDecl* D = ID->getClassInterface();
   const ObjCInterfaceDecl* C = D->getSuperClass();
diff --git a/lib/GR/Checkers/CheckSecuritySyntaxOnly.cpp b/lib/GR/Checkers/CheckSecuritySyntaxOnly.cpp
index bdf18ca..ea658e3 100644
--- a/lib/GR/Checkers/CheckSecuritySyntaxOnly.cpp
+++ b/lib/GR/Checkers/CheckSecuritySyntaxOnly.cpp
@@ -18,6 +18,7 @@
 #include "llvm/Support/raw_ostream.h"
 
 using namespace clang;
+using namespace GR;
 
 static bool isArc4RandomAvailable(const ASTContext &Ctx) {
   const llvm::Triple &T = Ctx.Target.getTriple();
@@ -496,7 +497,7 @@
 // Entry point for check.
 //===----------------------------------------------------------------------===//
 
-void clang::CheckSecuritySyntaxOnly(const Decl *D, BugReporter &BR) {
+void GR::CheckSecuritySyntaxOnly(const Decl *D, BugReporter &BR) {
   WalkAST walker(BR);
   walker.Visit(D->getBody());
 }
diff --git a/lib/GR/Checkers/CheckSizeofPointer.cpp b/lib/GR/Checkers/CheckSizeofPointer.cpp
index 4cf5eb7..696dce2 100644
--- a/lib/GR/Checkers/CheckSizeofPointer.cpp
+++ b/lib/GR/Checkers/CheckSizeofPointer.cpp
@@ -17,6 +17,7 @@
 #include "clang/GR/Checkers/LocalCheckers.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class WalkAST : public StmtVisitor<WalkAST> {
@@ -65,7 +66,7 @@
   }
 }
 
-void clang::CheckSizeofPointer(const Decl *D, BugReporter &BR) {
+void GR::CheckSizeofPointer(const Decl *D, BugReporter &BR) {
   WalkAST walker(BR);
   walker.Visit(D->getBody());
 }
diff --git a/lib/GR/Checkers/ChrootChecker.cpp b/lib/GR/Checkers/ChrootChecker.cpp
index 2108094..f93ee7b 100644
--- a/lib/GR/Checkers/ChrootChecker.cpp
+++ b/lib/GR/Checkers/ChrootChecker.cpp
@@ -19,6 +19,7 @@
 #include "clang/GR/PathSensitive/SymbolManager.h"
 #include "llvm/ADT/ImmutableMap.h"
 using namespace clang;
+using namespace GR;
 
 namespace {
 
@@ -58,7 +59,7 @@
 
 } // end anonymous namespace
 
-void clang::RegisterChrootChecker(GRExprEngine &Eng) {
+void GR::RegisterChrootChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new ChrootChecker());
 }
 
diff --git a/lib/GR/Checkers/DereferenceChecker.cpp b/lib/GR/Checkers/DereferenceChecker.cpp
index 72c88b1..62b1f86 100644
--- a/lib/GR/Checkers/DereferenceChecker.cpp
+++ b/lib/GR/Checkers/DereferenceChecker.cpp
@@ -19,6 +19,7 @@
 #include "clang/GR/PathSensitive/GRExprEngine.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class DereferenceChecker : public Checker {
@@ -42,12 +43,12 @@
 };
 } // end anonymous namespace
 
-void clang::RegisterDereferenceChecker(GRExprEngine &Eng) {
+void GR::RegisterDereferenceChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new DereferenceChecker());
 }
 
 std::pair<ExplodedNode * const *, ExplodedNode * const *>
-clang::GetImplicitNullDereferences(GRExprEngine &Eng) {
+GR::GetImplicitNullDereferences(GRExprEngine &Eng) {
   DereferenceChecker *checker = Eng.getChecker<DereferenceChecker>();
   if (!checker)
     return std::make_pair((ExplodedNode * const *) 0,
diff --git a/lib/GR/Checkers/DivZeroChecker.cpp b/lib/GR/Checkers/DivZeroChecker.cpp
index e76d846..a4cb1a4 100644
--- a/lib/GR/Checkers/DivZeroChecker.cpp
+++ b/lib/GR/Checkers/DivZeroChecker.cpp
@@ -17,6 +17,7 @@
 #include "clang/GR/PathSensitive/CheckerVisitor.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class DivZeroChecker : public CheckerVisitor<DivZeroChecker> {
@@ -28,7 +29,7 @@
 };  
 } // end anonymous namespace
 
-void clang::RegisterDivZeroChecker(GRExprEngine &Eng) {
+void GR::RegisterDivZeroChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new DivZeroChecker());
 }
 
diff --git a/lib/GR/Checkers/FixedAddressChecker.cpp b/lib/GR/Checkers/FixedAddressChecker.cpp
index ede6b55..4c7086f 100644
--- a/lib/GR/Checkers/FixedAddressChecker.cpp
+++ b/lib/GR/Checkers/FixedAddressChecker.cpp
@@ -18,6 +18,7 @@
 #include "clang/GR/PathSensitive/CheckerVisitor.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class FixedAddressChecker 
@@ -66,6 +67,6 @@
   }
 }
 
-void clang::RegisterFixedAddressChecker(GRExprEngine &Eng) {
+void GR::RegisterFixedAddressChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new FixedAddressChecker());
 }
diff --git a/lib/GR/Checkers/GRExprEngineExperimentalChecks.cpp b/lib/GR/Checkers/GRExprEngineExperimentalChecks.cpp
index f1acc65..fd9bf5d 100644
--- a/lib/GR/Checkers/GRExprEngineExperimentalChecks.cpp
+++ b/lib/GR/Checkers/GRExprEngineExperimentalChecks.cpp
@@ -17,8 +17,9 @@
 #include "clang/GR/Checkers/LocalCheckers.h"
 
 using namespace clang;
+using namespace GR;
 
-void clang::RegisterExperimentalChecks(GRExprEngine &Eng) {
+void GR::RegisterExperimentalChecks(GRExprEngine &Eng) {
   // These are checks that never belong as internal checks
   // within GRExprEngine.
   RegisterCStringChecker(Eng);
@@ -29,7 +30,7 @@
   RegisterUnreachableCodeChecker(Eng);
 }
 
-void clang::RegisterExperimentalInternalChecks(GRExprEngine &Eng) {
+void GR::RegisterExperimentalInternalChecks(GRExprEngine &Eng) {
   // These are internal checks that should eventually migrate to
   // RegisterInternalChecks() once they have been further tested.
   
diff --git a/lib/GR/Checkers/GRExprEngineExperimentalChecks.h b/lib/GR/Checkers/GRExprEngineExperimentalChecks.h
index 3380031..54a6125 100644
--- a/lib/GR/Checkers/GRExprEngineExperimentalChecks.h
+++ b/lib/GR/Checkers/GRExprEngineExperimentalChecks.h
@@ -12,11 +12,13 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_GREXPRENGINE_EXPERIMENTAL_CHECKS
-#define LLVM_CLANG_GREXPRENGINE_EXPERIMENTAL_CHECKS
+#ifndef LLVM_CLANG_GR_GREXPRENGINE_EXPERIMENTAL_CHECKS
+#define LLVM_CLANG_GR_GREXPRENGINE_EXPERIMENTAL_CHECKS
 
 namespace clang {
 
+namespace GR {
+
 class GRExprEngine;
 
 void RegisterAnalyzerStatsChecker(GRExprEngine &Eng);
@@ -28,5 +30,8 @@
 void RegisterStreamChecker(GRExprEngine &Eng);
 void RegisterUnreachableCodeChecker(GRExprEngine &Eng);
 
+} // end GR namespace
+
 } // end clang namespace
+
 #endif
diff --git a/lib/GR/Checkers/GRExprEngineInternalChecks.h b/lib/GR/Checkers/GRExprEngineInternalChecks.h
index 740a914..cba419a 100644
--- a/lib/GR/Checkers/GRExprEngineInternalChecks.h
+++ b/lib/GR/Checkers/GRExprEngineInternalChecks.h
@@ -12,11 +12,13 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_GREXPRENGINE_INTERNAL_CHECKS
-#define LLVM_CLANG_GREXPRENGINE_INTERNAL_CHECKS
+#ifndef LLVM_CLANG_GR_GREXPRENGINE_INTERNAL_CHECKS
+#define LLVM_CLANG_GR_GREXPRENGINE_INTERNAL_CHECKS
 
 namespace clang {
 
+namespace GR {
+
 class GRExprEngine;
 
 // Foundational checks that handle basic semantics.
@@ -49,5 +51,8 @@
 void RegisterOSAtomicChecker(GRExprEngine &Eng);
 void RegisterUnixAPIChecker(GRExprEngine &Eng);
 
+} // end GR namespace
+
 } // end clang namespace
+
 #endif
diff --git a/lib/GR/Checkers/IdempotentOperationChecker.cpp b/lib/GR/Checkers/IdempotentOperationChecker.cpp
index e6f0e5d..b28edc3 100644
--- a/lib/GR/Checkers/IdempotentOperationChecker.cpp
+++ b/lib/GR/Checkers/IdempotentOperationChecker.cpp
@@ -58,6 +58,7 @@
 #include <deque>
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class IdempotentOperationChecker
@@ -129,7 +130,7 @@
   return &x;
 }
 
-void clang::RegisterIdempotentOperationChecker(GRExprEngine &Eng) {
+void GR::RegisterIdempotentOperationChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new IdempotentOperationChecker());
 }
 
diff --git a/lib/GR/Checkers/LLVMConventionsChecker.cpp b/lib/GR/Checkers/LLVMConventionsChecker.cpp
index e97074e..655e756 100644
--- a/lib/GR/Checkers/LLVMConventionsChecker.cpp
+++ b/lib/GR/Checkers/LLVMConventionsChecker.cpp
@@ -20,6 +20,7 @@
 #include "llvm/ADT/StringRef.h"
 
 using namespace clang;
+using namespace GR;
 
 //===----------------------------------------------------------------------===//
 // Generic type checking routines.
@@ -305,7 +306,7 @@
   }
 }
 
-void clang::CheckLLVMConventions(TranslationUnitDecl &TU,
+void GR::CheckLLVMConventions(TranslationUnitDecl &TU,
                                  BugReporter &BR) {
   ScanCodeDecls(&TU, BR);
 }
diff --git a/lib/GR/Checkers/MacOSXAPIChecker.cpp b/lib/GR/Checkers/MacOSXAPIChecker.cpp
index c798cb2..316e37a 100644
--- a/lib/GR/Checkers/MacOSXAPIChecker.cpp
+++ b/lib/GR/Checkers/MacOSXAPIChecker.cpp
@@ -25,6 +25,7 @@
 #include "llvm/Support/raw_ostream.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class MacOSXAPIChecker : public CheckerVisitor<MacOSXAPIChecker> {
@@ -44,7 +45,7 @@
 };
 } //end anonymous namespace
 
-void clang::RegisterMacOSXAPIChecker(GRExprEngine &Eng) {
+void GR::RegisterMacOSXAPIChecker(GRExprEngine &Eng) {
   if (Eng.getContext().Target.getTriple().getVendor() == llvm::Triple::Apple)
     Eng.registerCheck(new MacOSXAPIChecker());
 }
diff --git a/lib/GR/Checkers/MallocChecker.cpp b/lib/GR/Checkers/MallocChecker.cpp
index 367ac24..cd5f636 100644
--- a/lib/GR/Checkers/MallocChecker.cpp
+++ b/lib/GR/Checkers/MallocChecker.cpp
@@ -20,6 +20,7 @@
 #include "clang/GR/PathSensitive/SymbolManager.h"
 #include "llvm/ADT/ImmutableMap.h"
 using namespace clang;
+using namespace GR;
 
 namespace {
 
@@ -116,14 +117,16 @@
 typedef llvm::ImmutableMap<SymbolRef, RefState> RegionStateTy;
 
 namespace clang {
+namespace GR {
   template <>
   struct GRStateTrait<RegionState> 
     : public GRStatePartialTrait<RegionStateTy> {
     static void *GDMIndex() { return MallocChecker::getTag(); }
   };
 }
+}
 
-void clang::RegisterMallocChecker(GRExprEngine &Eng) {
+void GR::RegisterMallocChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new MallocChecker());
 }
 
diff --git a/lib/GR/Checkers/NSAutoreleasePoolChecker.cpp b/lib/GR/Checkers/NSAutoreleasePoolChecker.cpp
index d8225a7..d6701c7 100644
--- a/lib/GR/Checkers/NSAutoreleasePoolChecker.cpp
+++ b/lib/GR/Checkers/NSAutoreleasePoolChecker.cpp
@@ -23,6 +23,7 @@
 #include "clang/AST/Decl.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class NSAutoreleasePoolChecker
@@ -44,7 +45,7 @@
 } // end anonymous namespace
 
 
-void clang::RegisterNSAutoreleasePoolChecks(GRExprEngine &Eng) {
+void GR::RegisterNSAutoreleasePoolChecks(GRExprEngine &Eng) {
   ASTContext &Ctx = Eng.getContext();
   if (Ctx.getLangOptions().getGCMode() != LangOptions::NonGC) {    
     Eng.registerCheck(new NSAutoreleasePoolChecker(GetNullarySelector("release",
diff --git a/lib/GR/Checkers/NSErrorChecker.cpp b/lib/GR/Checkers/NSErrorChecker.cpp
index 73caf77..44715bf 100644
--- a/lib/GR/Checkers/NSErrorChecker.cpp
+++ b/lib/GR/Checkers/NSErrorChecker.cpp
@@ -25,6 +25,7 @@
 #include "llvm/ADT/SmallVector.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class NSErrorChecker : public BugType {
@@ -62,7 +63,7 @@
 
 } // end anonymous namespace
 
-void clang::RegisterNSErrorChecks(BugReporter& BR, GRExprEngine &Eng,
+void GR::RegisterNSErrorChecks(BugReporter& BR, GRExprEngine &Eng,
                                   const Decl &D) {
   BR.Register(new NSErrorChecker(D, true, Eng));
   BR.Register(new NSErrorChecker(D, false, Eng));
diff --git a/lib/GR/Checkers/NoReturnFunctionChecker.cpp b/lib/GR/Checkers/NoReturnFunctionChecker.cpp
index fdd2849..739460f 100644
--- a/lib/GR/Checkers/NoReturnFunctionChecker.cpp
+++ b/lib/GR/Checkers/NoReturnFunctionChecker.cpp
@@ -17,6 +17,7 @@
 #include "llvm/ADT/StringSwitch.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 
@@ -28,7 +29,7 @@
 
 }
 
-void clang::RegisterNoReturnFunctionChecker(GRExprEngine &Eng) {
+void GR::RegisterNoReturnFunctionChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new NoReturnFunctionChecker());
 }
 
diff --git a/lib/GR/Checkers/OSAtomicChecker.cpp b/lib/GR/Checkers/OSAtomicChecker.cpp
index 36b5335..7df7a9e 100644
--- a/lib/GR/Checkers/OSAtomicChecker.cpp
+++ b/lib/GR/Checkers/OSAtomicChecker.cpp
@@ -16,6 +16,7 @@
 #include "clang/Basic/Builtins.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 
@@ -30,7 +31,7 @@
 
 }
 
-void clang::RegisterOSAtomicChecker(GRExprEngine &Eng) {
+void GR::RegisterOSAtomicChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new OSAtomicChecker());
 }
 
diff --git a/lib/GR/Checkers/ObjCAtSyncChecker.cpp b/lib/GR/Checkers/ObjCAtSyncChecker.cpp
index c95df4e..a393862 100644
--- a/lib/GR/Checkers/ObjCAtSyncChecker.cpp
+++ b/lib/GR/Checkers/ObjCAtSyncChecker.cpp
@@ -19,6 +19,7 @@
 #include "clang/GR/PathSensitive/GRExprEngine.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class ObjCAtSyncChecker : public CheckerVisitor<ObjCAtSyncChecker> {
@@ -32,7 +33,7 @@
 };
 } // end anonymous namespace
 
-void clang::RegisterObjCAtSyncChecker(GRExprEngine &Eng) {
+void GR::RegisterObjCAtSyncChecker(GRExprEngine &Eng) {
   // @synchronized is an Objective-C 2 feature.
   if (Eng.getContext().getLangOptions().ObjC2)
     Eng.registerCheck(new ObjCAtSyncChecker());
diff --git a/lib/GR/Checkers/ObjCUnusedIVarsChecker.cpp b/lib/GR/Checkers/ObjCUnusedIVarsChecker.cpp
index e3f5d56..611914f 100644
--- a/lib/GR/Checkers/ObjCUnusedIVarsChecker.cpp
+++ b/lib/GR/Checkers/ObjCUnusedIVarsChecker.cpp
@@ -23,6 +23,7 @@
 #include "clang/Basic/SourceManager.h"
 
 using namespace clang;
+using namespace GR;
 
 enum IVarState { Unused, Used };
 typedef llvm::DenseMap<const ObjCIvarDecl*,IVarState> IvarUsageMap;
@@ -97,7 +98,7 @@
     }
 }
 
-void clang::CheckObjCUnusedIvar(const ObjCImplementationDecl *D,
+void GR::CheckObjCUnusedIvar(const ObjCImplementationDecl *D,
                                 BugReporter &BR) {
 
   const ObjCInterfaceDecl* ID = D->getClassInterface();
diff --git a/lib/GR/Checkers/PointerArithChecker.cpp b/lib/GR/Checkers/PointerArithChecker.cpp
index 0517140..485144a 100644
--- a/lib/GR/Checkers/PointerArithChecker.cpp
+++ b/lib/GR/Checkers/PointerArithChecker.cpp
@@ -17,6 +17,7 @@
 #include "clang/GR/PathSensitive/CheckerVisitor.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class PointerArithChecker 
@@ -66,6 +67,6 @@
   }
 }
 
-void clang::RegisterPointerArithChecker(GRExprEngine &Eng) {
+void GR::RegisterPointerArithChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new PointerArithChecker());
 }
diff --git a/lib/GR/Checkers/PointerSubChecker.cpp b/lib/GR/Checkers/PointerSubChecker.cpp
index 24f839d..44e3d9f 100644
--- a/lib/GR/Checkers/PointerSubChecker.cpp
+++ b/lib/GR/Checkers/PointerSubChecker.cpp
@@ -18,6 +18,7 @@
 #include "clang/GR/PathSensitive/CheckerVisitor.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class PointerSubChecker 
@@ -73,6 +74,6 @@
   }
 }
 
-void clang::RegisterPointerSubChecker(GRExprEngine &Eng) {
+void GR::RegisterPointerSubChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new PointerSubChecker());
 }
diff --git a/lib/GR/Checkers/PthreadLockChecker.cpp b/lib/GR/Checkers/PthreadLockChecker.cpp
index 32f2f57..d880b06 100644
--- a/lib/GR/Checkers/PthreadLockChecker.cpp
+++ b/lib/GR/Checkers/PthreadLockChecker.cpp
@@ -19,6 +19,7 @@
 #include "llvm/ADT/ImmutableSet.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class PthreadLockChecker
@@ -44,13 +45,15 @@
 // GDM Entry for tracking lock state.
 namespace { class LockSet {}; }
 namespace clang {
+namespace GR {
 template <> struct GRStateTrait<LockSet> :
   public GRStatePartialTrait<llvm::ImmutableSet<const MemRegion*> > {
     static void* GDMIndex() { return PthreadLockChecker::getTag(); }
 };
+} // end GR namespace
 } // end clang namespace
 
-void clang::RegisterPthreadLockChecker(GRExprEngine &Eng) {
+void GR::RegisterPthreadLockChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new PthreadLockChecker());
 }
 
diff --git a/lib/GR/Checkers/ReturnPointerRangeChecker.cpp b/lib/GR/Checkers/ReturnPointerRangeChecker.cpp
index a2a9473..98b4ea5 100644
--- a/lib/GR/Checkers/ReturnPointerRangeChecker.cpp
+++ b/lib/GR/Checkers/ReturnPointerRangeChecker.cpp
@@ -18,6 +18,7 @@
 #include "clang/GR/PathSensitive/GRExprEngine.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class ReturnPointerRangeChecker : 
@@ -30,7 +31,7 @@
 };
 }
 
-void clang::RegisterReturnPointerRangeChecker(GRExprEngine &Eng) {
+void GR::RegisterReturnPointerRangeChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new ReturnPointerRangeChecker());
 }
 
diff --git a/lib/GR/Checkers/ReturnUndefChecker.cpp b/lib/GR/Checkers/ReturnUndefChecker.cpp
index f5e417a..addae5b 100644
--- a/lib/GR/Checkers/ReturnUndefChecker.cpp
+++ b/lib/GR/Checkers/ReturnUndefChecker.cpp
@@ -19,6 +19,7 @@
 #include "clang/GR/PathSensitive/GRExprEngine.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class ReturnUndefChecker : 
@@ -31,7 +32,7 @@
 };
 }
 
-void clang::RegisterReturnUndefChecker(GRExprEngine &Eng) {
+void GR::RegisterReturnUndefChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new ReturnUndefChecker());
 }
 
diff --git a/lib/GR/Checkers/StackAddrLeakChecker.cpp b/lib/GR/Checkers/StackAddrLeakChecker.cpp
index 1852e24..87f5819 100644
--- a/lib/GR/Checkers/StackAddrLeakChecker.cpp
+++ b/lib/GR/Checkers/StackAddrLeakChecker.cpp
@@ -19,6 +19,7 @@
 #include "clang/Basic/SourceManager.h"
 #include "llvm/ADT/SmallString.h"
 using namespace clang;
+using namespace GR;
 
 namespace {
 class StackAddrLeakChecker : public CheckerVisitor<StackAddrLeakChecker> {
@@ -40,7 +41,7 @@
 };
 }
 
-void clang::RegisterStackAddrLeakChecker(GRExprEngine &Eng) {
+void GR::RegisterStackAddrLeakChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new StackAddrLeakChecker());
 }
 
diff --git a/lib/GR/Checkers/StreamChecker.cpp b/lib/GR/Checkers/StreamChecker.cpp
index dc7bd62..01186b5 100644
--- a/lib/GR/Checkers/StreamChecker.cpp
+++ b/lib/GR/Checkers/StreamChecker.cpp
@@ -20,6 +20,7 @@
 #include "llvm/ADT/ImmutableMap.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 
@@ -104,14 +105,16 @@
 } // end anonymous namespace
 
 namespace clang {
+namespace GR {
   template <>
   struct GRStateTrait<StreamState> 
     : public GRStatePartialTrait<llvm::ImmutableMap<SymbolRef, StreamState> > {
     static void *GDMIndex() { return StreamChecker::getTag(); }
   };
 }
+}
 
-void clang::RegisterStreamChecker(GRExprEngine &Eng) {
+void GR::RegisterStreamChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new StreamChecker());
 }
 
diff --git a/lib/GR/Checkers/UndefBranchChecker.cpp b/lib/GR/Checkers/UndefBranchChecker.cpp
index ebeb7a4..fa3dfa5 100644
--- a/lib/GR/Checkers/UndefBranchChecker.cpp
+++ b/lib/GR/Checkers/UndefBranchChecker.cpp
@@ -17,6 +17,7 @@
 #include "clang/GR/PathSensitive/Checker.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 
@@ -55,7 +56,7 @@
 
 }
 
-void clang::RegisterUndefBranchChecker(GRExprEngine &Eng) {
+void GR::RegisterUndefBranchChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new UndefBranchChecker());
 }
 
diff --git a/lib/GR/Checkers/UndefCapturedBlockVarChecker.cpp b/lib/GR/Checkers/UndefCapturedBlockVarChecker.cpp
index 78b8394..8a1c285 100644
--- a/lib/GR/Checkers/UndefCapturedBlockVarChecker.cpp
+++ b/lib/GR/Checkers/UndefCapturedBlockVarChecker.cpp
@@ -18,6 +18,7 @@
 #include "llvm/Support/raw_ostream.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class UndefCapturedBlockVarChecker
@@ -31,7 +32,7 @@
 };
 } // end anonymous namespace
 
-void clang::RegisterUndefCapturedBlockVarChecker(GRExprEngine &Eng) {
+void GR::RegisterUndefCapturedBlockVarChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new UndefCapturedBlockVarChecker());
 }
 
diff --git a/lib/GR/Checkers/UndefResultChecker.cpp b/lib/GR/Checkers/UndefResultChecker.cpp
index df3ad3e..f4d3035 100644
--- a/lib/GR/Checkers/UndefResultChecker.cpp
+++ b/lib/GR/Checkers/UndefResultChecker.cpp
@@ -18,6 +18,7 @@
 #include "clang/GR/PathSensitive/GRExprEngine.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class UndefResultChecker 
@@ -32,7 +33,7 @@
 };
 } // end anonymous namespace
 
-void clang::RegisterUndefResultChecker(GRExprEngine &Eng) {
+void GR::RegisterUndefResultChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new UndefResultChecker());
 }
 
diff --git a/lib/GR/Checkers/UndefinedArraySubscriptChecker.cpp b/lib/GR/Checkers/UndefinedArraySubscriptChecker.cpp
index 8ef3986..8946de3 100644
--- a/lib/GR/Checkers/UndefinedArraySubscriptChecker.cpp
+++ b/lib/GR/Checkers/UndefinedArraySubscriptChecker.cpp
@@ -17,6 +17,7 @@
 #include "clang/GR/PathSensitive/CheckerVisitor.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class UndefinedArraySubscriptChecker
@@ -33,7 +34,7 @@
 };
 } // end anonymous namespace
 
-void clang::RegisterUndefinedArraySubscriptChecker(GRExprEngine &Eng) {
+void GR::RegisterUndefinedArraySubscriptChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new UndefinedArraySubscriptChecker());
 }
 
diff --git a/lib/GR/Checkers/UndefinedAssignmentChecker.cpp b/lib/GR/Checkers/UndefinedAssignmentChecker.cpp
index 4273f0c..b1eb387 100644
--- a/lib/GR/Checkers/UndefinedAssignmentChecker.cpp
+++ b/lib/GR/Checkers/UndefinedAssignmentChecker.cpp
@@ -17,6 +17,7 @@
 #include "clang/GR/PathSensitive/CheckerVisitor.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class UndefinedAssignmentChecker
@@ -30,7 +31,7 @@
 };
 }
 
-void clang::RegisterUndefinedAssignmentChecker(GRExprEngine &Eng){
+void GR::RegisterUndefinedAssignmentChecker(GRExprEngine &Eng){
   Eng.registerCheck(new UndefinedAssignmentChecker());
 }
 
diff --git a/lib/GR/Checkers/UnixAPIChecker.cpp b/lib/GR/Checkers/UnixAPIChecker.cpp
index 4f1b25f..f4c75f7 100644
--- a/lib/GR/Checkers/UnixAPIChecker.cpp
+++ b/lib/GR/Checkers/UnixAPIChecker.cpp
@@ -21,6 +21,7 @@
 #include <fcntl.h>
 
 using namespace clang;
+using namespace GR;
 using llvm::Optional;
 
 namespace {
@@ -45,7 +46,7 @@
 };
 } //end anonymous namespace
 
-void clang::RegisterUnixAPIChecker(GRExprEngine &Eng) {
+void GR::RegisterUnixAPIChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new UnixAPIChecker());
 }
 
diff --git a/lib/GR/Checkers/UnreachableCodeChecker.cpp b/lib/GR/Checkers/UnreachableCodeChecker.cpp
index 5f8b229..0ab97c2 100644
--- a/lib/GR/Checkers/UnreachableCodeChecker.cpp
+++ b/lib/GR/Checkers/UnreachableCodeChecker.cpp
@@ -29,6 +29,7 @@
 #define DEFAULT_CFGBLOCKS 256
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class UnreachableCodeChecker : public Checker {
@@ -53,7 +54,7 @@
   return &x;
 }
 
-void clang::RegisterUnreachableCodeChecker(GRExprEngine &Eng) {
+void GR::RegisterUnreachableCodeChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new UnreachableCodeChecker());
 }
 
diff --git a/lib/GR/Checkers/VLASizeChecker.cpp b/lib/GR/Checkers/VLASizeChecker.cpp
index 8c4d903..d4e9d35 100644
--- a/lib/GR/Checkers/VLASizeChecker.cpp
+++ b/lib/GR/Checkers/VLASizeChecker.cpp
@@ -21,6 +21,7 @@
 #include "clang/GR/PathSensitive/GRExprEngine.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class VLASizeChecker : public CheckerVisitor<VLASizeChecker> {
@@ -34,7 +35,7 @@
 };
 } // end anonymous namespace
 
-void clang::RegisterVLASizeChecker(GRExprEngine &Eng) {
+void GR::RegisterVLASizeChecker(GRExprEngine &Eng) {
   Eng.registerCheck(new VLASizeChecker());
 }
 
diff --git a/lib/GR/Environment.cpp b/lib/GR/Environment.cpp
index 5846d6a..74ac7f2 100644
--- a/lib/GR/Environment.cpp
+++ b/lib/GR/Environment.cpp
@@ -16,6 +16,7 @@
 #include "clang/GR/PathSensitive/GRState.h"
 
 using namespace clang;
+using namespace GR;
 
 SVal Environment::lookupExpr(const Stmt* E) const {
   const SVal* X = ExprBindings.lookup(E);
diff --git a/lib/GR/ExplodedGraph.cpp b/lib/GR/ExplodedGraph.cpp
index 6890ebf..fc46813 100644
--- a/lib/GR/ExplodedGraph.cpp
+++ b/lib/GR/ExplodedGraph.cpp
@@ -21,6 +21,7 @@
 #include <vector>
 
 using namespace clang;
+using namespace GR;
 
 //===----------------------------------------------------------------------===//
 // Node auditing.
diff --git a/lib/GR/FlatStore.cpp b/lib/GR/FlatStore.cpp
index 6e70f61..d4bd4b8 100644
--- a/lib/GR/FlatStore.cpp
+++ b/lib/GR/FlatStore.cpp
@@ -12,6 +12,7 @@
 #include "llvm/Support/ErrorHandling.h"
 
 using namespace clang;
+using namespace GR;
 using llvm::Interval;
 
 // The actual store type.
@@ -83,7 +84,7 @@
 };
 } // end anonymous namespace
 
-StoreManager *clang::CreateFlatStoreManager(GRStateManager &StMgr) {
+StoreManager *GR::CreateFlatStoreManager(GRStateManager &StMgr) {
   return new FlatStoreManager(StMgr);
 }
 
diff --git a/lib/GR/FrontendActions.cpp b/lib/GR/FrontendActions.cpp
index e3ef60b..2097657 100644
--- a/lib/GR/FrontendActions.cpp
+++ b/lib/GR/FrontendActions.cpp
@@ -11,6 +11,7 @@
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/GR/AnalysisConsumer.h"
 using namespace clang;
+using namespace GR;
 
 ASTConsumer *AnalysisAction::CreateASTConsumer(CompilerInstance &CI,
                                                llvm::StringRef InFile) {
diff --git a/lib/GR/GRBlockCounter.cpp b/lib/GR/GRBlockCounter.cpp
index 6a19917..8a026b1 100644
--- a/lib/GR/GRBlockCounter.cpp
+++ b/lib/GR/GRBlockCounter.cpp
@@ -17,6 +17,7 @@
 #include "llvm/ADT/ImmutableMap.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 
diff --git a/lib/GR/GRCXXExprEngine.cpp b/lib/GR/GRCXXExprEngine.cpp
index 73b8b27..2462955 100644
--- a/lib/GR/GRCXXExprEngine.cpp
+++ b/lib/GR/GRCXXExprEngine.cpp
@@ -16,6 +16,7 @@
 #include "clang/AST/DeclCXX.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class CallExprWLItem {
diff --git a/lib/GR/GRCoreEngine.cpp b/lib/GR/GRCoreEngine.cpp
index 9f34e89..092cb46 100644
--- a/lib/GR/GRCoreEngine.cpp
+++ b/lib/GR/GRCoreEngine.cpp
@@ -25,12 +25,15 @@
 using llvm::cast;
 using llvm::isa;
 using namespace clang;
+using namespace GR;
 
 // This should be removed in the future.
 namespace clang {
+namespace GR {
 GRTransferFuncs* MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
                                   const LangOptions& lopts);
 }
+}
 
 //===----------------------------------------------------------------------===//
 // Worklist classes for exploration of reachable states.
diff --git a/lib/GR/GRExprEngine.cpp b/lib/GR/GRExprEngine.cpp
index 8743f71..d6086c7 100644
--- a/lib/GR/GRExprEngine.cpp
+++ b/lib/GR/GRExprEngine.cpp
@@ -37,6 +37,7 @@
 #endif
 
 using namespace clang;
+using namespace GR;
 using llvm::dyn_cast;
 using llvm::dyn_cast_or_null;
 using llvm::cast;
diff --git a/lib/GR/GRState.cpp b/lib/GR/GRState.cpp
index 164cd8c..993fa1a 100644
--- a/lib/GR/GRState.cpp
+++ b/lib/GR/GRState.cpp
@@ -19,6 +19,7 @@
 #include "llvm/Support/raw_ostream.h"
 
 using namespace clang;
+using namespace GR;
 
 // Give the vtable for ConstraintManager somewhere to live.
 // FIXME: Move this elsewhere.
diff --git a/lib/GR/HTMLDiagnostics.cpp b/lib/GR/HTMLDiagnostics.cpp
index 0db63c7..0c059ff 100644
--- a/lib/GR/HTMLDiagnostics.cpp
+++ b/lib/GR/HTMLDiagnostics.cpp
@@ -26,6 +26,7 @@
 #include "llvm/Support/Path.h"
 
 using namespace clang;
+using namespace GR;
 
 //===----------------------------------------------------------------------===//
 // Boilerplate.
@@ -77,7 +78,7 @@
 }
 
 PathDiagnosticClient*
-clang::createHTMLDiagnosticClient(const std::string& prefix,
+GR::createHTMLDiagnosticClient(const std::string& prefix,
                                   const Preprocessor &PP) {
   return new HTMLDiagnostics(prefix, PP);
 }
diff --git a/lib/GR/ManagerRegistry.cpp b/lib/GR/ManagerRegistry.cpp
index b1920e1..ab3a0a1 100644
--- a/lib/GR/ManagerRegistry.cpp
+++ b/lib/GR/ManagerRegistry.cpp
@@ -14,6 +14,7 @@
 #include "clang/GR/ManagerRegistry.h"
 
 using namespace clang;
+using namespace GR;
 
 StoreManagerCreator ManagerRegistry::StoreMgrCreator = 0;
 
diff --git a/lib/GR/MemRegion.cpp b/lib/GR/MemRegion.cpp
index a1dee53..1ae9ccf 100644
--- a/lib/GR/MemRegion.cpp
+++ b/lib/GR/MemRegion.cpp
@@ -22,6 +22,7 @@
 #include "llvm/Support/raw_ostream.h"
 
 using namespace clang;
+using namespace GR;
 
 //===----------------------------------------------------------------------===//
 // MemRegion Construction.
diff --git a/lib/GR/PathDiagnostic.cpp b/lib/GR/PathDiagnostic.cpp
index 1710643..b496560 100644
--- a/lib/GR/PathDiagnostic.cpp
+++ b/lib/GR/PathDiagnostic.cpp
@@ -20,6 +20,7 @@
 #include "llvm/Support/Casting.h"
 
 using namespace clang;
+using namespace GR;
 using llvm::dyn_cast;
 using llvm::isa;
 
diff --git a/lib/GR/PlistDiagnostics.cpp b/lib/GR/PlistDiagnostics.cpp
index 5b91f6e..35a46bf 100644
--- a/lib/GR/PlistDiagnostics.cpp
+++ b/lib/GR/PlistDiagnostics.cpp
@@ -21,6 +21,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 using namespace clang;
+using namespace GR;
 using llvm::cast;
 
 typedef llvm::DenseMap<FileID, unsigned> FIDMap;
@@ -97,7 +98,7 @@
   : OutputFile(output), LangOpts(LO), SubPD(subPD), flushed(false) {}
 
 PathDiagnosticClient*
-clang::createPlistDiagnosticClient(const std::string& s, const Preprocessor &PP,
+GR::createPlistDiagnosticClient(const std::string& s, const Preprocessor &PP,
                                    PathDiagnosticClient *subPD) {
   return new PlistDiagnostics(s, PP.getLangOptions(), subPD);
 }
diff --git a/lib/GR/RangeConstraintManager.cpp b/lib/GR/RangeConstraintManager.cpp
index 423777e..378cb6e 100644
--- a/lib/GR/RangeConstraintManager.cpp
+++ b/lib/GR/RangeConstraintManager.cpp
@@ -23,6 +23,7 @@
 #include "llvm/Support/raw_ostream.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace { class ConstraintRange {}; }
 static int ConstraintRangeIndex = 0;
@@ -194,12 +195,14 @@
 typedef llvm::ImmutableMap<SymbolRef,RangeSet> ConstraintRangeTy;
 
 namespace clang {
+namespace GR {
 template<>
 struct GRStateTrait<ConstraintRange>
   : public GRStatePartialTrait<ConstraintRangeTy> {
   static inline void* GDMIndex() { return &ConstraintRangeIndex; }
 };
 }
+}
 
 namespace {
 class RangeConstraintManager : public SimpleConstraintManager{
@@ -251,8 +254,8 @@
 
 } // end anonymous namespace
 
-ConstraintManager* clang::CreateRangeConstraintManager(GRStateManager&,
-                                                       GRSubEngine &subeng) {
+ConstraintManager* GR::CreateRangeConstraintManager(GRStateManager&,
+                                                    GRSubEngine &subeng) {
   return new RangeConstraintManager(subeng);
 }
 
diff --git a/lib/GR/RegionStore.cpp b/lib/GR/RegionStore.cpp
index a310b19..f2c4737 100644
--- a/lib/GR/RegionStore.cpp
+++ b/lib/GR/RegionStore.cpp
@@ -29,6 +29,7 @@
 #include "llvm/Support/raw_ostream.h"
 
 using namespace clang;
+using namespace GR;
 using llvm::Optional;
 
 //===----------------------------------------------------------------------===//
@@ -403,12 +404,12 @@
 // RegionStore creation.
 //===----------------------------------------------------------------------===//
 
-StoreManager *clang::CreateRegionStoreManager(GRStateManager& StMgr) {
+StoreManager *GR::CreateRegionStoreManager(GRStateManager& StMgr) {
   RegionStoreFeatures F = maximal_features_tag();
   return new RegionStoreManager(StMgr, F);
 }
 
-StoreManager *clang::CreateFieldsOnlyRegionStoreManager(GRStateManager &StMgr) {
+StoreManager *GR::CreateFieldsOnlyRegionStoreManager(GRStateManager &StMgr) {
   RegionStoreFeatures F = minimal_features_tag();
   F.enableFields(true);
   return new RegionStoreManager(StMgr, F);
diff --git a/lib/GR/SValBuilder.cpp b/lib/GR/SValBuilder.cpp
index 95829c2..daff8dd 100644
--- a/lib/GR/SValBuilder.cpp
+++ b/lib/GR/SValBuilder.cpp
@@ -19,6 +19,7 @@
 #include "clang/GR/PathSensitive/BasicValueFactory.h"
 
 using namespace clang;
+using namespace GR;
 
 //===----------------------------------------------------------------------===//
 // Basic SVal creation.
diff --git a/lib/GR/SVals.cpp b/lib/GR/SVals.cpp
index deccc4b..6040d5e 100644
--- a/lib/GR/SVals.cpp
+++ b/lib/GR/SVals.cpp
@@ -16,6 +16,7 @@
 #include "clang/Basic/IdentifierTable.h"
 
 using namespace clang;
+using namespace GR;
 using llvm::dyn_cast;
 using llvm::cast;
 using llvm::APSInt;
diff --git a/lib/GR/SimpleConstraintManager.cpp b/lib/GR/SimpleConstraintManager.cpp
index 7c246e4..991d0e8 100644
--- a/lib/GR/SimpleConstraintManager.cpp
+++ b/lib/GR/SimpleConstraintManager.cpp
@@ -19,6 +19,8 @@
 
 namespace clang {
 
+namespace GR {
+
 SimpleConstraintManager::~SimpleConstraintManager() {}
 
 bool SimpleConstraintManager::canReasonAbout(SVal X) const {
@@ -296,4 +298,6 @@
   } // end switch
 }
 
-}  // end of namespace clang
+} // end of namespace GR
+
+} // end of namespace clang
diff --git a/lib/GR/SimpleConstraintManager.h b/lib/GR/SimpleConstraintManager.h
index 45742eb..442f0ca 100644
--- a/lib/GR/SimpleConstraintManager.h
+++ b/lib/GR/SimpleConstraintManager.h
@@ -11,14 +11,16 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H
-#define LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H
+#ifndef LLVM_CLANG_GR_SIMPLE_CONSTRAINT_MANAGER_H
+#define LLVM_CLANG_GR_SIMPLE_CONSTRAINT_MANAGER_H
 
 #include "clang/GR/PathSensitive/ConstraintManager.h"
 #include "clang/GR/PathSensitive/GRState.h"
 
 namespace clang {
 
+namespace GR {
+
 class SimpleConstraintManager : public ConstraintManager {
   GRSubEngine &SU;
 public:
@@ -84,6 +86,8 @@
   const GRState *assumeAux(const GRState *state, NonLoc Cond, bool Assumption);
 };
 
-}  // end clang namespace
+} // end GR namespace
+
+} // end clang namespace
 
 #endif
diff --git a/lib/GR/SimpleSValBuilder.cpp b/lib/GR/SimpleSValBuilder.cpp
index 1beb055..03f8e30 100644
--- a/lib/GR/SimpleSValBuilder.cpp
+++ b/lib/GR/SimpleSValBuilder.cpp
@@ -15,6 +15,7 @@
 #include "clang/GR/PathSensitive/GRState.h"
 
 using namespace clang;
+using namespace GR;
 
 namespace {
 class SimpleSValBuilder : public SValBuilder {
@@ -46,7 +47,7 @@
 };
 } // end anonymous namespace
 
-SValBuilder *clang::createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc,
+SValBuilder *GR::createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc,
                                             ASTContext &context,
                                             GRStateManager &stateMgr) {
   return new SimpleSValBuilder(alloc, context, stateMgr);
diff --git a/lib/GR/Store.cpp b/lib/GR/Store.cpp
index df13ab4..99c06e4 100644
--- a/lib/GR/Store.cpp
+++ b/lib/GR/Store.cpp
@@ -16,6 +16,7 @@
 #include "clang/AST/CharUnits.h"
 
 using namespace clang;
+using namespace GR;
 
 StoreManager::StoreManager(GRStateManager &stateMgr)
   : svalBuilder(stateMgr.getSValBuilder()), StateMgr(stateMgr),
diff --git a/lib/GR/SymbolManager.cpp b/lib/GR/SymbolManager.cpp
index 8dcdb14..95df307 100644
--- a/lib/GR/SymbolManager.cpp
+++ b/lib/GR/SymbolManager.cpp
@@ -18,6 +18,7 @@
 #include "llvm/Support/raw_ostream.h"
 
 using namespace clang;
+using namespace GR;
 
 void SymExpr::dump() const {
   dumpToStream(llvm::errs());
diff --git a/lib/GR/TextPathDiagnostics.cpp b/lib/GR/TextPathDiagnostics.cpp
index 343b211..c7a9f56 100644
--- a/lib/GR/TextPathDiagnostics.cpp
+++ b/lib/GR/TextPathDiagnostics.cpp
@@ -16,6 +16,7 @@
 #include "clang/Lex/Preprocessor.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace clang;
+using namespace GR;
 using namespace llvm;
 
 namespace {
@@ -47,7 +48,7 @@
 } // end anonymous namespace
 
 PathDiagnosticClient*
-clang::createTextPathDiagnosticClient(const std::string& out,
+GR::createTextPathDiagnosticClient(const std::string& out,
                                       const Preprocessor &PP) {
   return new TextPathDiagnostics(out, PP.getDiagnostics());
 }