WithColor.h - reduce CommandLine.h include to forward declaration. NFC.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 23 Jun 2020 15:55:59 +0000 (16:55 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 23 Jun 2020 16:07:53 +0000 (17:07 +0100)
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.

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

index ed1f9e5..eea4a72 100644 (file)
@@ -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.
index 7e5fa17..cb5f413 100644 (file)
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/WithColor.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/CommandLine.h"
 
 using namespace llvm;