]> granicus.if.org Git - clang/commitdiff
[ms-inline asm] Add a size argument to the LookupInlineAsmIdentifier() callback,
authorChad Rosier <mcrosier@apple.com>
Thu, 18 Oct 2012 20:27:06 +0000 (20:27 +0000)
committerChad Rosier <mcrosier@apple.com>
Thu, 18 Oct 2012 20:27:06 +0000 (20:27 +0000)
which will be used by the asm matcher in the near future.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166221 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Sema/Sema.h
lib/Sema/SemaStmtAsm.cpp

index 15303ef81748a642662c7e9ed7a5b9a0834f342f..658a60c62fdf00c703225343d03b7d5f5a625273 100644 (file)
@@ -2631,7 +2631,8 @@ public:
                              Expr *AsmString, MultiExprArg Clobbers,
                              SourceLocation RParenLoc);
 
-  NamedDecl *LookupInlineAsmIdentifier(StringRef Name, SourceLocation Loc);
+  NamedDecl *LookupInlineAsmIdentifier(StringRef Name, SourceLocation Loc,
+                                       unsigned &Size);
   StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc,
                             ArrayRef<Token> AsmToks, SourceLocation EndLoc);
 
index 875821c14dcab9df1c5f009f899dd9979927b7a1..172cfe55beae77c7be1d097de0b3938962ca2d91 100644 (file)
@@ -367,14 +367,16 @@ public:
   MCAsmParserSemaCallbackImpl(class Sema *Ref) { SemaRef = Ref; }
   ~MCAsmParserSemaCallbackImpl() {}
 
-  void *LookupInlineAsmIdentifier(StringRef Name, void *SrcLoc{
+  void *LookupInlineAsmIdentifier(StringRef Name, void *SrcLoc, unsigned &Size){
     SourceLocation Loc = SourceLocation::getFromPtrEncoding(SrcLoc);
-    NamedDecl *OpDecl = SemaRef->LookupInlineAsmIdentifier(Name, Loc);
+    NamedDecl *OpDecl = SemaRef->LookupInlineAsmIdentifier(Name, Loc, Size);
     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,
                       Sema::LookupOrdinaryName);
 
@@ -391,6 +393,9 @@ 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))
+      Size = Context.getTypeInfo(Var->getType()).first;
+
     return ND;
   }