From 3c385c28cf1f27b193a620d2e51f814873362ceb Mon Sep 17 00:00:00 2001 From: John McCall Date: Thu, 6 May 2010 09:25:57 +0000 Subject: [PATCH] Push TypeSourceInfo::getTypeLoc() into a header file so that it's inlineable. That header file has to be TypeLoc.h, which means that TypeLoc.h needs to depend on Decl.h because TypeSourceInfo doesn't have its own header. That could be remedied, though. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103176 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/Decl.h | 2 +- include/clang/AST/TypeLoc.h | 6 ++++++ lib/AST/Decl.cpp | 5 ----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 4c95d1da7f..2d975853d0 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -55,7 +55,7 @@ public: QualType getType() const { return Ty; } /// \brief Return the TypeLoc wrapper for the type source info. - TypeLoc getTypeLoc() const; + TypeLoc getTypeLoc() const; // implemented in TypeLoc.h }; /// TranslationUnitDecl - The top declaration context. diff --git a/include/clang/AST/TypeLoc.h b/include/clang/AST/TypeLoc.h index 4d0f313c80..aeedd0f90a 100644 --- a/include/clang/AST/TypeLoc.h +++ b/include/clang/AST/TypeLoc.h @@ -15,6 +15,7 @@ #define LLVM_CLANG_AST_TYPELOC_H #include "clang/AST/Type.h" +#include "clang/AST/Decl.h" #include "clang/AST/TemplateBase.h" #include "clang/Basic/Specifiers.h" @@ -140,6 +141,11 @@ private: static SourceRange getSourceRangeImpl(TypeLoc TL); }; +/// \brief Return the TypeLoc for a type source info. +inline TypeLoc TypeSourceInfo::getTypeLoc() const { + return TypeLoc(Ty, (void*)(this + 1)); +} + /// \brief Wrapper of type source information for a type with /// no direct quqlaifiers. class UnqualTypeLoc : public TypeLoc { diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 0336ca1eaa..25f5fb7797 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -28,11 +28,6 @@ using namespace clang; -/// \brief Return the TypeLoc wrapper for the type source info. -TypeLoc TypeSourceInfo::getTypeLoc() const { - return TypeLoc(Ty, (void*)(this + 1)); -} - //===----------------------------------------------------------------------===// // NamedDecl Implementation //===----------------------------------------------------------------------===//