aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/Parser.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2008-12-09 13:15:23 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2008-12-09 13:15:23 +0000
commit0e9eabca263e8922bec0e2b38c8670eba9a39a1f (patch)
tree8f194e270e74bc3d0a746d77f7388980d2fa39d2 /lib/Parse/Parser.cpp
parentb619d957b020744bb6bfdd1cef8169d8042df43e (diff)
Consistently use smart pointers for stmt and expr nodes in parser local variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60761 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/Parser.cpp')
-rw-r--r--lib/Parse/Parser.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 8a5498828e..f2d0ce4cc4 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -17,6 +17,7 @@
#include "clang/Parse/Scope.h"
#include "ExtensionRAIIObject.h"
#include "ParsePragma.h"
+#include "AstGuard.h"
using namespace clang;
Parser::Parser(Preprocessor &pp, Action &actions)
@@ -333,13 +334,13 @@ Parser::DeclTy *Parser::ParseExternalDeclaration() {
return ParseExternalDeclaration();
}
case tok::kw_asm: {
- ExprResult Result = ParseSimpleAsm();
+ ExprOwner Result(Actions, ParseSimpleAsm());
ExpectAndConsume(tok::semi, diag::err_expected_semi_after,
"top-level asm block");
- if (!Result.isInvalid)
- return Actions.ActOnFileScopeAsmDecl(Tok.getLocation(), Result.Val);
+ if (!Result.isInvalid())
+ return Actions.ActOnFileScopeAsmDecl(Tok.getLocation(), Result.move());
return 0;
}
case tok::at:
@@ -669,12 +670,12 @@ Parser::ExprResult Parser::ParseAsmStringLiteral() {
return true;
}
- ExprResult Res = ParseStringLiteralExpression();
- if (Res.isInvalid) return true;
+ ExprOwner Res(Actions, ParseStringLiteralExpression());
+ if (Res.isInvalid()) return true;
// TODO: Diagnose: wide string literal in 'asm'
- return Res;
+ return Res.move();
}
/// ParseSimpleAsm
@@ -693,14 +694,14 @@ Parser::ExprResult Parser::ParseSimpleAsm() {
ConsumeParen();
- ExprResult Result = ParseAsmStringLiteral();
+ ExprOwner Result(Actions, ParseAsmStringLiteral());
- if (Result.isInvalid)
+ if (Result.isInvalid())
SkipUntil(tok::r_paren);
else
MatchRHSPunctuation(tok::r_paren, Loc);
- return Result;
+ return Result.move();
}
/// TryAnnotateTypeOrScopeToken - If the current token position is on a