Author: Bruno Ricci
Date: 2020-07-02T19:40:09+01:00
New Revision: fcf4d5e4499a391dff42ea1a096f146db44147b6

URL: 
https://github.com/llvm/llvm-project/commit/fcf4d5e4499a391dff42ea1a096f146db44147b6
DIFF: 
https://github.com/llvm/llvm-project/commit/fcf4d5e4499a391dff42ea1a096f146db44147b6.diff

LOG: Revert "[clang][NFC] Store a pointer to the ASTContext in ASTDumper and 
TextNodeDumper"

This reverts commit aa7fd905e4e1bc510448431da9310e8cf5197523.

I missed some dump() functions.

Added: 
    

Modified: 
    clang-tools-extra/clang-query/Query.cpp
    clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp
    clang/include/clang/AST/APValue.h
    clang/include/clang/AST/ASTDumper.h
    clang/include/clang/AST/ASTTypeTraits.h
    clang/include/clang/AST/Comment.h
    clang/include/clang/AST/Stmt.h
    clang/include/clang/AST/TextNodeDumper.h
    clang/include/clang/AST/Type.h
    clang/lib/AST/APValue.cpp
    clang/lib/AST/ASTDumper.cpp
    clang/lib/AST/ASTTypeTraits.cpp
    clang/lib/AST/TextNodeDumper.cpp
    clang/lib/ASTMatchers/ASTMatchFinder.cpp
    clang/lib/CodeGen/CGExprComplex.cpp
    clang/lib/CodeGen/CGExprScalar.cpp
    clang/lib/Frontend/ASTConsumers.cpp
    clang/unittests/AST/CommentParser.cpp
    clang/unittests/AST/MatchVerifier.h

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-query/Query.cpp 
b/clang-tools-extra/clang-query/Query.cpp
index 4fe7110daed3..2fc7af6a56e1 100644
--- a/clang-tools-extra/clang-query/Query.cpp
+++ b/clang-tools-extra/clang-query/Query.cpp
@@ -157,7 +157,8 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession 
&QS) const {
           OS << "Binding for \"" << BI->first << "\":\n";
           const ASTContext &Ctx = AST->getASTContext();
           const SourceManager &SM = Ctx.getSourceManager();
-          ASTDumper Dumper(OS, Ctx, SM.getDiagnostics().getShowColors());
+          ASTDumper Dumper(OS, &Ctx.getCommentCommandTraits(), &SM,
+                SM.getDiagnostics().getShowColors(), Ctx.getPrintingPolicy());
           Dumper.SetTraversalKind(QS.TK);
           Dumper.Visit(BI->second);
           OS << "\n";

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp 
b/clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp
index b2b883d64567..616e100adf08 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp
@@ -62,7 +62,7 @@ REGISTER_TWEAK(DumpAST)
 llvm::Expected<Tweak::Effect> DumpAST::apply(const Selection &Inputs) {
   std::string Str;
   llvm::raw_string_ostream OS(Str);
-  Node->dump(OS, Inputs.AST->getASTContext());
+  Node->dump(OS, Inputs.AST->getSourceManager());
   return Effect::showMessage(std::move(OS.str()));
 }
 

diff  --git a/clang/include/clang/AST/APValue.h 
b/clang/include/clang/AST/APValue.h
index c69974c63c71..63359294ef63 100644
--- a/clang/include/clang/AST/APValue.h
+++ b/clang/include/clang/AST/APValue.h
@@ -372,7 +372,7 @@ class APValue {
   bool isAddrLabelDiff() const { return Kind == AddrLabelDiff; }
 
   void dump() const;
-  void dump(raw_ostream &OS, const ASTContext *Context) const;
+  void dump(raw_ostream &OS) const;
 
   void printPretty(raw_ostream &OS, const ASTContext &Ctx, QualType Ty) const;
   std::string getAsString(const ASTContext &Ctx, QualType Ty) const;

diff  --git a/clang/include/clang/AST/ASTDumper.h 
b/clang/include/clang/AST/ASTDumper.h
index a154bc2db3a7..f46ffb960db6 100644
--- a/clang/include/clang/AST/ASTDumper.h
+++ b/clang/include/clang/AST/ASTDumper.h
@@ -24,11 +24,18 @@ class ASTDumper : public ASTNodeTraverser<ASTDumper, 
TextNodeDumper> {
   const bool ShowColors;
 
 public:
-  ASTDumper(raw_ostream &OS, const ASTContext &Context, bool ShowColors)
-      : NodeDumper(OS, Context, ShowColors), OS(OS), ShowColors(ShowColors) {}
-
-  ASTDumper(raw_ostream &OS, bool ShowColors)
-      : NodeDumper(OS, ShowColors), OS(OS), ShowColors(ShowColors) {}
+  ASTDumper(raw_ostream &OS, const comments::CommandTraits *Traits,
+            const SourceManager *SM)
+      : ASTDumper(OS, Traits, SM, SM && SM->getDiagnostics().getShowColors()) 
{}
+
+  ASTDumper(raw_ostream &OS, const comments::CommandTraits *Traits,
+            const SourceManager *SM, bool ShowColors)
+      : ASTDumper(OS, Traits, SM, ShowColors, LangOptions()) {}
+  ASTDumper(raw_ostream &OS, const comments::CommandTraits *Traits,
+            const SourceManager *SM, bool ShowColors,
+            const PrintingPolicy &PrintPolicy)
+      : NodeDumper(OS, ShowColors, SM, PrintPolicy, Traits), OS(OS),
+        ShowColors(ShowColors) {}
 
   TextNodeDumper &doGetNodeDelegate() { return NodeDumper; }
 

diff  --git a/clang/include/clang/AST/ASTTypeTraits.h 
b/clang/include/clang/AST/ASTTypeTraits.h
index 328b7bce6ba5..67fa4ab1b6a4 100644
--- a/clang/include/clang/AST/ASTTypeTraits.h
+++ b/clang/include/clang/AST/ASTTypeTraits.h
@@ -278,7 +278,7 @@ class DynTypedNode {
   void print(llvm::raw_ostream &OS, const PrintingPolicy &PP) const;
 
   /// Dumps the node to the given output stream.
-  void dump(llvm::raw_ostream &OS, const ASTContext &Context) const;
+  void dump(llvm::raw_ostream &OS, SourceManager &SM) const;
 
   /// For nodes which represent textual entities in the source code,
   /// return their SourceRange.  For all other nodes, return SourceRange().

diff  --git a/clang/include/clang/AST/Comment.h 
b/clang/include/clang/AST/Comment.h
index 54a4b0a9cfe6..cd9c1ce2bce0 100644
--- a/clang/include/clang/AST/Comment.h
+++ b/clang/include/clang/AST/Comment.h
@@ -209,7 +209,9 @@ class Comment {
 
   void dump() const;
   void dumpColor() const;
-  void dump(raw_ostream &OS, const ASTContext &Context) const;
+  void dump(const ASTContext &Context) const;
+  void dump(raw_ostream &OS, const CommandTraits *Traits,
+            const SourceManager *SM) const;
 
   SourceRange getSourceRange() const LLVM_READONLY { return Range; }
 

diff  --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h
index 01d4301922f8..6c3f036d45ca 100644
--- a/clang/include/clang/AST/Stmt.h
+++ b/clang/include/clang/AST/Stmt.h
@@ -1166,7 +1166,9 @@ class alignas(void *) Stmt {
   /// Dumps the specified AST fragment and all subtrees to
   /// \c llvm::errs().
   void dump() const;
-  void dump(raw_ostream &OS, const ASTContext &Context) const;
+  void dump(SourceManager &SM) const;
+  void dump(raw_ostream &OS, SourceManager &SM) const;
+  void dump(raw_ostream &OS) const;
 
   /// \return Unique reproducible object identifier
   int64_t getID(const ASTContext &Context) const;

diff  --git a/clang/include/clang/AST/TextNodeDumper.h 
b/clang/include/clang/AST/TextNodeDumper.h
index d2ec153ce67c..b069bd09287a 100644
--- a/clang/include/clang/AST/TextNodeDumper.h
+++ b/clang/include/clang/AST/TextNodeDumper.h
@@ -139,23 +139,19 @@ class TextNodeDumper
   const char *LastLocFilename = "";
   unsigned LastLocLine = ~0U;
 
-  /// \p Context, \p SM, and \p Traits can be null. This is because we want
-  /// to be able to call \p dump() in a debugger without having to pass the
-  /// \p ASTContext to \p dump. Not all parts of the AST dump output will be
-  /// available without the \p ASTContext.
-  const ASTContext *Context = nullptr;
-  const SourceManager *SM = nullptr;
+  const SourceManager *SM;
 
   /// The policy to use for printing; can be defaulted.
-  PrintingPolicy PrintPolicy = LangOptions();
+  PrintingPolicy PrintPolicy;
 
-  const comments::CommandTraits *Traits = nullptr;
+  const comments::CommandTraits *Traits;
 
   const char *getCommandName(unsigned CommandID);
 
 public:
-  TextNodeDumper(raw_ostream &OS, const ASTContext &Context, bool ShowColors);
-  TextNodeDumper(raw_ostream &OS, bool ShowColors);
+  TextNodeDumper(raw_ostream &OS, bool ShowColors, const SourceManager *SM,
+                 const PrintingPolicy &PrintPolicy,
+                 const comments::CommandTraits *Traits);
 
   void Visit(const comments::Comment *C, const comments::FullComment *FC);
 

diff  --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 0fc50e0e799f..10b8b41efeeb 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -1058,7 +1058,7 @@ class QualType {
 
   void dump(const char *s) const;
   void dump() const;
-  void dump(llvm::raw_ostream &OS, const ASTContext &Context) const;
+  void dump(llvm::raw_ostream &OS) const;
 
   void Profile(llvm::FoldingSetNodeID &ID) const {
     ID.AddPointer(getAsOpaquePtr());
@@ -2471,7 +2471,7 @@ class alignas(8) Type : public ExtQualsTypeCommonBase {
 
   CanQualType getCanonicalTypeUnqualified() const; // in CanonicalType.h
   void dump() const;
-  void dump(llvm::raw_ostream &OS, const ASTContext &Context) const;
+  void dump(llvm::raw_ostream &OS) const;
 };
 
 /// This will check for a TypedefType by removing any existing sugar

diff  --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp
index 417916241d79..50f8d05dacb4 100644
--- a/clang/lib/AST/APValue.cpp
+++ b/clang/lib/AST/APValue.cpp
@@ -378,6 +378,11 @@ void APValue::swap(APValue &RHS) {
   memcpy(RHS.Data.buffer, TmpData, DataSize);
 }
 
+LLVM_DUMP_METHOD void APValue::dump() const {
+  dump(llvm::errs());
+  llvm::errs() << '\n';
+}
+
 static double GetApproxValue(const llvm::APFloat &F) {
   llvm::APFloat V = F;
   bool ignored;
@@ -386,13 +391,7 @@ static double GetApproxValue(const llvm::APFloat &F) {
   return V.convertToDouble();
 }
 
-LLVM_DUMP_METHOD void APValue::dump() const {
-  dump(llvm::errs(), /*Context=*/nullptr);
-  llvm::errs() << '\n';
-}
-
-LLVM_DUMP_METHOD void APValue::dump(raw_ostream &OS,
-                                    const ASTContext *Context) const {
+void APValue::dump(raw_ostream &OS) const {
   switch (getKind()) {
   case None:
     OS << "None";
@@ -411,10 +410,10 @@ LLVM_DUMP_METHOD void APValue::dump(raw_ostream &OS,
     return;
   case Vector:
     OS << "Vector: ";
-    getVectorElt(0).dump(OS, Context);
+    getVectorElt(0).dump(OS);
     for (unsigned i = 1; i != getVectorLength(); ++i) {
       OS << ", ";
-      getVectorElt(i).dump(OS, Context);
+      getVectorElt(i).dump(OS);
     }
     return;
   case ComplexInt:
@@ -430,37 +429,36 @@ LLVM_DUMP_METHOD void APValue::dump(raw_ostream &OS,
   case Array:
     OS << "Array: ";
     for (unsigned I = 0, N = getArrayInitializedElts(); I != N; ++I) {
-      getArrayInitializedElt(I).dump(OS, Context);
-      if (I != getArraySize() - 1)
-        OS << ", ";
+      getArrayInitializedElt(I).dump(OS);
+      if (I != getArraySize() - 1) OS << ", ";
     }
     if (hasArrayFiller()) {
       OS << getArraySize() - getArrayInitializedElts() << " x ";
-      getArrayFiller().dump(OS, Context);
+      getArrayFiller().dump(OS);
     }
     return;
   case Struct:
     OS << "Struct ";
     if (unsigned N = getStructNumBases()) {
       OS << " bases: ";
-      getStructBase(0).dump(OS, Context);
+      getStructBase(0).dump(OS);
       for (unsigned I = 1; I != N; ++I) {
         OS << ", ";
-        getStructBase(I).dump(OS, Context);
+        getStructBase(I).dump(OS);
       }
     }
     if (unsigned N = getStructNumFields()) {
       OS << " fields: ";
-      getStructField(0).dump(OS, Context);
+      getStructField(0).dump(OS);
       for (unsigned I = 1; I != N; ++I) {
         OS << ", ";
-        getStructField(I).dump(OS, Context);
+        getStructField(I).dump(OS);
       }
     }
     return;
   case Union:
     OS << "Union: ";
-    getUnionValue().dump(OS, Context);
+    getUnionValue().dump(OS);
     return;
   case MemberPointer:
     OS << "MemberPointer: <todo>";

diff  --git a/clang/lib/AST/ASTDumper.cpp b/clang/lib/AST/ASTDumper.cpp
index 08a6d0cbd261..d7a25cc827aa 100644
--- a/clang/lib/AST/ASTDumper.cpp
+++ b/clang/lib/AST/ASTDumper.cpp
@@ -159,22 +159,17 @@ void QualType::dump(const char *msg) const {
   dump();
 }
 
-LLVM_DUMP_METHOD void QualType::dump() const {
-  ASTDumper Dumper(llvm::errs(), /*ShowColors=*/false);
-  Dumper.Visit(*this);
-}
+LLVM_DUMP_METHOD void QualType::dump() const { dump(llvm::errs()); }
 
-LLVM_DUMP_METHOD void QualType::dump(llvm::raw_ostream &OS,
-                                     const ASTContext &Context) const {
-  ASTDumper Dumper(OS, Context, Context.getDiagnostics().getShowColors());
+LLVM_DUMP_METHOD void QualType::dump(llvm::raw_ostream &OS) const {
+  ASTDumper Dumper(OS, nullptr, nullptr);
   Dumper.Visit(*this);
 }
 
-LLVM_DUMP_METHOD void Type::dump() const { QualType(this, 0).dump(); }
+LLVM_DUMP_METHOD void Type::dump() const { dump(llvm::errs()); }
 
-LLVM_DUMP_METHOD void Type::dump(llvm::raw_ostream &OS,
-                                 const ASTContext &Context) const {
-  QualType(this, 0).dump(OS, Context);
+LLVM_DUMP_METHOD void Type::dump(llvm::raw_ostream &OS) const {
+  QualType(this, 0).dump(OS);
 }
 
 
//===----------------------------------------------------------------------===//
@@ -194,7 +189,8 @@ LLVM_DUMP_METHOD void Decl::dump(raw_ostream &OS, bool 
Deserialize,
     (void)Deserialize; // FIXME?
     P.Visit(this);
   } else {
-    ASTDumper P(OS, Ctx, Ctx.getDiagnostics().getShowColors());
+    ASTDumper P(OS, &Ctx.getCommentCommandTraits(), &SM,
+                SM.getDiagnostics().getShowColors(), Ctx.getPrintingPolicy());
     P.setDeserialize(Deserialize);
     P.Visit(this);
   }
@@ -202,7 +198,9 @@ LLVM_DUMP_METHOD void Decl::dump(raw_ostream &OS, bool 
Deserialize,
 
 LLVM_DUMP_METHOD void Decl::dumpColor() const {
   const ASTContext &Ctx = getASTContext();
-  ASTDumper P(llvm::errs(), Ctx, /*ShowColors=*/true);
+  ASTDumper P(llvm::errs(), &Ctx.getCommentCommandTraits(),
+              &Ctx.getSourceManager(), /*ShowColors*/ true,
+              Ctx.getPrintingPolicy());
   P.Visit(this);
 }
 
@@ -216,8 +214,10 @@ LLVM_DUMP_METHOD void DeclContext::dumpLookups(raw_ostream 
&OS,
   const DeclContext *DC = this;
   while (!DC->isTranslationUnit())
     DC = DC->getParent();
-  const ASTContext &Ctx = cast<TranslationUnitDecl>(DC)->getASTContext();
-  ASTDumper P(OS, Ctx, Ctx.getDiagnostics().getShowColors());
+  ASTContext &Ctx = cast<TranslationUnitDecl>(DC)->getASTContext();
+  const SourceManager &SM = Ctx.getSourceManager();
+  ASTDumper P(OS, &Ctx.getCommentCommandTraits(), &Ctx.getSourceManager(),
+              SM.getDiagnostics().getShowColors(), Ctx.getPrintingPolicy());
   P.setDeserialize(Deserialize);
   P.dumpLookups(this, DumpDecls);
 }
@@ -226,19 +226,27 @@ LLVM_DUMP_METHOD void 
DeclContext::dumpLookups(raw_ostream &OS,
 // Stmt method implementations
 
//===----------------------------------------------------------------------===//
 
-LLVM_DUMP_METHOD void Stmt::dump() const {
-  ASTDumper P(llvm::errs(), /*ShowColors=*/false);
+LLVM_DUMP_METHOD void Stmt::dump(SourceManager &SM) const {
+  dump(llvm::errs(), SM);
+}
+
+LLVM_DUMP_METHOD void Stmt::dump(raw_ostream &OS, SourceManager &SM) const {
+  ASTDumper P(OS, nullptr, &SM);
+  P.Visit(this);
+}
+
+LLVM_DUMP_METHOD void Stmt::dump(raw_ostream &OS) const {
+  ASTDumper P(OS, nullptr, nullptr);
   P.Visit(this);
 }
 
-LLVM_DUMP_METHOD void Stmt::dump(raw_ostream &OS,
-                                 const ASTContext &Context) const {
-  ASTDumper P(OS, Context, Context.getDiagnostics().getShowColors());
+LLVM_DUMP_METHOD void Stmt::dump() const {
+  ASTDumper P(llvm::errs(), nullptr, nullptr);
   P.Visit(this);
 }
 
 LLVM_DUMP_METHOD void Stmt::dumpColor() const {
-  ASTDumper P(llvm::errs(), /*ShowColors=*/true);
+  ASTDumper P(llvm::errs(), nullptr, nullptr, /*ShowColors*/true);
   P.Visit(this);
 }
 
@@ -247,26 +255,27 @@ LLVM_DUMP_METHOD void Stmt::dumpColor() const {
 
//===----------------------------------------------------------------------===//
 
 LLVM_DUMP_METHOD void Comment::dump() const {
-  const auto *FC = dyn_cast<FullComment>(this);
-  if (!FC)
-    return;
-  ASTDumper Dumper(llvm::errs(), /*ShowColors=*/false);
-  Dumper.Visit(FC, FC);
+  dump(llvm::errs(), nullptr, nullptr);
+}
+
+LLVM_DUMP_METHOD void Comment::dump(const ASTContext &Context) const {
+  dump(llvm::errs(), &Context.getCommentCommandTraits(),
+       &Context.getSourceManager());
 }
 
-LLVM_DUMP_METHOD void Comment::dump(raw_ostream &OS,
-                                    const ASTContext &Context) const {
-  const auto *FC = dyn_cast<FullComment>(this);
+void Comment::dump(raw_ostream &OS, const CommandTraits *Traits,
+                   const SourceManager *SM) const {
+  const FullComment *FC = dyn_cast<FullComment>(this);
   if (!FC)
     return;
-  ASTDumper Dumper(OS, Context, Context.getDiagnostics().getShowColors());
-  Dumper.Visit(FC, FC);
+  ASTDumper D(OS, Traits, SM);
+  D.Visit(FC, FC);
 }
 
 LLVM_DUMP_METHOD void Comment::dumpColor() const {
-  const auto *FC = dyn_cast<FullComment>(this);
+  const FullComment *FC = dyn_cast<FullComment>(this);
   if (!FC)
     return;
-  ASTDumper Dumper(llvm::errs(), /*ShowColors=*/true);
-  Dumper.Visit(FC, FC);
+  ASTDumper D(llvm::errs(), nullptr, nullptr, /*ShowColors*/true);
+  D.Visit(FC, FC);
 }

diff  --git a/clang/lib/AST/ASTTypeTraits.cpp b/clang/lib/AST/ASTTypeTraits.cpp
index 34fc587694be..ccfc11565885 100644
--- a/clang/lib/AST/ASTTypeTraits.cpp
+++ b/clang/lib/AST/ASTTypeTraits.cpp
@@ -152,14 +152,13 @@ void DynTypedNode::print(llvm::raw_ostream &OS,
     OS << "Unable to print values of type " << NodeKind.asStringRef() << "\n";
 }
 
-void DynTypedNode::dump(llvm::raw_ostream &OS,
-                        const ASTContext &Context) const {
+void DynTypedNode::dump(llvm::raw_ostream &OS, SourceManager &SM) const {
   if (const Decl *D = get<Decl>())
     D->dump(OS);
   else if (const Stmt *S = get<Stmt>())
-    S->dump(OS, Context);
+    S->dump(OS, SM);
   else if (const Type *T = get<Type>())
-    T->dump(OS, Context);
+    T->dump(OS);
   else
     OS << "Unable to dump values of type " << NodeKind.asStringRef() << "\n";
 }

diff  --git a/clang/lib/AST/TextNodeDumper.cpp 
b/clang/lib/AST/TextNodeDumper.cpp
index 74966f804fe3..0d49c443e03e 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -51,15 +51,12 @@ static void dumpPreviousDecl(raw_ostream &OS, const Decl 
*D) {
   llvm_unreachable("Decl that isn't part of DeclNodes.inc!");
 }
 
-TextNodeDumper::TextNodeDumper(raw_ostream &OS, const ASTContext &Context,
-                               bool ShowColors)
-    : TextTreeStructure(OS, ShowColors), OS(OS), ShowColors(ShowColors),
-      Context(&Context), SM(&Context.getSourceManager()),
-      PrintPolicy(Context.getPrintingPolicy()),
-      Traits(&Context.getCommentCommandTraits()) {}
-
-TextNodeDumper::TextNodeDumper(raw_ostream &OS, bool ShowColors)
-    : TextTreeStructure(OS, ShowColors), OS(OS), ShowColors(ShowColors) {}
+TextNodeDumper::TextNodeDumper(raw_ostream &OS, bool ShowColors,
+                               const SourceManager *SM,
+                               const PrintingPolicy &PrintPolicy,
+                               const comments::CommandTraits *Traits)
+    : TextTreeStructure(OS, ShowColors), OS(OS), ShowColors(ShowColors), 
SM(SM),
+      PrintPolicy(PrintPolicy), Traits(Traits) {}
 
 void TextNodeDumper::Visit(const comments::Comment *C,
                            const comments::FullComment *FC) {
@@ -715,7 +712,7 @@ void TextNodeDumper::VisitConstantExpr(const ConstantExpr 
*Node) {
   if (Node->getResultAPValueKind() != APValue::None) {
     ColorScope Color(OS, ShowColors, ValueColor);
     OS << " ";
-    Node->getAPValueResult().dump(OS, Context);
+    Node->getAPValueResult().dump(OS);
   }
 }
 

diff  --git a/clang/lib/ASTMatchers/ASTMatchFinder.cpp 
b/clang/lib/ASTMatchers/ASTMatchFinder.cpp
index e88da16dd3d4..563f3fc9a634 100644
--- a/clang/lib/ASTMatchers/ASTMatchFinder.cpp
+++ b/clang/lib/ASTMatchers/ASTMatchFinder.cpp
@@ -755,7 +755,7 @@ class MatchASTVisitor : public 
RecursiveASTVisitor<MatchASTVisitor>,
             return D->getKind() == Decl::TranslationUnit;
           })) {
         llvm::errs() << "Tried to match orphan node:\n";
-        Node.dump(llvm::errs(), *ActiveASTContext);
+        Node.dump(llvm::errs(), ActiveASTContext->getSourceManager());
         llvm_unreachable("Parent map should be complete!");
       }
 #endif

diff  --git a/clang/lib/CodeGen/CGExprComplex.cpp 
b/clang/lib/CodeGen/CGExprComplex.cpp
index a49817898ae3..13a571352137 100644
--- a/clang/lib/CodeGen/CGExprComplex.cpp
+++ b/clang/lib/CodeGen/CGExprComplex.cpp
@@ -98,7 +98,7 @@ class ComplexExprEmitter
   }
 
   ComplexPairTy VisitStmt(Stmt *S) {
-    S->dump(llvm::errs(), CGF.getContext());
+    S->dump(CGF.getContext().getSourceManager());
     llvm_unreachable("Stmt can't have complex result type!");
   }
   ComplexPairTy VisitExpr(Expr *S);

diff  --git a/clang/lib/CodeGen/CGExprScalar.cpp 
b/clang/lib/CodeGen/CGExprScalar.cpp
index 6131f97995dc..922aa95150ce 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -413,7 +413,7 @@ class ScalarExprEmitter
   }
 
   Value *VisitStmt(Stmt *S) {
-    S->dump(llvm::errs(), CGF.getContext());
+    S->dump(CGF.getContext().getSourceManager());
     llvm_unreachable("Stmt can't have complex result type!");
   }
   Value *VisitExpr(Expr *S);

diff  --git a/clang/lib/Frontend/ASTConsumers.cpp 
b/clang/lib/Frontend/ASTConsumers.cpp
index a73cc8876d5d..12fda45d0ef0 100644
--- a/clang/lib/Frontend/ASTConsumers.cpp
+++ b/clang/lib/Frontend/ASTConsumers.cpp
@@ -103,9 +103,9 @@ namespace {
         // FIXME: Support OutputFormat in type dumping.
         // FIXME: Support combining -ast-dump-decl-types with 
-ast-dump-lookups.
         if (auto *VD = dyn_cast<ValueDecl>(InnerD))
-          VD->getType().dump(Out, VD->getASTContext());
+          VD->getType().dump(Out);
         if (auto *TD = dyn_cast<TypeDecl>(InnerD))
-          TD->getTypeForDecl()->dump(Out, TD->getASTContext());
+          TD->getTypeForDecl()->dump(Out);
       }
     }
 

diff  --git a/clang/unittests/AST/CommentParser.cpp 
b/clang/unittests/AST/CommentParser.cpp
index ba8b34ebcd38..327cabd619bd 100644
--- a/clang/unittests/AST/CommentParser.cpp
+++ b/clang/unittests/AST/CommentParser.cpp
@@ -64,7 +64,7 @@ FullComment *CommentParserTest::parseString(const char 
*Source) {
 
   if (MY_DEBUG) {
     llvm::errs() << "=== Source:\n" << Source << "\n=== AST:\n";
-    FC->dump();
+    FC->dump(llvm::errs(), &Traits, &SourceMgr);
   }
 
   Token Tok;

diff  --git a/clang/unittests/AST/MatchVerifier.h 
b/clang/unittests/AST/MatchVerifier.h
index 217c1abcff69..3fb22ef00f98 100644
--- a/clang/unittests/AST/MatchVerifier.h
+++ b/clang/unittests/AST/MatchVerifier.h
@@ -271,7 +271,7 @@ class DumpVerifier : public MatchVerifier<DynTypedNode> {
               const DynTypedNode &Node) override {
     std::string DumpStr;
     llvm::raw_string_ostream Dump(DumpStr);
-    Node.dump(Dump, *Result.Context);
+    Node.dump(Dump, *Result.SourceManager);
 
     if (Dump.str().find(ExpectSubstring) == std::string::npos) {
       std::string MsgStr;


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to