Rename DEBUG macro to LLVM_DEBUG.
    
The DEBUG() macro is very generic so it might clash with other projects.
The renaming was done as follows:
- 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
- Manual change to APInt
- Manually chage DOCS as regex doesn't match it.

In the transition period the DEBUG() macro is still present and aliased
to the LLVM_DEBUG() one.

Differential Revision: https://reviews.llvm.org/D43624

llvm-svn: 332240
diff --git a/llvm/tools/bugpoint/ExtractFunction.cpp b/llvm/tools/bugpoint/ExtractFunction.cpp
index 343ecd5..48f1575 100644
--- a/llvm/tools/bugpoint/ExtractFunction.cpp
+++ b/llvm/tools/bugpoint/ExtractFunction.cpp
@@ -324,9 +324,9 @@
   std::set<Function *> TestFunctions;
   for (unsigned i = 0, e = F.size(); i != e; ++i) {
     Function *TNOF = cast<Function>(VMap[F[i]]);
-    DEBUG(errs() << "Removing function ");
-    DEBUG(TNOF->printAsOperand(errs(), false));
-    DEBUG(errs() << "\n");
+    LLVM_DEBUG(errs() << "Removing function ");
+    LLVM_DEBUG(TNOF->printAsOperand(errs(), false));
+    LLVM_DEBUG(errs() << "\n");
     TestFunctions.insert(cast<Function>(NewVMap[TNOF]));
     DeleteFunctionBody(TNOF); // Function is now external in this module!
   }
diff --git a/llvm/tools/bugpoint/OptimizerDriver.cpp b/llvm/tools/bugpoint/OptimizerDriver.cpp
index 34f4478..bdb6c5f 100644
--- a/llvm/tools/bugpoint/OptimizerDriver.cpp
+++ b/llvm/tools/bugpoint/OptimizerDriver.cpp
@@ -226,10 +226,10 @@
     Args.push_back(*ExtraArgs);
   Args.push_back(nullptr);
 
-  DEBUG(errs() << "\nAbout to run:\t";
-        for (unsigned i = 0, e = Args.size() - 1; i != e; ++i) errs()
-        << " " << Args[i];
-        errs() << "\n";);
+  LLVM_DEBUG(errs() << "\nAbout to run:\t";
+             for (unsigned i = 0, e = Args.size() - 1; i != e; ++i) errs()
+             << " " << Args[i];
+             errs() << "\n";);
 
   Optional<StringRef> Redirects[3] = {None, None, None};
   // Redirect stdout and stderr to nowhere if SilencePasses is given.
diff --git a/llvm/tools/bugpoint/ToolRunner.cpp b/llvm/tools/bugpoint/ToolRunner.cpp
index ea0128d..2fb9f93 100644
--- a/llvm/tools/bugpoint/ToolRunner.cpp
+++ b/llvm/tools/bugpoint/ToolRunner.cpp
@@ -194,10 +194,10 @@
 
   outs() << "<lli>";
   outs().flush();
-  DEBUG(errs() << "\nAbout to run:\t";
-        for (unsigned i = 0, e = LLIArgs.size() - 1; i != e; ++i) errs()
-        << " " << LLIArgs[i];
-        errs() << "\n";);
+  LLVM_DEBUG(errs() << "\nAbout to run:\t";
+             for (unsigned i = 0, e = LLIArgs.size() - 1; i != e; ++i) errs()
+             << " " << LLIArgs[i];
+             errs() << "\n";);
   return RunProgramWithTimeout(LLIPath, &LLIArgs[0], InputFile, OutputFile,
                                OutputFile, Timeout, MemoryLimit);
 }
@@ -481,10 +481,10 @@
 
   outs() << (UseIntegratedAssembler ? "<llc-ia>" : "<llc>");
   outs().flush();
-  DEBUG(errs() << "\nAbout to run:\t";
-        for (unsigned i = 0, e = LLCArgs.size() - 1; i != e; ++i) errs()
-        << " " << LLCArgs[i];
-        errs() << "\n";);
+  LLVM_DEBUG(errs() << "\nAbout to run:\t";
+             for (unsigned i = 0, e = LLCArgs.size() - 1; i != e; ++i) errs()
+             << " " << LLCArgs[i];
+             errs() << "\n";);
   if (RunProgramWithTimeout(LLCPath, &LLCArgs[0], "", "", "", Timeout,
                             MemoryLimit))
     return ProcessFailure(LLCPath, &LLCArgs[0], Timeout, MemoryLimit);
@@ -601,11 +601,11 @@
 
   outs() << "<jit>";
   outs().flush();
-  DEBUG(errs() << "\nAbout to run:\t";
-        for (unsigned i = 0, e = JITArgs.size() - 1; i != e; ++i) errs()
-        << " " << JITArgs[i];
-        errs() << "\n";);
-  DEBUG(errs() << "\nSending output to " << OutputFile << "\n");
+  LLVM_DEBUG(errs() << "\nAbout to run:\t";
+             for (unsigned i = 0, e = JITArgs.size() - 1; i != e; ++i) errs()
+             << " " << JITArgs[i];
+             errs() << "\n";);
+  LLVM_DEBUG(errs() << "\nSending output to " << OutputFile << "\n");
   return RunProgramWithTimeout(LLIPath, &JITArgs[0], InputFile, OutputFile,
                                OutputFile, Timeout, MemoryLimit);
 }
@@ -710,10 +710,10 @@
 
   outs() << "<CC>";
   outs().flush();
-  DEBUG(errs() << "\nAbout to run:\t";
-        for (unsigned i = 0, e = CCArgs.size() - 1; i != e; ++i) errs()
-        << " " << CCArgs[i];
-        errs() << "\n";);
+  LLVM_DEBUG(errs() << "\nAbout to run:\t";
+             for (unsigned i = 0, e = CCArgs.size() - 1; i != e; ++i) errs()
+             << " " << CCArgs[i];
+             errs() << "\n";);
   if (RunProgramWithTimeout(CCPath, &CCArgs[0], "", "", ""))
     return ProcessFailure(CCPath, &CCArgs[0]);
 
@@ -758,15 +758,16 @@
   // Now that we have a binary, run it!
   outs() << "<program>";
   outs().flush();
-  DEBUG(errs() << "\nAbout to run:\t";
-        for (unsigned i = 0, e = ProgramArgs.size() - 1; i != e; ++i) errs()
-        << " " << ProgramArgs[i];
-        errs() << "\n";);
+  LLVM_DEBUG(
+      errs() << "\nAbout to run:\t";
+      for (unsigned i = 0, e = ProgramArgs.size() - 1; i != e; ++i) errs()
+      << " " << ProgramArgs[i];
+      errs() << "\n";);
 
   FileRemover OutputBinaryRemover(OutputBinary.str(), !SaveTemps);
 
   if (RemoteClientPath.empty()) {
-    DEBUG(errs() << "<run locally>");
+    LLVM_DEBUG(errs() << "<run locally>");
     std::string Error;
     int ExitCode = RunProgramWithTimeout(OutputBinary.str(), &ProgramArgs[0],
                                          InputFile, OutputFile, OutputFile,
@@ -855,10 +856,10 @@
 
   outs() << "<CC>";
   outs().flush();
-  DEBUG(errs() << "\nAbout to run:\t";
-        for (unsigned i = 0, e = CCArgs.size() - 1; i != e; ++i) errs()
-        << " " << CCArgs[i];
-        errs() << "\n";);
+  LLVM_DEBUG(errs() << "\nAbout to run:\t";
+             for (unsigned i = 0, e = CCArgs.size() - 1; i != e; ++i) errs()
+             << " " << CCArgs[i];
+             errs() << "\n";);
   if (RunProgramWithTimeout(CCPath, &CCArgs[0], "", "", ""))
     return ProcessFailure(CCPath, &CCArgs[0]);
   return Error::success();