diff --git a/contrib/llvm/tools/clang/FREEBSD-Xlist b/contrib/llvm/tools/clang/FREEBSD-Xlist index e6d4db69e74..5f5e9fdec2a 100644 --- a/contrib/llvm/tools/clang/FREEBSD-Xlist +++ b/contrib/llvm/tools/clang/FREEBSD-Xlist @@ -5,9 +5,9 @@ .gitignore CMakeLists.txt CODE_OWNERS.TXT +Driver/ INPUTS/ INSTALL.txt -Makefile ModuleInfo.txt NOTES.txt README.txt @@ -16,118 +16,105 @@ cmake/ docs/ examples/ include/CMakeLists.txt -include/Makefile include/clang/AST/CMakeLists.txt -include/clang/AST/Makefile include/clang/Basic/CMakeLists.txt -include/clang/Basic/Makefile include/clang/Basic/Version.inc.in include/clang/CMakeLists.txt include/clang/Config/ include/clang/Driver/CMakeLists.txt -include/clang/Driver/Makefile -include/clang/Makefile include/clang/Parse/CMakeLists.txt -include/clang/Parse/Makefile include/clang/Sema/CMakeLists.txt -include/clang/Sema/Makefile include/clang/Serialization/CMakeLists.txt -include/clang/Serialization/Makefile -include/clang-c/Makefile +include/clang/StaticAnalyzer/Checkers/CMakeLists.txt lib/ARCMigrate/CMakeLists.txt -lib/ARCMigrate/Makefile lib/AST/CMakeLists.txt -lib/AST/Makefile lib/ASTMatchers/CMakeLists.txt lib/ASTMatchers/Dynamic/CMakeLists.txt -lib/ASTMatchers/Dynamic/Makefile -lib/ASTMatchers/Makefile lib/Analysis/CMakeLists.txt -lib/Analysis/Makefile lib/Basic/CMakeLists.txt -lib/Basic/Makefile lib/CMakeLists.txt lib/CodeGen/CMakeLists.txt -lib/CodeGen/Makefile lib/CodeGen/README.txt +lib/CrossTU/CMakeLists.txt +lib/Driver/Arch/ lib/Driver/CMakeLists.txt -lib/Driver/Makefile lib/Edit/CMakeLists.txt -lib/Edit/Makefile lib/Format/CMakeLists.txt -lib/Format/Makefile lib/Frontend/CMakeLists.txt -lib/Frontend/Makefile lib/Frontend/Rewrite/CMakeLists.txt -lib/Frontend/Rewrite/Makefile lib/FrontendTool/CMakeLists.txt -lib/FrontendTool/Makefile lib/Headers/CMakeLists.txt -lib/Headers/Makefile +lib/Headers/cuda/ lib/Index/CMakeLists.txt -lib/Index/Makefile lib/Lex/CMakeLists.txt -lib/Lex/Makefile -lib/Makefile lib/Parse/CMakeLists.txt -lib/Parse/Makefile lib/Rewrite/CMakeLists.txt -lib/Rewrite/Makefile lib/Sema/CMakeLists.txt -lib/Sema/Makefile lib/Serialization/CMakeLists.txt -lib/Serialization/Makefile lib/StaticAnalyzer/CMakeLists.txt lib/StaticAnalyzer/Checkers/CMakeLists.txt -lib/StaticAnalyzer/Checkers/Makefile lib/StaticAnalyzer/Core/CMakeLists.txt -lib/StaticAnalyzer/Core/Makefile lib/StaticAnalyzer/Frontend/CMakeLists.txt -lib/StaticAnalyzer/Frontend/Makefile -lib/StaticAnalyzer/Makefile lib/StaticAnalyzer/README.txt +lib/Tooling/ASTDiff/CMakeLists.txt lib/Tooling/CMakeLists.txt lib/Tooling/Core/CMakeLists.txt -lib/Tooling/Core/Makefile -lib/Tooling/Makefile +lib/Tooling/Inclusions/CMakeLists.txt +lib/Tooling/Refactoring/CMakeLists.txt runtime/ test/ tools/CMakeLists.txt -tools/Makefile tools/arcmt-test/ tools/c-arcmt-test/ tools/c-index-test/ tools/clang-check/ -tools/clang-format/ +tools/clang-diff/ +tools/clang-extdef-mapping/ tools/clang-format-vs/ +tools/clang-format/CMakeLists.txt +tools/clang-format/clang-format-bbedit.applescript +tools/clang-format/clang-format-diff.py +tools/clang-format/clang-format-sublime.py +tools/clang-format/clang-format-test.el +tools/clang-format/clang-format.el +tools/clang-format/clang-format.py +tools/clang-format/fuzzer/ +tools/clang-format/git-clang-format +tools/clang-func-mapping/ tools/clang-fuzzer/ +tools/clang-import-test/ +tools/clang-offload-bundler/ +tools/clang-refactor/ +tools/clang-rename/ tools/diag-build/ tools/diagtool/ tools/driver/CMakeLists.txt tools/driver/Info.plist.in -tools/driver/Makefile -tools/driver/clang_symlink.cmake tools/libclang/ tools/scan-build/ +tools/scan-build-py/ tools/scan-view/ unittests/ utils/ABITest/ utils/CIndex/ utils/CaptureCmd utils/ClangDataFormat.py +utils/ClangVisualizers/ utils/CmpDriver utils/FindSpecRefs utils/FuzzTest utils/TableGen/CMakeLists.txt -utils/TableGen/Makefile utils/TestUtils/ utils/VtableTest/ utils/analyzer/ +utils/bash-autocomplete.sh utils/builtin-defines.c utils/check_cfc/ -utils/clang-completion-mode.el -utils/clang.natvis +utils/clangdiag.py utils/find-unused-diagnostics.sh +utils/hmaptool/ +utils/modfuzz.py +utils/perf-training/ utils/token-delta.py utils/valgrind/ www/ diff --git a/contrib/llvm/tools/clang/LICENSE.TXT b/contrib/llvm/tools/clang/LICENSE.TXT index 547f6a48938..9e71121218a 100644 --- a/contrib/llvm/tools/clang/LICENSE.TXT +++ b/contrib/llvm/tools/clang/LICENSE.TXT @@ -4,7 +4,7 @@ LLVM Release License University of Illinois/NCSA Open Source License -Copyright (c) 2007-2018 University of Illinois at Urbana-Champaign. +Copyright (c) 2007-2019 University of Illinois at Urbana-Champaign. All rights reserved. Developed by: diff --git a/contrib/llvm/tools/clang/include/clang-c/Index.h b/contrib/llvm/tools/clang/include/clang-c/Index.h index 65dada38b05..c51dfb1598b 100644 --- a/contrib/llvm/tools/clang/include/clang-c/Index.h +++ b/contrib/llvm/tools/clang/include/clang-c/Index.h @@ -32,7 +32,7 @@ * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. */ #define CINDEX_VERSION_MAJOR 0 -#define CINDEX_VERSION_MINOR 49 +#define CINDEX_VERSION_MINOR 50 #define CINDEX_VERSION_ENCODE(major, minor) ( \ ((major) * 10000) \ @@ -178,7 +178,6 @@ typedef struct CXVersion { * A negative value indicates that the cursor is not a function declaration. */ enum CXCursor_ExceptionSpecificationKind { - /** * The cursor has no exception specification. */ @@ -1332,7 +1331,17 @@ enum CXTranslationUnit_Flags { * * The function bodies of the main file are not skipped. */ - CXTranslationUnit_LimitSkipFunctionBodiesToPreamble = 0x800 + CXTranslationUnit_LimitSkipFunctionBodiesToPreamble = 0x800, + + /** + * Used to indicate that attributed types should be included in CXType. + */ + CXTranslationUnit_IncludeAttributedTypes = 0x1000, + + /** + * Used to indicate that implicit attributes should be visited. + */ + CXTranslationUnit_VisitImplicitAttributes = 0x2000 }; /** @@ -2559,7 +2568,25 @@ enum CXCursorKind { CXCursor_VisibilityAttr = 417, CXCursor_DLLExport = 418, CXCursor_DLLImport = 419, - CXCursor_LastAttr = CXCursor_DLLImport, + CXCursor_NSReturnsRetained = 420, + CXCursor_NSReturnsNotRetained = 421, + CXCursor_NSReturnsAutoreleased = 422, + CXCursor_NSConsumesSelf = 423, + CXCursor_NSConsumed = 424, + CXCursor_ObjCException = 425, + CXCursor_ObjCNSObject = 426, + CXCursor_ObjCIndependentClass = 427, + CXCursor_ObjCPreciseLifetime = 428, + CXCursor_ObjCReturnsInnerPointer = 429, + CXCursor_ObjCRequiresSuper = 430, + CXCursor_ObjCRootClass = 431, + CXCursor_ObjCSubclassingRestricted = 432, + CXCursor_ObjCExplicitProtocolImpl = 433, + CXCursor_ObjCDesignatedInitializer = 434, + CXCursor_ObjCRuntimeVisible = 435, + CXCursor_ObjCBoxable = 436, + CXCursor_FlagEnum = 437, + CXCursor_LastAttr = CXCursor_FlagEnum, /* Preprocessing */ CXCursor_PreprocessingDirective = 500, @@ -3266,7 +3293,25 @@ enum CXTypeKind { CXType_OCLSampler = 157, CXType_OCLEvent = 158, CXType_OCLQueue = 159, - CXType_OCLReserveID = 160 + CXType_OCLReserveID = 160, + + CXType_ObjCObject = 161, + CXType_ObjCTypeParam = 162, + CXType_Attributed = 163, + + CXType_OCLIntelSubgroupAVCMcePayload = 164, + CXType_OCLIntelSubgroupAVCImePayload = 165, + CXType_OCLIntelSubgroupAVCRefPayload = 166, + CXType_OCLIntelSubgroupAVCSicPayload = 167, + CXType_OCLIntelSubgroupAVCMceResult = 168, + CXType_OCLIntelSubgroupAVCImeResult = 169, + CXType_OCLIntelSubgroupAVCRefResult = 170, + CXType_OCLIntelSubgroupAVCSicResult = 171, + CXType_OCLIntelSubgroupAVCImeResultSingleRefStreamout = 172, + CXType_OCLIntelSubgroupAVCImeResultDualRefStreamout = 173, + CXType_OCLIntelSubgroupAVCImeSingleRefStreamin = 174, + + CXType_OCLIntelSubgroupAVCImeDualRefStreamin = 175 }; /** @@ -3291,6 +3336,7 @@ enum CXCallingConv { CXCallingConv_Swift = 13, CXCallingConv_PreserveMost = 14, CXCallingConv_PreserveAll = 15, + CXCallingConv_AArch64VectorCall = 16, CXCallingConv_Invalid = 100, CXCallingConv_Unexposed = 200 @@ -3627,6 +3673,43 @@ CINDEX_LINKAGE int clang_getNumArgTypes(CXType T); */ CINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i); +/** + * Retrieves the base type of the ObjCObjectType. + * + * If the type is not an ObjC object, an invalid type is returned. + */ +CINDEX_LINKAGE CXType clang_Type_getObjCObjectBaseType(CXType T); + +/** + * Retrieve the number of protocol references associated with an ObjC object/id. + * + * If the type is not an ObjC object, 0 is returned. + */ +CINDEX_LINKAGE unsigned clang_Type_getNumObjCProtocolRefs(CXType T); + +/** + * Retrieve the decl for a protocol reference for an ObjC object/id. + * + * If the type is not an ObjC object or there are not enough protocol + * references, an invalid cursor is returned. + */ +CINDEX_LINKAGE CXCursor clang_Type_getObjCProtocolDecl(CXType T, unsigned i); + +/** + * Retreive the number of type arguments associated with an ObjC object. + * + * If the type is not an ObjC object, 0 is returned. + */ +CINDEX_LINKAGE unsigned clang_Type_getNumObjCTypeArgs(CXType T); + +/** + * Retrieve a type argument associated with an ObjC object. + * + * If the type is not an ObjC or the index is not valid, + * an invalid type is returned. + */ +CINDEX_LINKAGE CXType clang_Type_getObjCTypeArg(CXType T, unsigned i); + /** * Return 1 if the CXType is a variadic function type, and 0 otherwise. */ @@ -3700,6 +3783,33 @@ CINDEX_LINKAGE CXType clang_Type_getNamedType(CXType T); */ CINDEX_LINKAGE unsigned clang_Type_isTransparentTagTypedef(CXType T); +enum CXTypeNullabilityKind { + /** + * Values of this type can never be null. + */ + CXTypeNullability_NonNull = 0, + /** + * Values of this type can be null. + */ + CXTypeNullability_Nullable = 1, + /** + * Whether values of this type can be null is (explicitly) + * unspecified. This captures a (fairly rare) case where we + * can't conclude anything about the nullability of the type even + * though it has been considered. + */ + CXTypeNullability_Unspecified = 2, + /** + * Nullability is not applicable to this type. + */ + CXTypeNullability_Invalid = 3 +}; + +/** + * Retrieve the nullability kind of a pointer type. + */ +CINDEX_LINKAGE enum CXTypeNullabilityKind clang_Type_getNullability(CXType T); + /** * List the possible error codes for \c clang_Type_getSizeOf, * \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and @@ -3778,6 +3888,13 @@ CINDEX_LINKAGE long long clang_Type_getSizeOf(CXType T); */ CINDEX_LINKAGE long long clang_Type_getOffsetOf(CXType T, const char *S); +/** + * Return the type that was modified by this attributed type. + * + * If the type is not an attributed type, an invalid type is returned. + */ +CINDEX_LINKAGE CXType clang_Type_getModifiedType(CXType T); + /** * Return the offset of the field represented by the Cursor. * @@ -4347,6 +4464,18 @@ typedef enum { CINDEX_LINKAGE unsigned clang_Cursor_getObjCPropertyAttributes(CXCursor C, unsigned reserved); +/** + * Given a cursor that represents a property declaration, return the + * name of the method that implements the getter. + */ +CINDEX_LINKAGE CXString clang_Cursor_getObjCPropertyGetterName(CXCursor C); + +/** + * Given a cursor that represents a property declaration, return the + * name of the method that implements the setter, if any. + */ +CINDEX_LINKAGE CXString clang_Cursor_getObjCPropertySetterName(CXCursor C); + /** * 'Qualifiers' written next to the return and parameter types in * Objective-C method declarations. @@ -5491,10 +5620,15 @@ enum CXCompletionContext { */ CXCompletionContext_NaturalLanguage = 1 << 21, + /** + * #include file completions should be included in the results. + */ + CXCompletionContext_IncludedFile = 1 << 22, + /** * The current context is unknown, so set all contexts. */ - CXCompletionContext_Unknown = ((1 << 22) - 1) + CXCompletionContext_Unknown = ((1 << 23) - 1) }; /** diff --git a/contrib/llvm/tools/clang/include/clang/AST/ASTContext.h b/contrib/llvm/tools/clang/include/clang/AST/ASTContext.h index 6eb86183d93..13870116c7f 100644 --- a/contrib/llvm/tools/clang/include/clang/AST/ASTContext.h +++ b/contrib/llvm/tools/clang/include/clang/AST/ASTContext.h @@ -15,6 +15,7 @@ #ifndef LLVM_CLANG_AST_ASTCONTEXT_H #define LLVM_CLANG_AST_ASTCONTEXT_H +#include "clang/AST/ASTContextAllocate.h" #include "clang/AST/ASTTypeTraits.h" #include "clang/AST/CanonicalType.h" #include "clang/AST/CommentCommandTraits.h" @@ -22,6 +23,7 @@ #include "clang/AST/Decl.h" #include "clang/AST/DeclBase.h" #include "clang/AST/DeclarationName.h" +#include "clang/AST/Expr.h" #include "clang/AST/ExternalASTSource.h" #include "clang/AST/NestedNameSpecifier.h" #include "clang/AST/PrettyPrinter.h" @@ -30,6 +32,7 @@ #include "clang/AST/TemplateName.h" #include "clang/AST/Type.h" #include "clang/Basic/AddressSpaces.h" +#include "clang/Basic/AttrKinds.h" #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/LLVM.h" #include "clang/Basic/LangOptions.h" @@ -79,6 +82,7 @@ struct fltSemantics; namespace clang { +class APFixedPoint; class APValue; class ASTMutationListener; class ASTRecordLayout; @@ -92,6 +96,7 @@ class CXXMethodDecl; class CXXRecordDecl; class DiagnosticsEngine; class Expr; +class FixedPointSemantics; class MangleContext; class MangleNumberingContext; class MaterializeTemporaryExpr; @@ -148,6 +153,22 @@ struct TypeInfo { /// Holds long-lived AST nodes (such as types and decls) that can be /// referred to throughout the semantic analysis of a file. class ASTContext : public RefCountedBase { +public: + /// Copy initialization expr of a __block variable and a boolean flag that + /// indicates whether the expression can throw. + struct BlockVarCopyInit { + BlockVarCopyInit() = default; + BlockVarCopyInit(Expr *CopyExpr, bool CanThrow) + : ExprAndFlag(CopyExpr, CanThrow) {} + void setExprAndFlag(Expr *CopyExpr, bool CanThrow) { + ExprAndFlag.setPointerAndInt(CopyExpr, CanThrow); + } + Expr *getCopyExpr() const { return ExprAndFlag.getPointer(); } + bool canThrow() const { return ExprAndFlag.getInt(); } + llvm::PointerIntPair ExprAndFlag; + }; + +private: friend class NestedNameSpecifier; mutable SmallVector Types; @@ -242,8 +263,8 @@ class ASTContext : public RefCountedBase { /// interface. llvm::DenseMap ObjCMethodRedecls; - /// Mapping from __block VarDecls to their copy initialization expr. - llvm::DenseMap BlockVarCopyInits; + /// Mapping from __block VarDecls to BlockVarCopyInit. + llvm::DenseMap BlockVarCopyInits; /// Mapping from class scope functions specialization to their /// template patterns. @@ -316,7 +337,7 @@ class ASTContext : public RefCountedBase { mutable IdentifierInfo *BoolName = nullptr; /// The identifier 'NSObject'. - IdentifierInfo *NSObjectName = nullptr; + mutable IdentifierInfo *NSObjectName = nullptr; /// The identifier 'NSCopying'. IdentifierInfo *NSCopyingName = nullptr; @@ -549,26 +570,6 @@ public: IntrusiveRefCntPtr ExternalSource; ASTMutationListener *Listener = nullptr; - /// Contains parents of a node. - using ParentVector = llvm::SmallVector; - - /// Maps from a node to its parents. This is used for nodes that have - /// pointer identity only, which are more common and we can save space by - /// only storing a unique pointer to them. - using ParentMapPointers = - llvm::DenseMap>; - - /// Parent map for nodes without pointer identity. We store a full - /// DynTypedNode for all keys. - using ParentMapOtherNodes = - llvm::DenseMap>; - /// Container for either a single DynTypedNode or for an ArrayRef to /// DynTypedNode. For use with ParentMap. class DynTypedNodeList { @@ -610,7 +611,17 @@ public: } }; - /// Returns the parents of the given node. + // A traversal scope limits the parts of the AST visible to certain analyses. + // RecursiveASTVisitor::TraverseAST will only visit reachable nodes, and + // getParents() will only observe reachable parent edges. + // + // The scope is defined by a set of "top-level" declarations. + // Initially, it is the entire TU: {getTranslationUnitDecl()}. + // Changing the scope clears the parent cache, which is expensive to rebuild. + std::vector getTraversalScope() const { return TraversalScope; } + void setTraversalScope(const std::vector &); + + /// Returns the parents of the given node (within the traversal scope). /// /// Note that this will lazily compute the parents of all nodes /// and store them for later retrieval. Thus, the first call is O(n) @@ -977,7 +988,8 @@ public: /// Get the additional modules in which the definition \p Def has /// been merged. ArrayRef getModulesWithMergedDefinition(const NamedDecl *Def) { - auto MergedIt = MergedDefModules.find(Def); + auto MergedIt = + MergedDefModules.find(cast(Def->getCanonicalDecl())); if (MergedIt == MergedDefModules.end()) return None; return MergedIt->second; @@ -1041,6 +1053,9 @@ public: CanQualType OCLSamplerTy, OCLEventTy, OCLClkEventTy; CanQualType OCLQueueTy, OCLReserveIDTy; CanQualType OMPArraySectionTy; +#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ + CanQualType Id##Ty; +#include "clang/Basic/OpenCLExtensionTypes.def" // Types for deductions in C++0x [stmt.ranged]'s desugaring. Built on demand. mutable QualType AutoDeductTy; // Deduction against 'auto'. @@ -1403,7 +1418,7 @@ public: QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const; - QualType getAttributedType(AttributedType::Kind attrKind, + QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType); @@ -1656,7 +1671,7 @@ public: } /// Retrieve the identifier 'NSObject'. - IdentifierInfo *getNSObjectName() { + IdentifierInfo *getNSObjectName() const { if (!NSObjectName) { NSObjectName = &Idents.get("NSObject"); } @@ -1961,6 +1976,9 @@ public: unsigned char getFixedPointScale(QualType Ty) const; unsigned char getFixedPointIBits(QualType Ty) const; + FixedPointSemantics getFixedPointSemantics(QualType Ty) const; + APFixedPoint getFixedPointMax(QualType Ty) const; + APFixedPoint getFixedPointMin(QualType Ty) const; DeclarationNameInfo getNameForTemplate(TemplateName Name, SourceLocation NameLoc) const; @@ -2488,6 +2506,8 @@ public: unsigned getTargetAddressSpace(LangAS AS) const; + LangAS getLangASForBuiltinAddressSpace(unsigned AS) const; + /// Get target-dependent integer value for null pointer which is used for /// constant folding. uint64_t getTargetNullPointerValue(QualType QT) const; @@ -2657,12 +2677,13 @@ public: /// otherwise returns null. const ObjCInterfaceDecl *getObjContainingInterface(const NamedDecl *ND) const; - /// Set the copy inialization expression of a block var decl. - void setBlockVarCopyInits(VarDecl*VD, Expr* Init); + /// Set the copy inialization expression of a block var decl. \p CanThrow + /// indicates whether the copy expression can throw or not. + void setBlockVarCopyInit(const VarDecl* VD, Expr *CopyExpr, bool CanThrow); /// Get the copy initialization expression of the VarDecl \p VD, or /// nullptr if none exists. - Expr *getBlockVarCopyInits(const VarDecl* VD); + BlockVarCopyInit getBlockVarCopyInit(const VarDecl* VD) const; /// Allocate an uninitialized TypeSourceInfo. /// @@ -2894,13 +2915,13 @@ private: // but we include it here so that ASTContext can quickly deallocate them. llvm::PointerIntPair LastSDM; - std::unique_ptr PointerParents; - std::unique_ptr OtherParents; + std::vector TraversalScope; + class ParentMap; + std::unique_ptr Parents; std::unique_ptr VTContext; void ReleaseDeclContextMaps(); - void ReleaseParentMapEntries(); public: enum PragmaSectionFlag : unsigned { @@ -2949,8 +2970,8 @@ inline Selector GetUnarySelector(StringRef name, ASTContext &Ctx) { /// This placement form of operator new uses the ASTContext's allocator for /// obtaining memory. /// -/// IMPORTANT: These are also declared in clang/AST/AttrIterator.h! Any changes -/// here need to also be made there. +/// IMPORTANT: These are also declared in clang/AST/ASTContextAllocate.h! +/// Any changes here need to also be made there. /// /// We intentionally avoid using a nothrow specification here so that the calls /// to this operator will not perform a null check on the result -- the @@ -2973,7 +2994,7 @@ inline Selector GetUnarySelector(StringRef name, ASTContext &Ctx) { /// allocator supports it). /// @return The allocated memory. Could be nullptr. inline void *operator new(size_t Bytes, const clang::ASTContext &C, - size_t Alignment) { + size_t Alignment /* = 8 */) { return C.Allocate(Bytes, Alignment); } @@ -3011,7 +3032,7 @@ inline void operator delete(void *Ptr, const clang::ASTContext &C, size_t) { /// allocator supports it). /// @return The allocated memory. Could be nullptr. inline void *operator new[](size_t Bytes, const clang::ASTContext& C, - size_t Alignment = 8) { + size_t Alignment /* = 8 */) { return C.Allocate(Bytes, Alignment); } diff --git a/contrib/llvm/tools/clang/include/clang/AST/ASTContextAllocate.h b/contrib/llvm/tools/clang/include/clang/AST/ASTContextAllocate.h new file mode 100644 index 00000000000..5b9eed208a4 --- /dev/null +++ b/contrib/llvm/tools/clang/include/clang/AST/ASTContextAllocate.h @@ -0,0 +1,38 @@ +//===- ASTContextAllocate.h - ASTContext allocate functions -----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file declares ASTContext allocation functions separate from the main +// code in ASTContext.h. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_AST_ASTCONTEXTALLOCATE_H +#define LLVM_CLANG_AST_ASTCONTEXTALLOCATE_H + +#include + +namespace clang { + +class ASTContext; + +} // namespace clang + +// Defined in ASTContext.h +void *operator new(size_t Bytes, const clang::ASTContext &C, + size_t Alignment = 8); +void *operator new[](size_t Bytes, const clang::ASTContext &C, + size_t Alignment = 8); + +// It is good practice to pair new/delete operators. Also, MSVC gives many +// warnings if a matching delete overload is not declared, even though the +// throw() spec guarantees it will not be implicitly called. +void operator delete(void *Ptr, const clang::ASTContext &C, size_t); +void operator delete[](void *Ptr, const clang::ASTContext &C, size_t); + +#endif // LLVM_CLANG_AST_ASTCONTEXTALLOCATE_H diff --git a/contrib/llvm/tools/clang/include/clang/AST/ASTDiagnostic.h b/contrib/llvm/tools/clang/include/clang/AST/ASTDiagnostic.h index 2534272da3a..fe92604587e 100644 --- a/contrib/llvm/tools/clang/include/clang/AST/ASTDiagnostic.h +++ b/contrib/llvm/tools/clang/include/clang/AST/ASTDiagnostic.h @@ -11,19 +11,9 @@ #define LLVM_CLANG_AST_ASTDIAGNOSTIC_H #include "clang/Basic/Diagnostic.h" +#include "clang/Basic/DiagnosticAST.h" namespace clang { - namespace diag { - enum { -#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\ - SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM, -#define ASTSTART -#include "clang/Basic/DiagnosticASTKinds.inc" -#undef DIAG - NUM_BUILTIN_AST_DIAGNOSTICS - }; - } // end namespace diag - /// DiagnosticsEngine argument formatting function for diagnostics that /// involve AST nodes. /// diff --git a/contrib/llvm/tools/clang/include/clang/AST/ASTDumperUtils.h b/contrib/llvm/tools/clang/include/clang/AST/ASTDumperUtils.h new file mode 100644 index 00000000000..5e62e902b42 --- /dev/null +++ b/contrib/llvm/tools/clang/include/clang/AST/ASTDumperUtils.h @@ -0,0 +1,97 @@ +//===--- ASTDumperUtils.h - Printing of AST nodes -------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements AST utilities for traversal down the tree. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_AST_ASTDUMPERUTILS_H +#define LLVM_CLANG_AST_ASTDUMPERUTILS_H + +#include "llvm/Support/raw_ostream.h" + +namespace clang { + +// Colors used for various parts of the AST dump +// Do not use bold yellow for any text. It is hard to read on white screens. + +struct TerminalColor { + llvm::raw_ostream::Colors Color; + bool Bold; +}; + +// Red - CastColor +// Green - TypeColor +// Bold Green - DeclKindNameColor, UndeserializedColor +// Yellow - AddressColor, LocationColor +// Blue - CommentColor, NullColor, IndentColor +// Bold Blue - AttrColor +// Bold Magenta - StmtColor +// Cyan - ValueKindColor, ObjectKindColor +// Bold Cyan - ValueColor, DeclNameColor + +// Decl kind names (VarDecl, FunctionDecl, etc) +static const TerminalColor DeclKindNameColor = {llvm::raw_ostream::GREEN, true}; +// Attr names (CleanupAttr, GuardedByAttr, etc) +static const TerminalColor AttrColor = {llvm::raw_ostream::BLUE, true}; +// Statement names (DeclStmt, ImplicitCastExpr, etc) +static const TerminalColor StmtColor = {llvm::raw_ostream::MAGENTA, true}; +// Comment names (FullComment, ParagraphComment, TextComment, etc) +static const TerminalColor CommentColor = {llvm::raw_ostream::BLUE, false}; + +// Type names (int, float, etc, plus user defined types) +static const TerminalColor TypeColor = {llvm::raw_ostream::GREEN, false}; + +// Pointer address +static const TerminalColor AddressColor = {llvm::raw_ostream::YELLOW, false}; +// Source locations +static const TerminalColor LocationColor = {llvm::raw_ostream::YELLOW, false}; + +// lvalue/xvalue +static const TerminalColor ValueKindColor = {llvm::raw_ostream::CYAN, false}; +// bitfield/objcproperty/objcsubscript/vectorcomponent +static const TerminalColor ObjectKindColor = {llvm::raw_ostream::CYAN, false}; + +// Null statements +static const TerminalColor NullColor = {llvm::raw_ostream::BLUE, false}; + +// Undeserialized entities +static const TerminalColor UndeserializedColor = {llvm::raw_ostream::GREEN, + true}; + +// CastKind from CastExpr's +static const TerminalColor CastColor = {llvm::raw_ostream::RED, false}; + +// Value of the statement +static const TerminalColor ValueColor = {llvm::raw_ostream::CYAN, true}; +// Decl names +static const TerminalColor DeclNameColor = {llvm::raw_ostream::CYAN, true}; + +// Indents ( `, -. | ) +static const TerminalColor IndentColor = {llvm::raw_ostream::BLUE, false}; + +class ColorScope { + llvm::raw_ostream &OS; + const bool ShowColors; + +public: + ColorScope(llvm::raw_ostream &OS, bool ShowColors, TerminalColor Color) + : OS(OS), ShowColors(ShowColors) { + if (ShowColors) + OS.changeColor(Color.Color, Color.Bold); + } + ~ColorScope() { + if (ShowColors) + OS.resetColor(); + } +}; + +} // namespace clang + +#endif // LLVM_CLANG_AST_ASTDUMPERUTILS_H diff --git a/contrib/llvm/tools/clang/include/clang/AST/ASTImporter.h b/contrib/llvm/tools/clang/include/clang/AST/ASTImporter.h index 2e9a8775a8a..dbb9cf35dde 100644 --- a/contrib/llvm/tools/clang/include/clang/AST/ASTImporter.h +++ b/contrib/llvm/tools/clang/include/clang/AST/ASTImporter.h @@ -25,12 +25,15 @@ #include "clang/Basic/SourceLocation.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseSet.h" +#include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/Support/Error.h" #include namespace clang { class ASTContext; +class ASTImporterLookupTable; class CXXBaseSpecifier; class CXXCtorInitializer; class Decl; @@ -43,6 +46,29 @@ class TagDecl; class TypeSourceInfo; class Attr; + class ImportError : public llvm::ErrorInfo { + public: + /// \brief Kind of error when importing an AST component. + enum ErrorKind { + NameConflict, /// Naming ambiguity (likely ODR violation). + UnsupportedConstruct, /// Not supported node or case. + Unknown /// Other error. + }; + + ErrorKind Error; + + static char ID; + + ImportError() : Error(Unknown) { } + ImportError(const ImportError &Other) : Error(Other.Error) { } + ImportError(ErrorKind Error) : Error(Error) { } + + std::string toString() const; + + void log(raw_ostream &OS) const override; + std::error_code convertToErrorCode() const override; + }; + // \brief Returns with a list of declarations started from the canonical decl // then followed by subsequent decls in the translation unit. // This gives a canonical list for each entry in the redecl chain. @@ -55,12 +81,21 @@ class Attr; /// Imports selected nodes from one AST context into another context, /// merging AST nodes where appropriate. class ASTImporter { + friend class ASTNodeImporter; public: using NonEquivalentDeclSet = llvm::DenseSet>; using ImportedCXXBaseSpecifierMap = llvm::DenseMap; private: + + /// Pointer to the import specific lookup table, which may be shared + /// amongst several ASTImporter objects. + /// This is an externally managed resource (and should exist during the + /// lifetime of the ASTImporter object) + /// If not set then the original C/C++ lookup is used. + ASTImporterLookupTable *LookupTable = nullptr; + /// The contexts we're importing to and from. ASTContext &ToContext, &FromContext; @@ -98,9 +133,13 @@ class Attr; /// (which we have already complained about). NonEquivalentDeclSet NonEquivalentDecls; + using FoundDeclsTy = SmallVector; + FoundDeclsTy findDeclsInToCtx(DeclContext *DC, DeclarationName Name); + + void AddToLookupTable(Decl *ToD); + public: - /// Create a new AST importer. - /// + /// \param ToContext The context we'll be importing into. /// /// \param ToFileManager The file manager we'll be importing into. @@ -112,9 +151,14 @@ class Attr; /// \param MinimalImport If true, the importer will attempt to import /// as little as it can, e.g., by importing declarations as forward /// declarations that can be completed at a later point. + /// + /// \param LookupTable The importer specific lookup table which may be + /// shared amongst several ASTImporter objects. + /// If not set then the original C/C++ lookup is used. ASTImporter(ASTContext &ToContext, FileManager &ToFileManager, ASTContext &FromContext, FileManager &FromFileManager, - bool MinimalImport); + bool MinimalImport, + ASTImporterLookupTable *LookupTable = nullptr); virtual ~ASTImporter(); @@ -122,31 +166,60 @@ class Attr; /// to-be-completed forward declarations when possible. bool isMinimalImport() const { return Minimal; } - /// Import the given type from the "from" context into the "to" - /// context. + /// \brief Import the given object, returns the result. /// - /// \returns the equivalent type in the "to" context, or a NULL type if - /// an error occurred. + /// \param To Import the object into this variable. + /// \param From Object to import. + /// \return Error information (success or error). + template + LLVM_NODISCARD llvm::Error importInto(ImportT &To, const ImportT &From) { + To = Import(From); + if (From && !To) + return llvm::make_error(); + return llvm::Error::success(); + // FIXME: this should be the final code + //auto ToOrErr = Import(From); + //if (ToOrErr) + // To = *ToOrErr; + //return ToOrErr.takeError(); + } + + /// Import the given type from the "from" context into the "to" + /// context. A null type is imported as a null type (no error). + /// + /// \returns The equivalent type in the "to" context, or the import error. + llvm::Expected Import_New(QualType FromT); + // FIXME: Remove this version. QualType Import(QualType FromT); /// Import the given type source information from the /// "from" context into the "to" context. /// - /// \returns the equivalent type source information in the "to" - /// context, or NULL if an error occurred. + /// \returns The equivalent type source information in the "to" + /// context, or the import error. + llvm::Expected Import_New(TypeSourceInfo *FromTSI); + // FIXME: Remove this version. TypeSourceInfo *Import(TypeSourceInfo *FromTSI); /// Import the given attribute from the "from" context into the /// "to" context. /// - /// \returns the equivalent attribute in the "to" context. + /// \returns The equivalent attribute in the "to" context, or the import + /// error. + llvm::Expected Import_New(const Attr *FromAttr); + // FIXME: Remove this version. Attr *Import(const Attr *FromAttr); /// Import the given declaration from the "from" context into the /// "to" context. /// - /// \returns the equivalent declaration in the "to" context, or a NULL type - /// if an error occurred. + /// \returns The equivalent declaration in the "to" context, or the import + /// error. + llvm::Expected Import_New(Decl *FromD); + llvm::Expected Import_New(const Decl *FromD) { + return Import_New(const_cast(FromD)); + } + // FIXME: Remove this version. Decl *Import(Decl *FromD); Decl *Import(const Decl *FromD) { return Import(const_cast(FromD)); @@ -155,104 +228,137 @@ class Attr; /// Return the copy of the given declaration in the "to" context if /// it has already been imported from the "from" context. Otherwise return /// NULL. - Decl *GetAlreadyImportedOrNull(Decl *FromD); + Decl *GetAlreadyImportedOrNull(const Decl *FromD) const; /// Import the given declaration context from the "from" /// AST context into the "to" AST context. /// /// \returns the equivalent declaration context in the "to" - /// context, or a NULL type if an error occurred. - DeclContext *ImportContext(DeclContext *FromDC); + /// context, or error value. + llvm::Expected ImportContext(DeclContext *FromDC); /// Import the given expression from the "from" context into the /// "to" context. /// - /// \returns the equivalent expression in the "to" context, or NULL if - /// an error occurred. + /// \returns The equivalent expression in the "to" context, or the import + /// error. + llvm::Expected Import_New(Expr *FromE); + // FIXME: Remove this version. Expr *Import(Expr *FromE); /// Import the given statement from the "from" context into the /// "to" context. /// - /// \returns the equivalent statement in the "to" context, or NULL if - /// an error occurred. + /// \returns The equivalent statement in the "to" context, or the import + /// error. + llvm::Expected Import_New(Stmt *FromS); + // FIXME: Remove this version. Stmt *Import(Stmt *FromS); /// Import the given nested-name-specifier from the "from" /// context into the "to" context. /// - /// \returns the equivalent nested-name-specifier in the "to" - /// context, or NULL if an error occurred. + /// \returns The equivalent nested-name-specifier in the "to" + /// context, or the import error. + llvm::Expected + Import_New(NestedNameSpecifier *FromNNS); + // FIXME: Remove this version. NestedNameSpecifier *Import(NestedNameSpecifier *FromNNS); - /// Import the given nested-name-specifier from the "from" + /// Import the given nested-name-specifier-loc from the "from" /// context into the "to" context. /// - /// \returns the equivalent nested-name-specifier in the "to" - /// context. + /// \returns The equivalent nested-name-specifier-loc in the "to" + /// context, or the import error. + llvm::Expected + Import_New(NestedNameSpecifierLoc FromNNS); + // FIXME: Remove this version. NestedNameSpecifierLoc Import(NestedNameSpecifierLoc FromNNS); - /// Import the goven template name from the "from" context into the - /// "to" context. + /// Import the given template name from the "from" context into the + /// "to" context, or the import error. + llvm::Expected Import_New(TemplateName From); + // FIXME: Remove this version. TemplateName Import(TemplateName From); /// Import the given source location from the "from" context into /// the "to" context. /// - /// \returns the equivalent source location in the "to" context, or an - /// invalid source location if an error occurred. + /// \returns The equivalent source location in the "to" context, or the + /// import error. + llvm::Expected Import_New(SourceLocation FromLoc); + // FIXME: Remove this version. SourceLocation Import(SourceLocation FromLoc); /// Import the given source range from the "from" context into /// the "to" context. /// - /// \returns the equivalent source range in the "to" context, or an - /// invalid source location if an error occurred. + /// \returns The equivalent source range in the "to" context, or the import + /// error. + llvm::Expected Import_New(SourceRange FromRange); + // FIXME: Remove this version. SourceRange Import(SourceRange FromRange); /// Import the given declaration name from the "from" /// context into the "to" context. /// - /// \returns the equivalent declaration name in the "to" context, - /// or an empty declaration name if an error occurred. + /// \returns The equivalent declaration name in the "to" context, or the + /// import error. + llvm::Expected Import_New(DeclarationName FromName); + // FIXME: Remove this version. DeclarationName Import(DeclarationName FromName); /// Import the given identifier from the "from" context /// into the "to" context. /// - /// \returns the equivalent identifier in the "to" context. + /// \returns The equivalent identifier in the "to" context. Note: It + /// returns nullptr only if the FromId was nullptr. IdentifierInfo *Import(const IdentifierInfo *FromId); /// Import the given Objective-C selector from the "from" /// context into the "to" context. /// - /// \returns the equivalent selector in the "to" context. + /// \returns The equivalent selector in the "to" context, or the import + /// error. + llvm::Expected Import_New(Selector FromSel); + // FIXME: Remove this version. Selector Import(Selector FromSel); /// Import the given file ID from the "from" context into the /// "to" context. /// - /// \returns the equivalent file ID in the source manager of the "to" - /// context. + /// \returns The equivalent file ID in the source manager of the "to" + /// context, or the import error. + llvm::Expected Import_New(FileID); + // FIXME: Remove this version. FileID Import(FileID); /// Import the given C++ constructor initializer from the "from" /// context into the "to" context. /// - /// \returns the equivalent initializer in the "to" context. + /// \returns The equivalent initializer in the "to" context, or the import + /// error. + llvm::Expected + Import_New(CXXCtorInitializer *FromInit); + // FIXME: Remove this version. CXXCtorInitializer *Import(CXXCtorInitializer *FromInit); /// Import the given CXXBaseSpecifier from the "from" context into /// the "to" context. /// - /// \returns the equivalent CXXBaseSpecifier in the source manager of the - /// "to" context. + /// \returns The equivalent CXXBaseSpecifier in the source manager of the + /// "to" context, or the import error. + llvm::Expected + Import_New(const CXXBaseSpecifier *FromSpec); + // FIXME: Remove this version. CXXBaseSpecifier *Import(const CXXBaseSpecifier *FromSpec); /// Import the definition of the given declaration, including all of /// the declarations it contains. - /// - /// This routine is intended to be used + LLVM_NODISCARD llvm::Error ImportDefinition_New(Decl *From); + + // FIXME: Compatibility function. + // Usages of this should be changed to ImportDefinition_New. void ImportDefinition(Decl *From); /// Cope with a name conflict when importing a declaration into the @@ -333,6 +439,13 @@ class Attr; /// equivalent. bool IsStructurallyEquivalent(QualType From, QualType To, bool Complain = true); + + /// Determine the index of a field in its parent record. + /// F should be a field (or indirect field) declaration. + /// \returns The index of the field in its parent context (starting from 0). + /// On error `None` is returned (parent context is non-record). + static llvm::Optional getFieldIndex(Decl *F); + }; } // namespace clang diff --git a/contrib/llvm/tools/clang/include/clang/AST/ASTImporterLookupTable.h b/contrib/llvm/tools/clang/include/clang/AST/ASTImporterLookupTable.h new file mode 100644 index 00000000000..14cafe817dd --- /dev/null +++ b/contrib/llvm/tools/clang/include/clang/AST/ASTImporterLookupTable.h @@ -0,0 +1,75 @@ +//===- ASTImporterLookupTable.h - ASTImporter specific lookup--*- 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 ASTImporterLookupTable class which implements a +// lookup procedure for the import mechanism. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_AST_ASTIMPORTERLOOKUPTABLE_H +#define LLVM_CLANG_AST_ASTIMPORTERLOOKUPTABLE_H + +#include "clang/AST/DeclBase.h" // lookup_result +#include "clang/AST/DeclarationName.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SetVector.h" + +namespace clang { + +class ASTContext; +class NamedDecl; +class DeclContext; + +// There are certain cases when normal C/C++ lookup (localUncachedLookup) +// does not find AST nodes. E.g.: +// Example 1: +// template +// struct X { +// friend void foo(); // this is never found in the DC of the TU. +// }; +// Example 2: +// // The fwd decl to Foo is not found in the lookupPtr of the DC of the +// // translation unit decl. +// // Here we could find the node by doing a traverse throught the list of +// // the Decls in the DC, but that would not scale. +// struct A { struct Foo *p; }; +// This is a severe problem because the importer decides if it has to create a +// new Decl or not based on the lookup results. +// To overcome these cases we need an importer specific lookup table which +// holds every node and we are not interested in any C/C++ specific visibility +// considerations. Simply, we must know if there is an existing Decl in a +// given DC. Once we found it then we can handle any visibility related tasks. +class ASTImporterLookupTable { + + // We store a list of declarations for each name. + // And we collect these lists for each DeclContext. + // We could have a flat map with (DeclContext, Name) tuple as key, but a two + // level map seems easier to handle. + using DeclList = llvm::SmallSetVector; + using NameMap = llvm::SmallDenseMap; + using DCMap = llvm::DenseMap; + + void add(DeclContext *DC, NamedDecl *ND); + void remove(DeclContext *DC, NamedDecl *ND); + + DCMap LookupTable; + +public: + ASTImporterLookupTable(TranslationUnitDecl &TU); + void add(NamedDecl *ND); + void remove(NamedDecl *ND); + using LookupResult = DeclList; + LookupResult lookup(DeclContext *DC, DeclarationName Name) const; + void dump(DeclContext *DC) const; + void dump() const; +}; + +} // namespace clang + +#endif // LLVM_CLANG_AST_ASTIMPORTERLOOKUPTABLE_H diff --git a/contrib/llvm/tools/clang/include/clang/AST/ASTStructuralEquivalence.h b/contrib/llvm/tools/clang/include/clang/AST/ASTStructuralEquivalence.h index d32f87d43e0..f8847505bc7 100644 --- a/contrib/llvm/tools/clang/include/clang/AST/ASTStructuralEquivalence.h +++ b/contrib/llvm/tools/clang/include/clang/AST/ASTStructuralEquivalence.h @@ -15,6 +15,7 @@ #ifndef LLVM_CLANG_AST_ASTSTRUCTURALEQUIVALENCE_H #define LLVM_CLANG_AST_ASTSTRUCTURALEQUIVALENCE_H +#include "clang/AST/DeclBase.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/Optional.h" @@ -114,8 +115,19 @@ struct StructuralEquivalenceContext { private: /// Finish checking all of the structural equivalences. /// - /// \returns true if an error occurred, false otherwise. + /// \returns true if the equivalence check failed (non-equivalence detected), + /// false if equivalence was detected. bool Finish(); + + /// Check for common properties at Finish. + /// \returns true if D1 and D2 may be equivalent, + /// false if they are for sure not. + bool CheckCommonEquivalence(Decl *D1, Decl *D2); + + /// Check for class dependent properties at Finish. + /// \returns true if D1 and D2 may be equivalent, + /// false if they are for sure not. + bool CheckKindSpecificEquivalence(Decl *D1, Decl *D2); }; } // namespace clang diff --git a/contrib/llvm/tools/clang/include/clang/AST/ASTVector.h b/contrib/llvm/tools/clang/include/clang/AST/ASTVector.h index 80cd6b7007a..51de119f080 100644 --- a/contrib/llvm/tools/clang/include/clang/AST/ASTVector.h +++ b/contrib/llvm/tools/clang/include/clang/AST/ASTVector.h @@ -18,6 +18,7 @@ #ifndef LLVM_CLANG_AST_ASTVECTOR_H #define LLVM_CLANG_AST_ASTVECTOR_H +#include "clang/AST/ASTContextAllocate.h" #include "llvm/ADT/PointerIntPair.h" #include #include diff --git a/contrib/llvm/tools/clang/include/clang/AST/Attr.h b/contrib/llvm/tools/clang/include/clang/AST/Attr.h index 20922742f68..3a319326d26 100644 --- a/contrib/llvm/tools/clang/include/clang/AST/Attr.h +++ b/contrib/llvm/tools/clang/include/clang/AST/Attr.h @@ -14,6 +14,7 @@ #ifndef LLVM_CLANG_AST_ATTR_H #define LLVM_CLANG_AST_ATTR_H +#include "clang/AST/ASTContextAllocate.h" // For Attrs.inc #include "clang/AST/AttrIterator.h" #include "clang/AST/Decl.h" #include "clang/AST/Expr.h" @@ -113,6 +114,19 @@ public: void printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const; }; +class TypeAttr : public Attr { +protected: + TypeAttr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex, + bool IsLateParsed) + : Attr(AK, R, SpellingListIndex, IsLateParsed) {} + +public: + static bool classof(const Attr *A) { + return A->getKind() >= attr::FirstTypeAttr && + A->getKind() <= attr::LastTypeAttr; + } +}; + class StmtAttr : public Attr { protected: StmtAttr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex, diff --git a/contrib/llvm/tools/clang/include/clang/AST/AttrIterator.h b/contrib/llvm/tools/clang/include/clang/AST/AttrIterator.h index 2087ecc0e70..43ad1c93196 100644 --- a/contrib/llvm/tools/clang/include/clang/AST/AttrIterator.h +++ b/contrib/llvm/tools/clang/include/clang/AST/AttrIterator.h @@ -26,25 +26,6 @@ namespace clang { class ASTContext; class Attr; -} // namespace clang - -// Defined in ASTContext.h -void *operator new(size_t Bytes, const clang::ASTContext &C, - size_t Alignment = 8); - -// FIXME: Being forced to not have a default argument here due to redeclaration -// rules on default arguments sucks -void *operator new[](size_t Bytes, const clang::ASTContext &C, - size_t Alignment); - -// It is good practice to pair new/delete operators. Also, MSVC gives many -// warnings if a matching delete overload is not declared, even though the -// throw() spec guarantees it will not be implicitly called. -void operator delete(void *Ptr, const clang::ASTContext &C, size_t); -void operator delete[](void *Ptr, const clang::ASTContext &C, size_t); - -namespace clang { - /// AttrVec - A vector of Attr, which is how they are stored on the AST. using AttrVec = SmallVector; diff --git a/contrib/llvm/tools/clang/include/clang/AST/AttrVisitor.h b/contrib/llvm/tools/clang/include/clang/AST/AttrVisitor.h new file mode 100644 index 00000000000..867f9e7ad18 --- /dev/null +++ b/contrib/llvm/tools/clang/include/clang/AST/AttrVisitor.h @@ -0,0 +1,76 @@ +//===- AttrVisitor.h - Visitor for Attr subclasses --------------*- 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 AttrVisitor interface. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_AST_ATTRVISITOR_H +#define LLVM_CLANG_AST_ATTRVISITOR_H + +#include "clang/AST/Attr.h" + +namespace clang { + +namespace attrvisitor { + +/// A simple visitor class that helps create attribute visitors. +template