diff options
author | dim <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
commit | 3176e97f130184ece0e1a21352c8124cc83ff24a (patch) | |
tree | 0a5b74c0b9ca73aded34df95c91fcaf3815230d8 /lib/Parse/ParseStmtAsm.cpp | |
parent | 1e9b8d38881c3213d1e67b0c47ab9b2c00721a5c (diff) | |
download | FreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.zip FreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.tar.gz |
Vendor import of clang trunk r256633:
https://llvm.org/svn/llvm-project/cfe/trunk@256633
Diffstat (limited to 'lib/Parse/ParseStmtAsm.cpp')
-rw-r--r-- | lib/Parse/ParseStmtAsm.cpp | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/lib/Parse/ParseStmtAsm.cpp b/lib/Parse/ParseStmtAsm.cpp index 8cdae6a..f469a064 100644 --- a/lib/Parse/ParseStmtAsm.cpp +++ b/lib/Parse/ParseStmtAsm.cpp @@ -215,12 +215,36 @@ ExprResult Parser::ParseMSAsmIdentifier(llvm::SmallVectorImpl<Token> &LineToks, // Require an identifier here. SourceLocation TemplateKWLoc; UnqualifiedId Id; - bool Invalid = - ParseUnqualifiedId(SS, - /*EnteringContext=*/false, - /*AllowDestructorName=*/false, - /*AllowConstructorName=*/false, - /*ObjectType=*/ParsedType(), TemplateKWLoc, Id); + bool Invalid = true; + ExprResult Result; + if (Tok.is(tok::kw_this)) { + Result = ParseCXXThis(); + Invalid = false; + } else { + Invalid = + ParseUnqualifiedId(SS, + /*EnteringContext=*/false, + /*AllowDestructorName=*/false, + /*AllowConstructorName=*/false, + /*ObjectType=*/ParsedType(), TemplateKWLoc, Id); + // Perform the lookup. + Result = Actions.LookupInlineAsmIdentifier(SS, TemplateKWLoc, Id, Info, + IsUnevaluatedContext); + } + // While the next two tokens are 'period' 'identifier', repeatedly parse it as + // a field access. We have to avoid consuming assembler directives that look + // like '.' 'else'. + while (Result.isUsable() && Tok.is(tok::period)) { + Token IdTok = PP.LookAhead(0); + if (IdTok.isNot(tok::identifier)) + break; + ConsumeToken(); // Consume the period. + IdentifierInfo *Id = Tok.getIdentifierInfo(); + ConsumeToken(); // Consume the identifier. + unsigned OffsetUnused; + Result = Actions.LookupInlineAsmVarDeclField( + Result.get(), Id->getName(), OffsetUnused, Info, Tok.getLocation()); + } // Figure out how many tokens we are into LineToks. unsigned LineIndex = 0; @@ -254,9 +278,7 @@ ExprResult Parser::ParseMSAsmIdentifier(llvm::SmallVectorImpl<Token> &LineToks, LineToks.pop_back(); LineToks.pop_back(); - // Perform the lookup. - return Actions.LookupInlineAsmIdentifier(SS, TemplateKWLoc, Id, Info, - IsUnevaluatedContext); + return Result; } /// Turn a sequence of our tokens back into a string that we can hand |