[PATCH] D44975: Change DEBUG() macro to LLVM_DEBUG()

2018-05-15 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL332350: [clang] Update uses of DEBUG macro to LLVM_DEBUG. 
(authored by nzaghen, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D44975?vs=140055=146806#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D44975

Files:
  cfe/trunk/lib/AST/ExprConstant.cpp
  cfe/trunk/lib/Analysis/BodyFarm.cpp
  cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
  cfe/trunk/lib/Format/BreakableToken.cpp
  cfe/trunk/lib/Format/ContinuationIndenter.cpp
  cfe/trunk/lib/Format/Format.cpp
  cfe/trunk/lib/Format/SortJavaScriptImports.cpp
  cfe/trunk/lib/Format/TokenAnalyzer.cpp
  cfe/trunk/lib/Format/TokenAnnotator.cpp
  cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp
  cfe/trunk/lib/Format/UnwrappedLineParser.cpp
  cfe/trunk/lib/Format/UsingDeclarationsSorter.cpp
  cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp
  cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
  cfe/trunk/lib/Tooling/Tooling.cpp
  cfe/trunk/unittests/Format/FormatTest.cpp
  cfe/trunk/unittests/Format/FormatTestComments.cpp
  cfe/trunk/unittests/Format/FormatTestJS.cpp
  cfe/trunk/unittests/Format/FormatTestJava.cpp
  cfe/trunk/unittests/Format/FormatTestObjC.cpp
  cfe/trunk/unittests/Format/FormatTestProto.cpp
  cfe/trunk/unittests/Format/FormatTestRawStrings.cpp
  cfe/trunk/unittests/Format/FormatTestSelective.cpp
  cfe/trunk/unittests/Format/FormatTestTextProto.cpp
  cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp
  cfe/trunk/unittests/Format/UsingDeclarationsSorterTest.cpp
  cfe/trunk/unittests/libclang/LibclangTest.cpp

Index: cfe/trunk/lib/Tooling/Tooling.cpp
===
--- cfe/trunk/lib/Tooling/Tooling.cpp
+++ cfe/trunk/lib/Tooling/Tooling.cpp
@@ -473,7 +473,7 @@
 
   // FIXME: We need a callback mechanism for the tool writer to output a
   // customized message for each file.
-  DEBUG({ llvm::dbgs() << "Processing: " << File << ".\n"; });
+  LLVM_DEBUG({ llvm::dbgs() << "Processing: " << File << ".\n"; });
   ToolInvocation Invocation(std::move(CommandLine), Action, Files.get(),
 PCHContainerOps);
   Invocation.setDiagnosticConsumer(DiagConsumer);
Index: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
===
--- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
+++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
@@ -290,7 +290,7 @@
 else
   ASTSym->setSection("__clangast");
 
-DEBUG({
+LLVM_DEBUG({
   // Print the IR for the PCH container to the debug output.
   llvm::SmallString<0> Buffer;
   clang::EmitBackendOutput(
Index: cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -1244,8 +1244,8 @@
 if (!Overflow)
   Overflow = checkedMul(Mult, offset.getQuantity());
 if (Overflow) {
-  DEBUG(llvm::dbgs() << "MemRegion::getAsArrayOffset: "
- << "offset overflowing, returning unknown\n");
+  LLVM_DEBUG(llvm::dbgs() << "MemRegion::getAsArrayOffset: "
+  << "offset overflowing, returning unknown\n");
 
   return nullptr;
 }
Index: cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -399,10 +399,10 @@
 getManager()->getContext(FD);
   bool IsAutosynthesized;
   Stmt* Body = AD->getBody(IsAutosynthesized);
-  DEBUG({
-  if (IsAutosynthesized)
-llvm::dbgs() << "Using autosynthesized body for " << FD->getName()
- << "\n";
+  LLVM_DEBUG({
+if (IsAutosynthesized)
+  llvm::dbgs() << "Using autosynthesized body for " << FD->getName()
+   << "\n";
   });
   if (Body) {
 const Decl* Decl = AD->getDecl();
Index: cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp
===
--- cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp
+++ cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp
@@ -905,7 +905,8 @@
   Penalty = Queue.top().first.first;
   StateNode *Node = Queue.top().second;
   if (!Node->State.NextToken) {
-DEBUG(llvm::dbgs() << "\n---\nPenalty for line: " << Penalty << "\n");
+LLVM_DEBUG(llvm::dbgs()
+   << "\n---\nPenalty for line: " << Penalty << "\n");
 break;
   }
   Queue.pop();
@@ -929,16 +930,17 @@
 if (Queue.empty()) {
   // We were unable to find a solution, do nothing.
   // FIXME: Add diagnostic?
-  DEBUG(llvm::dbgs() 

[PATCH] D44975: Change DEBUG() macro to LLVM_DEBUG()

2018-04-10 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rC Clang

https://reviews.llvm.org/D44975



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


[PATCH] D44975: Change DEBUG() macro to LLVM_DEBUG()

2018-04-04 Thread Nicola Zaghen via Phabricator via cfe-commits
Nicola added a comment.

Ping? I'm not sure who to add as reviewers as it's generic change.


Repository:
  rC Clang

https://reviews.llvm.org/D44975



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


[PATCH] D44975: Change DEBUG() macro to LLVM_DEBUG()

2018-03-28 Thread Nicola Zaghen via Phabricator via cfe-commits
Nicola created this revision.
Herald added subscribers: cfe-commits, javed.absar, klimek.

The DEBUG() macro is too generic so it might clash with other projects.
This is going to be deprecated and replaced by LLVM_DEBUG() as soon as 
https://reviews.llvm.org/D43624 is submitted.

This is the command I used to do the replacement and formatting:
git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g'
git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 
-style LLVM

I avoided replacing the clang-format strings that used DEBUG() as a macro.


Repository:
  rC Clang

https://reviews.llvm.org/D44975

Files:
  lib/AST/ExprConstant.cpp
  lib/Analysis/BodyFarm.cpp
  lib/CodeGen/ObjectFilePCHContainerOperations.cpp
  lib/Format/BreakableToken.cpp
  lib/Format/ContinuationIndenter.cpp
  lib/Format/Format.cpp
  lib/Format/SortJavaScriptImports.cpp
  lib/Format/TokenAnalyzer.cpp
  lib/Format/TokenAnnotator.cpp
  lib/Format/UnwrappedLineFormatter.cpp
  lib/Format/UnwrappedLineParser.cpp
  lib/Format/UsingDeclarationsSorter.cpp
  lib/StaticAnalyzer/Core/CallEvent.cpp
  lib/StaticAnalyzer/Core/MemRegion.cpp
  lib/Tooling/Tooling.cpp
  unittests/Format/FormatTest.cpp
  unittests/Format/FormatTestComments.cpp
  unittests/Format/FormatTestJS.cpp
  unittests/Format/FormatTestJava.cpp
  unittests/Format/FormatTestObjC.cpp
  unittests/Format/FormatTestProto.cpp
  unittests/Format/FormatTestRawStrings.cpp
  unittests/Format/FormatTestSelective.cpp
  unittests/Format/FormatTestTextProto.cpp
  unittests/Format/NamespaceEndCommentsFixerTest.cpp
  unittests/Format/UsingDeclarationsSorterTest.cpp
  unittests/libclang/LibclangTest.cpp

Index: unittests/libclang/LibclangTest.cpp
===
--- unittests/libclang/LibclangTest.cpp
+++ unittests/libclang/LibclangTest.cpp
@@ -466,15 +466,17 @@
 unsigned NumDiagnostics = clang_getNumDiagnostics(ClangTU);
 for (unsigned i = 0; i < NumDiagnostics; ++i) {
   auto Diag = clang_getDiagnostic(ClangTU, i);
-  DEBUG(llvm::dbgs() << clang_getCString(clang_formatDiagnostic(
-  Diag, clang_defaultDiagnosticDisplayOptions())) << "\n");
+  LLVM_DEBUG(llvm::dbgs()
+ << clang_getCString(clang_formatDiagnostic(
+Diag, clang_defaultDiagnosticDisplayOptions()))
+ << "\n");
   clang_disposeDiagnostic(Diag);
 }
   }
   bool ReparseTU(unsigned num_unsaved_files, CXUnsavedFile* unsaved_files) {
 if (clang_reparseTranslationUnit(ClangTU, num_unsaved_files, unsaved_files,
  clang_defaultReparseOptions(ClangTU))) {
-  DEBUG(llvm::dbgs() << "Reparse failed\n");
+  LLVM_DEBUG(llvm::dbgs() << "Reparse failed\n");
   return false;
 }
 DisplayDiagnostics();
Index: unittests/Format/UsingDeclarationsSorterTest.cpp
===
--- unittests/Format/UsingDeclarationsSorterTest.cpp
+++ unittests/Format/UsingDeclarationsSorterTest.cpp
@@ -23,13 +23,13 @@
   std::string sortUsingDeclarations(llvm::StringRef Code,
 const std::vector ,
 const FormatStyle  = getLLVMStyle()) {
-DEBUG(llvm::errs() << "---\n");
-DEBUG(llvm::errs() << Code << "\n\n");
+LLVM_DEBUG(llvm::errs() << "---\n");
+LLVM_DEBUG(llvm::errs() << Code << "\n\n");
 tooling::Replacements Replaces =
 clang::format::sortUsingDeclarations(Style, Code, Ranges, "");
 auto Result = applyAllReplacements(Code, Replaces);
 EXPECT_TRUE(static_cast(Result));
-DEBUG(llvm::errs() << "\n" << *Result << "\n\n");
+LLVM_DEBUG(llvm::errs() << "\n" << *Result << "\n\n");
 return *Result;
   }
 
Index: unittests/Format/NamespaceEndCommentsFixerTest.cpp
===
--- unittests/Format/NamespaceEndCommentsFixerTest.cpp
+++ unittests/Format/NamespaceEndCommentsFixerTest.cpp
@@ -25,13 +25,13 @@
   fixNamespaceEndComments(llvm::StringRef Code,
   const std::vector ,
   const FormatStyle  = getLLVMStyle()) {
-DEBUG(llvm::errs() << "---\n");
-DEBUG(llvm::errs() << Code << "\n\n");
+LLVM_DEBUG(llvm::errs() << "---\n");
+LLVM_DEBUG(llvm::errs() << Code << "\n\n");
 tooling::Replacements Replaces =
 clang::format::fixNamespaceEndComments(Style, Code, Ranges, "");
 auto Result = applyAllReplacements(Code, Replaces);
 EXPECT_TRUE(static_cast(Result));
-DEBUG(llvm::errs() << "\n" << *Result << "\n\n");
+LLVM_DEBUG(llvm::errs() << "\n" << *Result << "\n\n");
 return *Result;
   }
 
Index: unittests/Format/FormatTestTextProto.cpp
===
--- unittests/Format/FormatTestTextProto.cpp
+++ unittests/Format/FormatTestTextProto.cpp
@@ -21,13 +21,13 @@
 protected:
   static