summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/CommentParser.cpp
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2013-04-18 20:50:35 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2013-04-18 20:50:35 +0000
commitc2c804d145f99632a191bb9ff7c052fa4477feaf (patch)
tree0d8a320154a223d8f7eb2b480c174d876cfe2e96 /clang/lib/AST/CommentParser.cpp
parentf6a88ccd7354bc98dc1f79d0317d4b5b5a4ff83d (diff)
downloadbcm5719-llvm-c2c804d145f99632a191bb9ff7c052fa4477feaf.tar.gz
bcm5719-llvm-c2c804d145f99632a191bb9ff7c052fa4477feaf.zip
Comment parsing: simplify code. As a side effect, this also silences GCC's
-Wunitnitialized warning. Patch by Rui Ueyama. llvm-svn: 179794
Diffstat (limited to 'clang/lib/AST/CommentParser.cpp')
-rw-r--r--clang/lib/AST/CommentParser.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/clang/lib/AST/CommentParser.cpp b/clang/lib/AST/CommentParser.cpp
index 09912c61886..1224db6e0ee 100644
--- a/clang/lib/AST/CommentParser.cpp
+++ b/clang/lib/AST/CommentParser.cpp
@@ -302,22 +302,18 @@ void Parser::parseBlockCommandArgs(BlockCommandComment *BC,
BlockCommandComment *Parser::parseBlockCommand() {
assert(Tok.is(tok::backslash_command) || Tok.is(tok::at_command));
- ParamCommandComment *PC;
- TParamCommandComment *TPC;
- BlockCommandComment *BC;
- bool IsParam = false;
- bool IsTParam = false;
+ ParamCommandComment *PC = 0;
+ TParamCommandComment *TPC = 0;
+ BlockCommandComment *BC = 0;
const CommandInfo *Info = Traits.getCommandInfo(Tok.getCommandID());
CommandMarkerKind CommandMarker =
Tok.is(tok::backslash_command) ? CMK_Backslash : CMK_At;
if (Info->IsParamCommand) {
- IsParam = true;
PC = S.actOnParamCommandStart(Tok.getLocation(),
Tok.getEndLocation(),
Tok.getCommandID(),
CommandMarker);
} else if (Info->IsTParamCommand) {
- IsTParam = true;
TPC = S.actOnTParamCommandStart(Tok.getLocation(),
Tok.getEndLocation(),
Tok.getCommandID(),
@@ -335,10 +331,10 @@ BlockCommandComment *Parser::parseBlockCommand() {
// command has an empty argument.
ParagraphComment *Paragraph = S.actOnParagraphComment(
ArrayRef<InlineContentComment *>());
- if (IsParam) {
+ if (PC) {
S.actOnParamCommandFinish(PC, Paragraph);
return PC;
- } else if (IsTParam) {
+ } else if (TPC) {
S.actOnTParamCommandFinish(TPC, Paragraph);
return TPC;
} else {
@@ -347,14 +343,14 @@ BlockCommandComment *Parser::parseBlockCommand() {
}
}
- if (IsParam || IsTParam || Info->NumArgs > 0) {
+ if (PC || TPC || Info->NumArgs > 0) {
// In order to parse command arguments we need to retokenize a few
// following text tokens.
TextTokenRetokenizer Retokenizer(Allocator, *this);
- if (IsParam)
+ if (PC)
parseParamCommandArgs(PC, Retokenizer);
- else if (IsTParam)
+ else if (TPC)
parseTParamCommandArgs(TPC, Retokenizer);
else
parseBlockCommandArgs(BC, Retokenizer, Info->NumArgs);
@@ -384,10 +380,10 @@ BlockCommandComment *Parser::parseBlockCommand() {
Paragraph = cast<ParagraphComment>(Block);
}
- if (IsParam) {
+ if (PC) {
S.actOnParamCommandFinish(PC, Paragraph);
return PC;
- } else if (IsTParam) {
+ } else if (TPC) {
S.actOnTParamCommandFinish(TPC, Paragraph);
return TPC;
} else {
OpenPOWER on IntegriCloud