r294862 - Hopefully fixes a compile error introduced by r294861.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 11 10:00:33 PST 2017


Author: aaronballman
Date: Sat Feb 11 12:00:32 2017
New Revision: 294862

URL: http://llvm.org/viewvc/llvm-project?rev=294862&view=rev
Log:
Hopefully fixes a compile error introduced by r294861.

Modified:
    cfe/trunk/include/clang/AST/TypeLoc.h

Modified: cfe/trunk/include/clang/AST/TypeLoc.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TypeLoc.h?rev=294862&r1=294861&r2=294862&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/TypeLoc.h (original)
+++ cfe/trunk/include/clang/AST/TypeLoc.h Sat Feb 11 12:00:32 2017
@@ -75,22 +75,7 @@ public:
   /// adjustments from a type that wad written as a T to another type that is
   /// still canonically a T (ignores parens, attributes, elaborated types, etc).
   template <typename T>
-  T getAsAdjusted() const {
-    TypeLoc Cur = *this;
-    while (!T::isKind(Cur)) {
-      if (auto PTL = Cur.getAs<ParenTypeLoc>())
-        Cur = PTL.getInnerLoc();
-      else if (auto ATL = Cur.getAs<AttributedTypeLoc>())
-        Cur = ATL.getModifiedLoc();
-      else if (auto ETL = Cur.getAs<ElaboratedTypeLoc>())
-        Cur = ETL.getNamedTypeLoc();
-      else if (auto ATL = Cur.getAs<AdjustedTypeLoc>())
-        Cur = ATL.getOriginalLoc();
-      else
-        break;
-    }
-    return Cur.getAs<T>();
-  }
+  T getAsAdjusted() const;
 
   /// The kinds of TypeLocs.  Equivalent to the Type::TypeClass enum,
   /// except it also defines a Qualified enum that corresponds to the
@@ -2210,6 +2195,24 @@ public:
 
   QualType getInnerType() const { return this->getTypePtr()->getElementType(); }
 };
+
+template <typename T>
+inline T TypeLoc::getAsAdjusted() const {
+  TypeLoc Cur = *this;
+  while (!T::isKind(Cur)) {
+    if (auto PTL = Cur.getAs<ParenTypeLoc>())
+      Cur = PTL.getInnerLoc();
+    else if (auto ATL = Cur.getAs<AttributedTypeLoc>())
+      Cur = ATL.getModifiedLoc();
+    else if (auto ETL = Cur.getAs<ElaboratedTypeLoc>())
+      Cur = ETL.getNamedTypeLoc();
+    else if (auto ATL = Cur.getAs<AdjustedTypeLoc>())
+      Cur = ATL.getOriginalLoc();
+    else
+      break;
+  }
+  return Cur.getAs<T>();
+}
 }
 
 #endif




More information about the cfe-commits mailing list