r259376 - Move LocInfoType from Sema to AST.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 1 09:42:02 PST 2016


Author: d0k
Date: Mon Feb  1 11:42:01 2016
New Revision: 259376

URL: http://llvm.org/viewvc/llvm-project?rev=259376&view=rev
Log:
Move LocInfoType from Sema to AST.

While transient and only used during parsing, LocInfoTypes are still used
from ASTDumper and are part of the AST.

Added:
    cfe/trunk/include/clang/AST/LocInfoType.h
      - copied, changed from r259366, cfe/trunk/include/clang/Sema/LocInfoType.h
Removed:
    cfe/trunk/include/clang/Sema/LocInfoType.h
Modified:
    cfe/trunk/include/clang/Sema/Sema.h
    cfe/trunk/lib/AST/ASTConsumer.cpp
    cfe/trunk/lib/AST/ASTDumper.cpp
    cfe/trunk/lib/Lex/HeaderSearch.cpp
    cfe/trunk/lib/Sema/DeclSpec.cpp

Copied: cfe/trunk/include/clang/AST/LocInfoType.h (from r259366, cfe/trunk/include/clang/Sema/LocInfoType.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/LocInfoType.h?p2=cfe/trunk/include/clang/AST/LocInfoType.h&p1=cfe/trunk/include/clang/Sema/LocInfoType.h&r1=259366&r2=259376&rev=259376&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/LocInfoType.h (original)
+++ cfe/trunk/include/clang/AST/LocInfoType.h Mon Feb  1 11:42:01 2016
@@ -36,11 +36,10 @@ class LocInfoType : public Type {
   TypeSourceInfo *DeclInfo;
 
   LocInfoType(QualType ty, TypeSourceInfo *TInfo)
-    : Type((TypeClass)LocInfo, ty, ty->isDependentType(),
-           ty->isInstantiationDependentType(),
-           ty->isVariablyModifiedType(),
-           ty->containsUnexpandedParameterPack()),
-      DeclInfo(TInfo) {
+      : Type((TypeClass)LocInfo, ty, ty->isDependentType(),
+             ty->isInstantiationDependentType(), ty->isVariablyModifiedType(),
+             ty->containsUnexpandedParameterPack()),
+        DeclInfo(TInfo) {
     assert(getTypeClass() == (TypeClass)LocInfo && "LocInfo didn't fit in TC?");
   }
   friend class Sema;

Removed: cfe/trunk/include/clang/Sema/LocInfoType.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/LocInfoType.h?rev=259375&view=auto
==============================================================================
--- cfe/trunk/include/clang/Sema/LocInfoType.h (original)
+++ cfe/trunk/include/clang/Sema/LocInfoType.h (removed)
@@ -1,62 +0,0 @@
-//===--- LocInfoType.h - Parsed Type with Location Information---*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the LocInfoType class, which holds a type and its
-// source-location information.
-//
-//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_SEMA_LOCINFOTYPE_H
-#define LLVM_CLANG_SEMA_LOCINFOTYPE_H
-
-#include "clang/AST/Type.h"
-
-namespace clang {
-
-class TypeSourceInfo;
-
-/// \brief Holds a QualType and a TypeSourceInfo* that came out of a declarator
-/// parsing.
-///
-/// LocInfoType is a "transient" type, only needed for passing to/from Parser
-/// and Sema, when we want to preserve type source info for a parsed type.
-/// It will not participate in the type system semantics in any way.
-class LocInfoType : public Type {
-  enum {
-    // The last number that can fit in Type's TC.
-    // Avoids conflict with an existing Type class.
-    LocInfo = Type::TypeLast + 1
-  };
-
-  TypeSourceInfo *DeclInfo;
-
-  LocInfoType(QualType ty, TypeSourceInfo *TInfo)
-    : Type((TypeClass)LocInfo, ty, ty->isDependentType(),
-           ty->isInstantiationDependentType(),
-           ty->isVariablyModifiedType(),
-           ty->containsUnexpandedParameterPack()),
-      DeclInfo(TInfo) {
-    assert(getTypeClass() == (TypeClass)LocInfo && "LocInfo didn't fit in TC?");
-  }
-  friend class Sema;
-
-public:
-  QualType getType() const { return getCanonicalTypeInternal(); }
-  TypeSourceInfo *getTypeSourceInfo() const { return DeclInfo; }
-
-  void getAsStringInternal(std::string &Str,
-                           const PrintingPolicy &Policy) const;
-
-  static bool classof(const Type *T) {
-    return T->getTypeClass() == (TypeClass)LocInfo;
-  }
-};
-
-} // end namespace clang
-
-#endif // LLVM_CLANG_SEMA_LOCINFOTYPE_H

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=259376&r1=259375&r2=259376&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Mon Feb  1 11:42:01 2016
@@ -20,6 +20,7 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/ExternalASTSource.h"
+#include "clang/AST/LocInfoType.h"
 #include "clang/AST/MangleNumberingContext.h"
 #include "clang/AST/NSAPI.h"
 #include "clang/AST/PrettyPrinter.h"
@@ -35,7 +36,6 @@
 #include "clang/Sema/DeclSpec.h"
 #include "clang/Sema/ExternalSemaSource.h"
 #include "clang/Sema/IdentifierResolver.h"
-#include "clang/Sema/LocInfoType.h"
 #include "clang/Sema/ObjCMethodList.h"
 #include "clang/Sema/Ownership.h"
 #include "clang/Sema/Scope.h"

Modified: cfe/trunk/lib/AST/ASTConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTConsumer.cpp?rev=259376&r1=259375&r2=259376&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTConsumer.cpp (original)
+++ cfe/trunk/lib/AST/ASTConsumer.cpp Mon Feb  1 11:42:01 2016
@@ -12,7 +12,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/AST/ASTConsumer.h"
-#include "llvm/Bitcode/BitstreamReader.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclGroup.h"
 using namespace clang;

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=259376&r1=259375&r2=259376&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Mon Feb  1 11:42:01 2016
@@ -19,12 +19,12 @@
 #include "clang/AST/DeclLookups.h"
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/DeclVisitor.h"
+#include "clang/AST/LocInfoType.h"
 #include "clang/AST/StmtVisitor.h"
 #include "clang/AST/TypeVisitor.h"
 #include "clang/Basic/Builtins.h"
 #include "clang/Basic/Module.h"
 #include "clang/Basic/SourceManager.h"
-#include "clang/Sema/LocInfoType.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace clang;
 using namespace clang::comments;

Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=259376&r1=259375&r2=259376&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Mon Feb  1 11:42:01 2016
@@ -14,7 +14,6 @@
 #include "clang/Lex/HeaderSearch.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/IdentifierTable.h"
-#include "clang/Frontend/PCHContainerOperations.h"
 #include "clang/Lex/ExternalPreprocessorSource.h"
 #include "clang/Lex/HeaderMap.h"
 #include "clang/Lex/HeaderSearchOptions.h"

Modified: cfe/trunk/lib/Sema/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=259376&r1=259375&r2=259376&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Mon Feb  1 11:42:01 2016
@@ -15,10 +15,10 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/Expr.h"
+#include "clang/AST/LocInfoType.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/TargetInfo.h"
-#include "clang/Sema/LocInfoType.h"
 #include "clang/Sema/ParsedTemplate.h"
 #include "clang/Sema/Sema.h"
 #include "clang/Sema/SemaDiagnostic.h"




More information about the cfe-commits mailing list