forked from OSchip/llvm-project
[ms-inline asm] Add a size argument to the LookupInlineAsmIdentifier() callback,
which will be used by the asm matcher in the near future. llvm-svn: 166221
This commit is contained in:
parent
0f295dec0d
commit
b91b3f88ad
|
@ -2631,7 +2631,8 @@ public:
|
||||||
Expr *AsmString, MultiExprArg Clobbers,
|
Expr *AsmString, MultiExprArg Clobbers,
|
||||||
SourceLocation RParenLoc);
|
SourceLocation RParenLoc);
|
||||||
|
|
||||||
NamedDecl *LookupInlineAsmIdentifier(StringRef Name, SourceLocation Loc);
|
NamedDecl *LookupInlineAsmIdentifier(StringRef Name, SourceLocation Loc,
|
||||||
|
unsigned &Size);
|
||||||
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc,
|
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc,
|
||||||
ArrayRef<Token> AsmToks, SourceLocation EndLoc);
|
ArrayRef<Token> AsmToks, SourceLocation EndLoc);
|
||||||
|
|
||||||
|
|
|
@ -367,14 +367,16 @@ public:
|
||||||
MCAsmParserSemaCallbackImpl(class Sema *Ref) { SemaRef = Ref; }
|
MCAsmParserSemaCallbackImpl(class Sema *Ref) { SemaRef = Ref; }
|
||||||
~MCAsmParserSemaCallbackImpl() {}
|
~MCAsmParserSemaCallbackImpl() {}
|
||||||
|
|
||||||
void *LookupInlineAsmIdentifier(StringRef Name, void *SrcLoc) {
|
void *LookupInlineAsmIdentifier(StringRef Name, void *SrcLoc, unsigned &Size){
|
||||||
SourceLocation Loc = SourceLocation::getFromPtrEncoding(SrcLoc);
|
SourceLocation Loc = SourceLocation::getFromPtrEncoding(SrcLoc);
|
||||||
NamedDecl *OpDecl = SemaRef->LookupInlineAsmIdentifier(Name, Loc);
|
NamedDecl *OpDecl = SemaRef->LookupInlineAsmIdentifier(Name, Loc, Size);
|
||||||
return static_cast<void *>(OpDecl);
|
return static_cast<void *>(OpDecl);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
NamedDecl *Sema::LookupInlineAsmIdentifier(StringRef Name, SourceLocation Loc) {
|
NamedDecl *Sema::LookupInlineAsmIdentifier(StringRef Name, SourceLocation Loc,
|
||||||
|
unsigned &Size) {
|
||||||
|
Size = 0;
|
||||||
LookupResult Result(*this, &Context.Idents.get(Name), Loc,
|
LookupResult Result(*this, &Context.Idents.get(Name), Loc,
|
||||||
Sema::LookupOrdinaryName);
|
Sema::LookupOrdinaryName);
|
||||||
|
|
||||||
|
@ -391,6 +393,9 @@ NamedDecl *Sema::LookupInlineAsmIdentifier(StringRef Name, SourceLocation Loc) {
|
||||||
|
|
||||||
NamedDecl *ND = Result.getFoundDecl();
|
NamedDecl *ND = Result.getFoundDecl();
|
||||||
if (isa<VarDecl>(ND) || isa<FunctionDecl>(ND)) {
|
if (isa<VarDecl>(ND) || isa<FunctionDecl>(ND)) {
|
||||||
|
if (VarDecl *Var = dyn_cast<VarDecl>(ND))
|
||||||
|
Size = Context.getTypeInfo(Var->getType()).first;
|
||||||
|
|
||||||
return ND;
|
return ND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue