r178481 - Cleanup. No functional change intended.

Chad Rosier mcrosier at apple.com
Mon Apr 1 10:58:03 PDT 2013


Author: mcrosier
Date: Mon Apr  1 12:58:03 2013
New Revision: 178481

URL: http://llvm.org/viewvc/llvm-project?rev=178481&view=rev
Log:
Cleanup.  No functional change intended.

Modified:
    cfe/trunk/lib/Sema/SemaStmtAsm.cpp

Modified: cfe/trunk/lib/Sema/SemaStmtAsm.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAsm.cpp?rev=178481&r1=178480&r2=178481&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmtAsm.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp Mon Apr  1 12:58:03 2013
@@ -515,21 +515,21 @@ NamedDecl *Sema::LookupInlineAsmIdentifi
     return 0;
   }
 
-  NamedDecl *ND = Result.getFoundDecl();
-  if (isa<VarDecl>(ND) || isa<FunctionDecl>(ND)) {
-    if (VarDecl *Var = dyn_cast<VarDecl>(ND)) {
-      Type = Context.getTypeInfo(Var->getType()).first;
-      QualType Ty = Var->getType();
-      if (Ty->isArrayType()) {
-        const ArrayType *ATy = Context.getAsArrayType(Ty);
-        Length = Type / Context.getTypeInfo(ATy->getElementType()).first;
-        Type /= Length; // Type is in terms of a single element.
-      }
-      Type /= 8; // Type is in terms of bits, but we want bytes.
-      Size = Length * Type;
-      IsVarDecl = true;
+  NamedDecl *FoundDecl = Result.getFoundDecl();
+  if (isa<FunctionDecl>(FoundDecl))
+    return FoundDecl;
+  if (VarDecl *Var = dyn_cast<VarDecl>(FoundDecl)) {
+    Type = Context.getTypeInfo(Var->getType()).first;
+    QualType Ty = Var->getType();
+    if (Ty->isArrayType()) {
+      const ArrayType *ATy = Context.getAsArrayType(Ty);
+      Length = Type / Context.getTypeInfo(ATy->getElementType()).first;
+      Type /= Length; // Type is in terms of a single element.
     }
-    return ND;
+    Type /= 8; // Type is in terms of bits, but we want bytes.
+    Size = Length * Type;
+    IsVarDecl = true;
+    return FoundDecl;
   }
 
   // FIXME: Handle other kinds of results? (FieldDecl, etc.)
@@ -549,13 +549,12 @@ bool Sema::LookupInlineAsmField(StringRe
   if (!BaseResult.isSingleResult())
     return true;
 
-  NamedDecl *FoundDecl = BaseResult.getFoundDecl();
   const RecordType *RT = 0;
-  if (VarDecl *VD = dyn_cast<VarDecl>(FoundDecl)) {
+  NamedDecl *FoundDecl = BaseResult.getFoundDecl();
+  if (VarDecl *VD = dyn_cast<VarDecl>(FoundDecl))
     RT = VD->getType()->getAs<RecordType>();
-  } else if (TypedefDecl *TD = dyn_cast<TypedefDecl>(FoundDecl)) {
+  else if (TypedefDecl *TD = dyn_cast<TypedefDecl>(FoundDecl))
     RT = TD->getUnderlyingType()->getAs<RecordType>();
-  }
   if (!RT)
     return true;
 





More information about the cfe-commits mailing list