[cfe-commits] r93966 - in /cfe/trunk/lib/Frontend: AnalysisConsumer.cpp CacheTokens.cpp DeclXML.cpp HTMLDiagnostics.cpp PCHWriter.cpp PlistDiagnostics.cpp RewriteObjC.cpp StmtXML.cpp TypeXML.cpp

Mike Stump mrs at apple.com
Tue Jan 19 18:03:14 PST 2010


Author: mrs
Date: Tue Jan 19 20:03:14 2010
New Revision: 93966

URL: http://llvm.org/viewvc/llvm-project?rev=93966&view=rev
Log:
Use the llvm coding convention for indentation for switch.

Modified:
    cfe/trunk/lib/Frontend/AnalysisConsumer.cpp
    cfe/trunk/lib/Frontend/CacheTokens.cpp
    cfe/trunk/lib/Frontend/DeclXML.cpp
    cfe/trunk/lib/Frontend/HTMLDiagnostics.cpp
    cfe/trunk/lib/Frontend/PCHWriter.cpp
    cfe/trunk/lib/Frontend/PlistDiagnostics.cpp
    cfe/trunk/lib/Frontend/RewriteObjC.cpp
    cfe/trunk/lib/Frontend/StmtXML.cpp
    cfe/trunk/lib/Frontend/TypeXML.cpp

Modified: cfe/trunk/lib/Frontend/AnalysisConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/AnalysisConsumer.cpp?rev=93966&r1=93965&r2=93966&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/trunk/lib/Frontend/AnalysisConsumer.cpp Tue Jan 19 20:03:14 2010
@@ -204,45 +204,45 @@
 
 void AnalysisConsumer::HandleTopLevelSingleDecl(Decl *D) {
   switch (D->getKind()) {
-    case Decl::Function: {
-      FunctionDecl* FD = cast<FunctionDecl>(D);
+  case Decl::Function: {
+    FunctionDecl* FD = cast<FunctionDecl>(D);
 
-      if (!Opts.AnalyzeSpecificFunction.empty() &&
-          Opts.AnalyzeSpecificFunction != FD->getIdentifier()->getName())
-        break;
-
-      Stmt* Body = FD->getBody();
-      if (Body) HandleCode(FD, Body, FunctionActions);
+    if (!Opts.AnalyzeSpecificFunction.empty() &&
+        Opts.AnalyzeSpecificFunction != FD->getIdentifier()->getName())
       break;
-    }
 
-    case Decl::ObjCMethod: {
-      ObjCMethodDecl* MD = cast<ObjCMethodDecl>(D);
+    Stmt* Body = FD->getBody();
+    if (Body) HandleCode(FD, Body, FunctionActions);
+    break;
+  }
 
-      if (Opts.AnalyzeSpecificFunction.size() > 0 &&
-          Opts.AnalyzeSpecificFunction != MD->getSelector().getAsString())
-        return;
+  case Decl::ObjCMethod: {
+    ObjCMethodDecl* MD = cast<ObjCMethodDecl>(D);
 
-      Stmt* Body = MD->getBody();
-      if (Body) HandleCode(MD, Body, ObjCMethodActions);
-      break;
-    }
+    if (Opts.AnalyzeSpecificFunction.size() > 0 &&
+        Opts.AnalyzeSpecificFunction != MD->getSelector().getAsString())
+      return;
 
-    case Decl::CXXMethod: {
-      CXXMethodDecl *CXXMD = cast<CXXMethodDecl>(D);
+    Stmt* Body = MD->getBody();
+    if (Body) HandleCode(MD, Body, ObjCMethodActions);
+    break;
+  }
 
-      if (Opts.AnalyzeSpecificFunction.size() > 0 &&
-          Opts.AnalyzeSpecificFunction != CXXMD->getName())
-        return;
-
-      Stmt *Body = CXXMD->getBody();
-      if (Body)
-        HandleCode(CXXMD, Body, FunctionActions);
-      break;
-    }
+  case Decl::CXXMethod: {
+    CXXMethodDecl *CXXMD = cast<CXXMethodDecl>(D);
 
-    default:
-      break;
+    if (Opts.AnalyzeSpecificFunction.size() > 0 &&
+        Opts.AnalyzeSpecificFunction != CXXMD->getName())
+      return;
+
+    Stmt *Body = CXXMD->getBody();
+    if (Body)
+      HandleCode(CXXMD, Body, FunctionActions);
+    break;
+  }
+
+  default:
+    break;
   }
 }
 
@@ -409,20 +409,20 @@
                                Decl *D) {
 
  switch (mgr.getLangOptions().getGCMode()) {
-   default:
-     assert (false && "Invalid GC mode.");
-   case LangOptions::NonGC:
-     ActionCheckerCFRefAux(C, mgr, D, false);
-     break;
-
-   case LangOptions::GCOnly:
-     ActionCheckerCFRefAux(C, mgr, D, true);
-     break;
-
-   case LangOptions::HybridGC:
-     ActionCheckerCFRefAux(C, mgr, D, false);
-     ActionCheckerCFRefAux(C, mgr, D, true);
-     break;
+ default:
+   assert (false && "Invalid GC mode.");
+ case LangOptions::NonGC:
+   ActionCheckerCFRefAux(C, mgr, D, false);
+   break;
+
+ case LangOptions::GCOnly:
+   ActionCheckerCFRefAux(C, mgr, D, true);
+   break;
+
+ case LangOptions::HybridGC:
+   ActionCheckerCFRefAux(C, mgr, D, false);
+   ActionCheckerCFRefAux(C, mgr, D, true);
+   break;
  }
 }
 
@@ -530,11 +530,11 @@
   for (unsigned i = 0; i < Opts.AnalysisList.size(); ++i)
     switch (Opts.AnalysisList[i]) {
 #define ANALYSIS(NAME, CMD, DESC, SCOPE)\
-      case NAME:\
-        C->add ## SCOPE ## Action(&Action ## NAME);\
-        break;
+    case NAME:\
+      C->add ## SCOPE ## Action(&Action ## NAME);\
+      break;
 #include "clang/Frontend/Analyses.def"
-      default: break;
+    default: break;
     }
 
   // Last, disable the effects of '-Werror' when using the AnalysisConsumer.

Modified: cfe/trunk/lib/Frontend/CacheTokens.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CacheTokens.cpp?rev=93966&r1=93965&r2=93966&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/CacheTokens.cpp (original)
+++ cfe/trunk/lib/Frontend/CacheTokens.cpp Tue Jan 19 20:03:14 2010
@@ -77,25 +77,25 @@
 
   void EmitData(llvm::raw_ostream& Out) {
     switch (Kind) {
-      case IsFE:
-        // Emit stat information.
-        ::Emit32(Out, FE->getInode());
-        ::Emit32(Out, FE->getDevice());
-        ::Emit16(Out, FE->getFileMode());
-        ::Emit64(Out, FE->getModificationTime());
-        ::Emit64(Out, FE->getSize());
-        break;
-      case IsDE:
-        // Emit stat information.
-        ::Emit32(Out, (uint32_t) StatBuf->st_ino);
-        ::Emit32(Out, (uint32_t) StatBuf->st_dev);
-        ::Emit16(Out, (uint16_t) StatBuf->st_mode);
-        ::Emit64(Out, (uint64_t) StatBuf->st_mtime);
-        ::Emit64(Out, (uint64_t) StatBuf->st_size);
-        delete StatBuf;
-        break;
-      default:
-        break;
+    case IsFE:
+      // Emit stat information.
+      ::Emit32(Out, FE->getInode());
+      ::Emit32(Out, FE->getDevice());
+      ::Emit16(Out, FE->getFileMode());
+      ::Emit64(Out, FE->getModificationTime());
+      ::Emit64(Out, FE->getSize());
+      break;
+    case IsDE:
+      // Emit stat information.
+      ::Emit32(Out, (uint32_t) StatBuf->st_ino);
+      ::Emit32(Out, (uint32_t) StatBuf->st_dev);
+      ::Emit16(Out, (uint16_t) StatBuf->st_mode);
+      ::Emit64(Out, (uint64_t) StatBuf->st_mtime);
+      ::Emit64(Out, (uint64_t) StatBuf->st_size);
+      delete StatBuf;
+      break;
+    default:
+      break;
     }
   }
 

Modified: cfe/trunk/lib/Frontend/DeclXML.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/DeclXML.cpp?rev=93966&r1=93965&r2=93966&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/DeclXML.cpp (original)
+++ cfe/trunk/lib/Frontend/DeclXML.cpp Tue Jan 19 20:03:14 2010
@@ -98,14 +98,14 @@
     const char* pAttributeName = NAME;  \
     const bool optional = false;             \
     switch (T->FN) {                    \
-      default: assert(0 && "unknown enum value");
+    default: assert(0 && "unknown enum value");
 
 #define ATTRIBUTE_ENUM_OPT_XML( FN, NAME )  \
   {                                     \
     const char* pAttributeName = NAME;  \
     const bool optional = true;              \
     switch (T->FN) {                    \
-      default: assert(0 && "unknown enum value");
+    default: assert(0 && "unknown enum value");
 
 #define ENUM_XML( VALUE, NAME )         case VALUE: if ((!optional) || NAME[0]) Doc.addAttribute(pAttributeName, NAME); break;
 #define END_ENUM_XML                    } }

Modified: cfe/trunk/lib/Frontend/HTMLDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/HTMLDiagnostics.cpp?rev=93966&r1=93965&r2=93966&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/HTMLDiagnostics.cpp (original)
+++ cfe/trunk/lib/Frontend/HTMLDiagnostics.cpp Tue Jan 19 20:03:14 2010
@@ -349,10 +349,10 @@
 
   const char *Kind = 0;
   switch (P.getKind()) {
-    case PathDiagnosticPiece::Event:  Kind = "Event"; break;
-    case PathDiagnosticPiece::ControlFlow: Kind = "Control"; break;
-      // Setting Kind to "Control" is intentional.
-    case PathDiagnosticPiece::Macro: Kind = "Control"; break;
+  case PathDiagnosticPiece::Event:  Kind = "Event"; break;
+  case PathDiagnosticPiece::ControlFlow: Kind = "Control"; break;
+    // Setting Kind to "Control" is intentional.
+  case PathDiagnosticPiece::Macro: Kind = "Control"; break;
   }
 
   std::string sbuf;
@@ -380,14 +380,14 @@
 
     for (std::string::const_iterator I=Msg.begin(), E=Msg.end(); I!=E; ++I)
       switch (*I) {
-        default:
-          ++cnt;
-          continue;
-        case ' ':
-        case '\t':
-        case '\n':
-          if (cnt > max_token) max_token = cnt;
-          cnt = 0;
+      default:
+        ++cnt;
+        continue;
+      case ' ':
+      case '\t':
+      case '\n':
+        if (cnt > max_token) max_token = cnt;
+        cnt = 0;
       }
 
     if (cnt > max_token)

Modified: cfe/trunk/lib/Frontend/PCHWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriter.cpp?rev=93966&r1=93965&r2=93966&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PCHWriter.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHWriter.cpp Tue Jan 19 20:03:14 2010
@@ -1271,7 +1271,7 @@
       // For all of the concrete, non-dependent types, call the
       // appropriate visitor function.
 #define TYPE(Class, Base) \
-      case Type::Class: W.Visit##Class##Type(cast<Class##Type>(T)); break;
+    case Type::Class: W.Visit##Class##Type(cast<Class##Type>(T)); break;
 #define ABSTRACT_TYPE(Class, Base)
 #define DEPENDENT_TYPE(Class, Base)
 #include "clang/AST/TypeNodes.def"

Modified: cfe/trunk/lib/Frontend/PlistDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PlistDiagnostics.cpp?rev=93966&r1=93965&r2=93966&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PlistDiagnostics.cpp (original)
+++ cfe/trunk/lib/Frontend/PlistDiagnostics.cpp Tue Jan 19 20:03:14 2010
@@ -177,12 +177,12 @@
   for (std::string::const_iterator I=s.begin(), E=s.end(); I!=E; ++I) {
     char c = *I;
     switch (c) {
-      default:   o << c; break;
-      case '&':  o << "&"; break;
-      case '<':  o << "<"; break;
-      case '>':  o << ">"; break;
-      case '\'': o << "'"; break;
-      case '\"': o << """; break;
+    default:   o << c; break;
+    case '&':  o << "&"; break;
+    case '<':  o << "<"; break;
+    case '>':  o << ">"; break;
+    case '\'': o << "'"; break;
+    case '\"': o << """; break;
     }
   }
   o << "</string>";
@@ -289,16 +289,16 @@
        I!=E; ++I) {
 
     switch ((*I)->getKind()) {
-      default:
-        break;
-      case PathDiagnosticPiece::Event:
-        ReportEvent(o, cast<PathDiagnosticEventPiece>(**I), FM, SM, LangOpts,
-                    indent);
-        break;
-      case PathDiagnosticPiece::Macro:
-        ReportMacro(o, cast<PathDiagnosticMacroPiece>(**I), FM, SM, LangOpts,
-                    indent);
-        break;
+    default:
+      break;
+    case PathDiagnosticPiece::Event:
+      ReportEvent(o, cast<PathDiagnosticEventPiece>(**I), FM, SM, LangOpts,
+                  indent);
+      break;
+    case PathDiagnosticPiece::Macro:
+      ReportMacro(o, cast<PathDiagnosticMacroPiece>(**I), FM, SM, LangOpts,
+                  indent);
+      break;
     }
   }
 }
@@ -310,18 +310,18 @@
   unsigned indent = 4;
 
   switch (P.getKind()) {
-    case PathDiagnosticPiece::ControlFlow:
-      ReportControlFlow(o, cast<PathDiagnosticControlFlowPiece>(P), FM, SM,
-                        LangOpts, indent);
-      break;
-    case PathDiagnosticPiece::Event:
-      ReportEvent(o, cast<PathDiagnosticEventPiece>(P), FM, SM, LangOpts,
-                  indent);
-      break;
-    case PathDiagnosticPiece::Macro:
-      ReportMacro(o, cast<PathDiagnosticMacroPiece>(P), FM, SM, LangOpts,
-                  indent);
-      break;
+  case PathDiagnosticPiece::ControlFlow:
+    ReportControlFlow(o, cast<PathDiagnosticControlFlowPiece>(P), FM, SM,
+                      LangOpts, indent);
+    break;
+  case PathDiagnosticPiece::Event:
+    ReportEvent(o, cast<PathDiagnosticEventPiece>(P), FM, SM, LangOpts,
+                indent);
+    break;
+  case PathDiagnosticPiece::Macro:
+    ReportMacro(o, cast<PathDiagnosticMacroPiece>(P), FM, SM, LangOpts,
+                indent);
+    break;
   }
 }
 

Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=93966&r1=93965&r2=93966&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Tue Jan 19 20:03:14 2010
@@ -4311,11 +4311,11 @@
 
   while (*argPtr++ && (argPtr < endBuf)) {
     switch (*argPtr) {
-      case '^':
-        // Replace the '^' with '*'.
-        LocStart = LocStart.getFileLocWithOffset(argPtr-startBuf);
-        ReplaceText(LocStart, 1, "*", 1);
-        break;
+    case '^':
+      // Replace the '^' with '*'.
+      LocStart = LocStart.getFileLocWithOffset(argPtr-startBuf);
+      ReplaceText(LocStart, 1, "*", 1);
+      break;
     }
   }
   return;
@@ -4340,17 +4340,17 @@
 
   while (*argPtr++ && parenCount) {
     switch (*argPtr) {
-      case '^':
-        // Replace the '^' with '*'.
-        DeclLoc = DeclLoc.getFileLocWithOffset(argPtr-startArgList);
-        ReplaceText(DeclLoc, 1, "*", 1);
-        break;
-      case '(':
-        parenCount++;
-        break;
-      case ')':
-        parenCount--;
-        break;
+    case '^':
+      // Replace the '^' with '*'.
+      DeclLoc = DeclLoc.getFileLocWithOffset(argPtr-startArgList);
+      ReplaceText(DeclLoc, 1, "*", 1);
+      break;
+    case '(':
+      parenCount++;
+      break;
+    case ')':
+      parenCount--;
+      break;
     }
   }
   return;
@@ -4386,9 +4386,9 @@
 
   while (*argPtr && parenCount) {
     switch (*argPtr) {
-      case '(': parenCount++; break;
-      case ')': parenCount--; break;
-      default: break;
+    case '(': parenCount++; break;
+    case ')': parenCount--; break;
+    default: break;
     }
     if (parenCount) argPtr++;
   }

Modified: cfe/trunk/lib/Frontend/StmtXML.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/StmtXML.cpp?rev=93966&r1=93965&r2=93966&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/StmtXML.cpp (original)
+++ cfe/trunk/lib/Frontend/StmtXML.cpp Tue Jan 19 20:03:14 2010
@@ -89,14 +89,14 @@
     const char* pAttributeName = NAME;  \
     const bool optional = false;        \
     switch (S->FN) {                    \
-      default: assert(0 && "unknown enum value");
+    default: assert(0 && "unknown enum value");
 
 #define ATTRIBUTE_ENUM_OPT_XML( FN, NAME )  \
   {                                         \
     const char* pAttributeName = NAME;      \
     const bool optional = true;             \
     switch (S->FN) {                        \
-      default: assert(0 && "unknown enum value");
+    default: assert(0 && "unknown enum value");
 
 #define ENUM_XML( VALUE, NAME )         case VALUE: if ((!optional) || NAME[0]) Doc.addAttribute(pAttributeName, NAME); break;
 #define END_ENUM_XML                    } }
@@ -189,17 +189,17 @@
 
   const char* pKind;
   switch (Node->getDecl()->getKind()) {
-    case Decl::Function: pKind = "FunctionDecl"; break;
-    case Decl::Var: pKind = "Var"; break;
-    case Decl::ParmVar: pKind = "ParmVar"; break;
-    case Decl::EnumConstant: pKind = "EnumConstant"; break;
-    case Decl::Typedef: pKind = "Typedef"; break;
-    case Decl::Record: pKind = "Record"; break;
-    case Decl::Enum: pKind = "Enum"; break;
-    case Decl::CXXRecord: pKind = "CXXRecord"; break;
-    case Decl::ObjCInterface: pKind = "ObjCInterface"; break;
-    case Decl::ObjCClass: pKind = "ObjCClass"; break;
-    default: pKind = "Decl"; break;
+  case Decl::Function: pKind = "FunctionDecl"; break;
+  case Decl::Var: pKind = "Var"; break;
+  case Decl::ParmVar: pKind = "ParmVar"; break;
+  case Decl::EnumConstant: pKind = "EnumConstant"; break;
+  case Decl::Typedef: pKind = "Typedef"; break;
+  case Decl::Record: pKind = "Record"; break;
+  case Decl::Enum: pKind = "Enum"; break;
+  case Decl::CXXRecord: pKind = "CXXRecord"; break;
+  case Decl::ObjCInterface: pKind = "ObjCInterface"; break;
+  case Decl::ObjCClass: pKind = "ObjCClass"; break;
+  default: pKind = "Decl"; break;
   }
 
   Doc.addAttribute("kind", pKind);
@@ -210,10 +210,10 @@
 void StmtXML::VisitPredefinedExpr(PredefinedExpr *Node) {
   DumpExpr(Node);
   switch (Node->getIdentType()) {
-    default: assert(0 && "unknown case");
-    case PredefinedExpr::Func:           Doc.addAttribute("predefined", " __func__"); break;
-    case PredefinedExpr::Function:       Doc.addAttribute("predefined", " __FUNCTION__"); break;
-    case PredefinedExpr::PrettyFunction: Doc.addAttribute("predefined", " __PRETTY_FUNCTION__");break;
+  default: assert(0 && "unknown case");
+  case PredefinedExpr::Func:           Doc.addAttribute("predefined", " __func__"); break;
+  case PredefinedExpr::Function:       Doc.addAttribute("predefined", " __FUNCTION__"); break;
+  case PredefinedExpr::PrettyFunction: Doc.addAttribute("predefined", " __PRETTY_FUNCTION__");break;
   }
 }
 

Modified: cfe/trunk/lib/Frontend/TypeXML.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TypeXML.cpp?rev=93966&r1=93965&r2=93966&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/TypeXML.cpp (original)
+++ cfe/trunk/lib/Frontend/TypeXML.cpp Tue Jan 19 20:03:14 2010
@@ -43,14 +43,14 @@
     const char* pAttributeName = NAME;  \
     const bool optional = false;             \
     switch (T->FN) {                    \
-      default: assert(0 && "unknown enum value");
+    default: assert(0 && "unknown enum value");
 
 #define ATTRIBUTE_ENUM_OPT_XML( FN, NAME )  \
   {                                     \
     const char* pAttributeName = NAME;  \
     const bool optional = true;              \
     switch (T->FN) {                    \
-      default: assert(0 && "unknown enum value");
+    default: assert(0 && "unknown enum value");
 
 #define ENUM_XML( VALUE, NAME )         case VALUE: if ((!optional) || NAME[0]) Doc.addAttribute(pAttributeName, NAME); break;
 #define END_ENUM_XML                    } }





More information about the cfe-commits mailing list