[llvm] ddc6ec9 - WithColor.h - reduce CommandLine.h include to forward declaration. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 23 09:08:36 PDT 2020


Author: Simon Pilgrim
Date: 2020-06-23T17:07:53+01:00
New Revision: ddc6ec9470bd081c358dea78e5c5d9babb20e034

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

LOG: WithColor.h - reduce CommandLine.h include to forward declaration. NFC.

WithColor.h is one of the most common headers, we can severely reduce its frontend impact (in ClangBuildAnalyzer reports) by removing the bulky CommandLine.h include, forward declaring llvm::cl::OptionCategory and just including raw_ostream.h instead.

Added: 
    

Modified: 
    llvm/include/llvm/Support/WithColor.h
    llvm/lib/Support/WithColor.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/WithColor.h b/llvm/include/llvm/Support/WithColor.h
index ed1f9e5c3de5..eea4a7229339 100644
--- a/llvm/include/llvm/Support/WithColor.h
+++ b/llvm/include/llvm/Support/WithColor.h
@@ -9,14 +9,17 @@
 #ifndef LLVM_SUPPORT_WITHCOLOR_H
 #define LLVM_SUPPORT_WITHCOLOR_H
 
-#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/raw_ostream.h"
 
 namespace llvm {
 
 class Error;
-class raw_ostream;
 class StringRef;
 
+namespace cl {
+class OptionCategory;
+}
+
 extern cl::OptionCategory ColorCategory;
 
 // Symbolic names for various syntax elements.

diff  --git a/llvm/lib/Support/WithColor.cpp b/llvm/lib/Support/WithColor.cpp
index 7e5fa17bb29c..cb5f413d44b7 100644
--- a/llvm/lib/Support/WithColor.cpp
+++ b/llvm/lib/Support/WithColor.cpp
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/WithColor.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/CommandLine.h"
 
 using namespace llvm;
 


        


More information about the llvm-commits mailing list