diff options
author | Chad Rosier <mcrosier@apple.com> | 2013-01-10 22:10:16 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2013-01-10 22:10:16 +0000 |
commit | 3973f28f347bf8ca3cca31ea30da235c95701231 (patch) | |
tree | ebbd1193b14151e38358cd6e8d590e1f5d5cfab2 /lib/Sema | |
parent | 7084823f8ec4367019940b26245e01684b62c7e1 (diff) |
[ms-inline asm] Extend the inline asm Sema lookup interface to determine if the
Decl is a VarDecl.
Part of rdar://12991541
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172120 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaStmtAsm.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Sema/SemaStmtAsm.cpp b/lib/Sema/SemaStmtAsm.cpp index 21d022b28c..e0c3a73035 100644 --- a/lib/Sema/SemaStmtAsm.cpp +++ b/lib/Sema/SemaStmtAsm.cpp @@ -437,9 +437,11 @@ public: : SemaRef(Ref), AsmLoc(Loc), AsmToks(Toks), TokOffsets(Offsets) { } ~MCAsmParserSemaCallbackImpl() {} - void *LookupInlineAsmIdentifier(StringRef Name, void *SrcLoc, unsigned &Size){ + void *LookupInlineAsmIdentifier(StringRef Name, void *SrcLoc, unsigned &Size, + bool &IsVarDecl){ SourceLocation Loc = SourceLocation::getFromPtrEncoding(SrcLoc); - NamedDecl *OpDecl = SemaRef.LookupInlineAsmIdentifier(Name, Loc, Size); + NamedDecl *OpDecl = SemaRef.LookupInlineAsmIdentifier(Name, Loc, Size, + IsVarDecl); return static_cast<void *>(OpDecl); } @@ -482,8 +484,9 @@ public: } NamedDecl *Sema::LookupInlineAsmIdentifier(StringRef Name, SourceLocation Loc, - unsigned &Size) { + unsigned &Size, bool &IsVarDecl) { Size = 0; + IsVarDecl = false; LookupResult Result(*this, &Context.Idents.get(Name), Loc, Sema::LookupOrdinaryName); @@ -500,9 +503,10 @@ NamedDecl *Sema::LookupInlineAsmIdentifier(StringRef Name, SourceLocation Loc, NamedDecl *ND = Result.getFoundDecl(); if (isa<VarDecl>(ND) || isa<FunctionDecl>(ND)) { - if (VarDecl *Var = dyn_cast<VarDecl>(ND)) + if (VarDecl *Var = dyn_cast<VarDecl>(ND)) { Size = Context.getTypeInfo(Var->getType()).first; - + IsVarDecl = true; + } return ND; } @@ -652,7 +656,7 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, if (OpExpr.isInvalid()) return StmtError(); - // Need offset of variable. + // Need address of variable. if (OpDecls[i].second) OpExpr = BuildUnaryOp(getCurScope(), AsmLoc, clang::UO_AddrOf, OpExpr.take()); |