Fix warnings found by gcc-4.6, from -Wunused-but-set-variable and
-Wint-to-pointer-cast.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123719 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 8e334c3..355ba02 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -1724,7 +1724,6 @@
}
// Parse the common specifier-qualifiers-list piece.
- SourceLocation DSStart = Tok.getLocation();
ParseSpecifierQualifierList(DS);
// If there are no declarators, this is a free-standing declaration
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index fcd629f..20e2b8b 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -1443,7 +1443,6 @@
return;
}
- SourceLocation DSStart = Tok.getLocation();
// decl-specifier-seq:
// Parse the common declaration-specifiers piece.
ParsingDeclSpec DS(*this, TemplateDiags);
@@ -1931,7 +1930,7 @@
bool &hasAnyExceptionSpec) {
assert(Tok.is(tok::kw_throw) && "expected throw");
- SourceLocation ThrowLoc = ConsumeToken();
+ ConsumeToken();
if (!Tok.is(tok::l_paren)) {
return Diag(Tok, diag::err_expected_lparen_after) << "throw";
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 7133b61..f48b7a5 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -566,7 +566,6 @@
ParenParseOption ParenExprType =
(isUnaryExpression && !getLang().CPlusPlus)? CompoundLiteral : CastExpr;
ParsedType CastTy;
- SourceLocation LParenLoc = Tok.getLocation();
SourceLocation RParenLoc;
{
@@ -641,7 +640,7 @@
(Actions.getTypeName(II, ILoc, getCurScope()) ||
// Allow the base to be 'super' if in an objc-method.
(&II == Ident_super && getCurScope()->isInObjcMethodScope()))) {
- SourceLocation DotLoc = ConsumeToken();
+ ConsumeToken();
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected_property_name);
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index aa638bb..8b12650 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -824,7 +824,7 @@
// '=' assignment-expression
if (isTokenEqualOrMistypedEqualEqual(
diag::err_invalid_equalequal_after_declarator)) {
- SourceLocation EqualLoc = ConsumeToken();
+ ConsumeToken();
ExprResult AssignExpr(ParseAssignmentExpression());
if (!AssignExpr.isInvalid())
Actions.AddInitializerToDecl(DeclOut, AssignExpr.take());
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 2d293c5..af53d7d 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -150,7 +150,9 @@
SourceLocation nameLoc = ConsumeToken();
if (Tok.is(tok::l_paren) &&
!isKnownToBeTypeSpecifier(GetLookAheadToken(1))) { // we have a category.
- SourceLocation lparenLoc = ConsumeParen();
+ // TODO(dgregor): Use the return value from the next line to provide better
+ // recovery.
+ ConsumeParen();
SourceLocation categoryLoc, rparenLoc;
IdentifierInfo *categoryId = 0;
if (Tok.is(tok::code_completion)) {
@@ -1298,7 +1300,7 @@
if (Tok.is(tok::l_paren)) {
// we have a category implementation.
- SourceLocation lparenLoc = ConsumeParen();
+ ConsumeParen();
SourceLocation categoryLoc, rparenLoc;
IdentifierInfo *categoryId = 0;
@@ -1418,7 +1420,7 @@
Decl *Parser::ParseObjCPropertySynthesize(SourceLocation atLoc) {
assert(Tok.isObjCAtKeyword(tok::objc_synthesize) &&
"ParseObjCPropertyDynamic(): Expected '@synthesize'");
- SourceLocation loc = ConsumeToken(); // consume synthesize
+ ConsumeToken(); // consume synthesize
while (true) {
if (Tok.is(tok::code_completion)) {
@@ -1473,7 +1475,7 @@
Decl *Parser::ParseObjCPropertyDynamic(SourceLocation atLoc) {
assert(Tok.isObjCAtKeyword(tok::objc_dynamic) &&
"ParseObjCPropertyDynamic(): Expected '@dynamic'");
- SourceLocation loc = ConsumeToken(); // consume dynamic
+ ConsumeToken(); // consume dynamic
while (true) {
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCPropertyDefinition(getCurScope(), ObjCImpDecl);
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index 113b266..3a6f80d 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -545,12 +545,9 @@
Decl *&DeclResult,
SourceLocation Loc,
bool ConvertToBoolean) {
- bool ParseError = false;
-
SourceLocation LParenLoc = ConsumeParen();
if (getLang().CPlusPlus)
- ParseError = ParseCXXCondition(ExprResult, DeclResult, Loc,
- ConvertToBoolean);
+ ParseCXXCondition(ExprResult, DeclResult, Loc, ConvertToBoolean);
else {
ExprResult = ParseExpression();
DeclResult = 0;
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp
index 93f5c9b..05cdd5c 100644
--- a/lib/Parse/ParseTemplate.cpp
+++ b/lib/Parse/ParseTemplate.cpp
@@ -531,7 +531,7 @@
<< PP.getSpelling(Tok);
return 0;
}
- SourceLocation ClassLoc = ConsumeToken();
+ ConsumeToken();
// Parse the ellipsis, if given.
SourceLocation EllipsisLoc;
@@ -595,8 +595,6 @@
/// parameter-declaration
Decl *
Parser::ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position) {
- SourceLocation StartLoc = Tok.getLocation();
-
// Parse the declaration-specifiers (i.e., the type).
// FIXME: The type should probably be restricted in some way... Not all
// declarators (parts of declarators?) are accepted for parameters.
diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp
index c6e6784..bec201c 100644
--- a/lib/Parse/ParseTentative.cpp
+++ b/lib/Parse/ParseTentative.cpp
@@ -111,10 +111,7 @@
// We need tentative parsing...
TentativeParsingAction PA(*this);
-
TPR = TryParseSimpleDeclaration();
- SourceLocation TentativeParseLoc = Tok.getLocation();
-
PA.Revert();
// In case of an error, let the declaration parsing code handle it.