Use the llvm coding convention for indentation for switch.

llvm-svn: 93966
This commit is contained in:
Mike Stump 2010-01-20 02:03:14 +00:00
parent 98609b3a07
commit 281d6d7745
9 changed files with 146 additions and 146 deletions

View File

@ -204,45 +204,45 @@ namespace llvm {
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;
case Decl::CXXMethod: {
CXXMethodDecl *CXXMD = cast<CXXMethodDecl>(D);
Stmt *Body = CXXMD->getBody();
if (Body)
HandleCode(CXXMD, Body, FunctionActions);
break;
}
if (Opts.AnalyzeSpecificFunction.size() > 0 &&
Opts.AnalyzeSpecificFunction != CXXMD->getName())
return;
default:
break;
Stmt *Body = CXXMD->getBody();
if (Body)
HandleCode(CXXMD, Body, FunctionActions);
break;
}
default:
break;
}
}
@ -409,20 +409,20 @@ static void ActionCheckerCFRef(AnalysisConsumer &C, AnalysisManager& mgr,
Decl *D) {
switch (mgr.getLangOptions().getGCMode()) {
default:
assert (false && "Invalid GC mode.");
case LangOptions::NonGC:
ActionCheckerCFRefAux(C, mgr, D, false);
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::GCOnly:
ActionCheckerCFRefAux(C, mgr, D, true);
break;
case LangOptions::HybridGC:
ActionCheckerCFRefAux(C, mgr, D, false);
ActionCheckerCFRefAux(C, mgr, D, true);
break;
case LangOptions::HybridGC:
ActionCheckerCFRefAux(C, mgr, D, false);
ActionCheckerCFRefAux(C, mgr, D, true);
break;
}
}
@ -530,11 +530,11 @@ ASTConsumer* clang::CreateAnalysisConsumer(const Preprocessor& pp,
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.

View File

@ -77,25 +77,25 @@ public:
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;
}
}

View File

@ -98,14 +98,14 @@ public:
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 } }

View File

@ -349,10 +349,10 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID,
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 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID,
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)

View File

@ -1271,7 +1271,7 @@ void PCHWriter::WriteType(QualType T) {
// 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"

View File

@ -177,12 +177,12 @@ static llvm::raw_ostream& EmitString(llvm::raw_ostream& o,
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 << "&amp;"; break;
case '<': o << "&lt;"; break;
case '>': o << "&gt;"; break;
case '\'': o << "&apos;"; break;
case '\"': o << "&quot;"; break;
default: o << c; break;
case '&': o << "&amp;"; break;
case '<': o << "&lt;"; break;
case '>': o << "&gt;"; break;
case '\'': o << "&apos;"; break;
case '\"': o << "&quot;"; break;
}
}
o << "</string>";
@ -289,16 +289,16 @@ static void ReportMacro(llvm::raw_ostream& o,
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 @@ static void ReportDiag(llvm::raw_ostream& o, const PathDiagnosticPiece& P,
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;
}
}

View File

@ -4311,11 +4311,11 @@ void RewriteObjC::RewriteCastExpr(CStyleCastExpr *CE) {
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 @@ void RewriteObjC::RewriteBlockPointerFunctionArgs(FunctionDecl *FD) {
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 @@ void RewriteObjC::GetExtentOfArgList(const char *Name, const char *&LParen,
while (*argPtr && parenCount) {
switch (*argPtr) {
case '(': parenCount++; break;
case ')': parenCount--; break;
default: break;
case '(': parenCount++; break;
case ')': parenCount--; break;
default: break;
}
if (parenCount) argPtr++;
}

View File

@ -89,14 +89,14 @@ namespace {
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 @@ void StmtXML::VisitDeclRefExpr(DeclRefExpr *Node) {
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::VisitDeclRefExpr(DeclRefExpr *Node) {
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;
}
}

View File

@ -43,14 +43,14 @@ public:
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 } }