Пример #1
0
WithColor::WithColor(llvm::raw_ostream &OS, enum HighlightColor Type) : OS(OS) {
  // Detect color from terminal type unless the user passed the --color option.
  if (UseColor == cl::BOU_UNSET ? OS.has_colors() : UseColor == cl::BOU_TRUE) {
    switch (Type) {
    case Address:    OS.changeColor(llvm::raw_ostream::YELLOW);  break;
    case String:     OS.changeColor(llvm::raw_ostream::GREEN);   break;
    case Tag:        OS.changeColor(llvm::raw_ostream::BLUE);    break;
    case Attribute:  OS.changeColor(llvm::raw_ostream::CYAN);    break;
    case Enumerator: OS.changeColor(llvm::raw_ostream::MAGENTA); break;
    }
  }
}
Пример #2
0
 void Transaction::DelayCallInfo::print(llvm::raw_ostream& Out, 
                                        const PrintingPolicy& Policy,
                                        unsigned Indent, 
                                        bool PrintInstantiation, 
                                   llvm::StringRef prependInfo /*=""*/) const {
   static const char* const stateNames[Transaction::kCCINumStates] = {
     "kCCINone",
     "kCCIHandleTopLevelDecl",
     "kCCIHandleInterestingDecl",
     "kCCIHandleTagDeclDefinition",
     "kCCIHandleVTable",
     "kCCIHandleCXXImplicitFunctionInstantiation",
     "kCCIHandleCXXStaticMemberVarInstantiation",
   };
   assert((sizeof(stateNames) /sizeof(void*)) == Transaction::kCCINumStates 
          && "Missing states?");
   if (!prependInfo.empty()) {
     Out.changeColor(llvm::raw_ostream::RED);
     Out << prependInfo;
     Out.resetColor();
     Out << ", ";
   }
   Out.changeColor(llvm::raw_ostream::BLUE);
   Out << stateNames[m_Call]; 
   Out.changeColor(llvm::raw_ostream::GREEN);
   Out << " <- ";
   Out.resetColor();
   for (DeclGroupRef::const_iterator I = m_DGR.begin(), E = m_DGR.end(); 
        I != E; ++I) {
       if (*I)
         (*I)->print(Out, Policy, Indent, PrintInstantiation);
       else
         Out << "<<NULL DECL>>";
       Out << '\n';
   }
 }
Пример #3
0
void Table::Dump(llvm::raw_ostream &OS, llvm::StringRef Prefix) const {
  for(unsigned I = 0, E = RowsCount(); I < E; ++I) {
    if(!Prefix.empty()) {
      OS.changeColor(llvm::raw_ostream::GREEN) << Prefix << ": ";
      OS.resetColor();
    }

    for(unsigned J = 0, K = ColsCount(); J < K; ++J) {
      llvm::StringRef Cell = Columns[J][I];
      OS.indent(Columns[J].GetWidth() - Cell.size()) << Cell;
      if(J != K - 1)
        OS << " ";
    }
    OS << "\n";
  }
}