summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2013-04-22 17:01:37 +0000
committerChad Rosier <mcrosier@apple.com>2013-04-22 17:01:37 +0000
commitb18a28552516fac248af39a7af16221a249cc482 (patch)
treecd933b8773c472ac46659953b8834c022c78f314 /clang/lib/Sema
parent8cb1896b6ea680f9a0e3b55c4049279c5a0b5f6f (diff)
downloadbcm5719-llvm-b18a28552516fac248af39a7af16221a249cc482.tar.gz
bcm5719-llvm-b18a28552516fac248af39a7af16221a249cc482.zip
[ms-inline asm] Refactor/clean up the SemaLookup interface. No functional
change indended. Part of rdar://13663589 llvm-svn: 180027
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaStmtAsm.cpp36
1 files changed, 13 insertions, 23 deletions
diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp
index 0ed0fd56f50..c646e7c8571 100644
--- a/clang/lib/Sema/SemaStmtAsm.cpp
+++ b/clang/lib/Sema/SemaStmtAsm.cpp
@@ -445,14 +445,10 @@ public:
: SemaRef(Ref), AsmLoc(Loc), AsmToks(Toks), TokOffsets(Offsets) { }
~MCAsmParserSemaCallbackImpl() {}
- void *LookupInlineAsmIdentifier(StringRef Name, void *SrcLoc,
- unsigned &Length, unsigned &Size,
- unsigned &Type, bool &IsVarDecl){
- SourceLocation Loc = SourceLocation::getFromPtrEncoding(SrcLoc);
-
- NamedDecl *OpDecl = SemaRef.LookupInlineAsmIdentifier(Name, Loc, Length,
- Size, Type,
- IsVarDecl);
+ void *LookupInlineAsmIdentifier(StringRef &LineBuf,
+ InlineAsmIdentifierInfo &Info) {
+ SourceLocation Loc = SourceLocation::getFromPtrEncoding(LineBuf.data());
+ NamedDecl *OpDecl = SemaRef.LookupInlineAsmIdentifier(LineBuf, Loc, Info);
return static_cast<void *>(OpDecl);
}
@@ -520,19 +516,13 @@ static StringRef parseIdentifier(StringRef Identifier) {
return StringRef(StartPtr, CurPtr - StartPtr);
}
-NamedDecl *Sema::LookupInlineAsmIdentifier(StringRef Name, SourceLocation Loc,
- unsigned &Length, unsigned &Size,
- unsigned &Type, bool &IsVarDecl) {
+NamedDecl *Sema::LookupInlineAsmIdentifier(StringRef &LineBuf, SourceLocation Loc,
+ InlineAsmIdentifierInfo &Info) {
+ Info.clear();
// FIXME: Temporary hack until the frontend parser is hooked up to parse
// variables.
- StringRef ParsedName = parseIdentifier(Name);
- assert (ParsedName == Name && "Identifier not parsed correctly!");
-
- Length = 1;
- Size = 0;
- Type = 0;
- IsVarDecl = false;
- LookupResult Result(*this, &Context.Idents.get(Name), Loc,
+ LineBuf = parseIdentifier(LineBuf);
+ LookupResult Result(*this, &Context.Idents.get(LineBuf), Loc,
Sema::LookupOrdinaryName);
if (!LookupName(Result, getCurScope())) {
@@ -551,13 +541,13 @@ NamedDecl *Sema::LookupInlineAsmIdentifier(StringRef Name, SourceLocation Loc,
return FoundDecl;
if (VarDecl *Var = dyn_cast<VarDecl>(FoundDecl)) {
QualType Ty = Var->getType();
- Type = Size = Context.getTypeSizeInChars(Ty).getQuantity();
+ Info.Type = Info.Size = Context.getTypeSizeInChars(Ty).getQuantity();
if (Ty->isArrayType()) {
const ArrayType *ATy = Context.getAsArrayType(Ty);
- Type = Context.getTypeSizeInChars(ATy->getElementType()).getQuantity();
- Length = Size / Type;
+ Info.Type = Context.getTypeSizeInChars(ATy->getElementType()).getQuantity();
+ Info.Length = Info.Size / Info.Type;
}
- IsVarDecl = true;
+ Info.IsVarDecl = true;
return FoundDecl;
}
OpenPOWER on IntegriCloud