Index: lib/ARCMigrate/Transforms.cpp =================================================================== --- lib/ARCMigrate/Transforms.cpp +++ lib/ARCMigrate/Transforms.cpp @@ -9,14 +9,25 @@ #include "Transforms.h" #include "Internals.h" +#include "clang/ARCMigrate/ARCMT.h" #include "clang/AST/ASTContext.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/Analysis/DomainSpecific/CocoaConventions.h" +#include "clang/Basic/LangOptions.h" +#include "clang/Basic/LLVM.h" +#include "clang/Basic/SourceLocation.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/TargetInfo.h" #include "clang/Lex/Lexer.h" #include "clang/Lex/Preprocessor.h" +#include "clang/Lex/Token.h" #include "clang/Sema/Sema.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/ADT/Triple.h" +#include "llvm/Support/Casting.h" +#include +#include +#include using namespace clang; using namespace arcmt; @@ -348,7 +359,7 @@ } }; -} +} // end anonymous namespace MigrationContext::~MigrationContext() { for (traverser_iterator @@ -418,7 +429,7 @@ if (tok.is(tok::r_paren)) return false; - while (1) { + while (true) { if (tok.isNot(tok::raw_identifier)) return false; if (tok.getRawIdentifier() == fromAttr) { if (!toAttr.empty()) { Index: lib/AST/Expr.cpp =================================================================== --- lib/AST/Expr.cpp +++ lib/AST/Expr.cpp @@ -12,27 +12,61 @@ //===----------------------------------------------------------------------===// #include "clang/AST/ASTContext.h" -#include "clang/AST/Attr.h" +#include "clang/AST/Decl.h" +#include "clang/AST/DeclAccessPair.h" +#include "clang/AST/DeclarationName.h" +#include "clang/AST/DeclBase.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclObjC.h" #include "clang/AST/DeclTemplate.h" #include "clang/AST/EvaluatedExprVisitor.h" #include "clang/AST/Expr.h" #include "clang/AST/ExprCXX.h" +#include "clang/AST/ExprObjC.h" +#include "clang/AST/ExprOpenMP.h" #include "clang/AST/Mangle.h" -#include "clang/AST/RecordLayout.h" -#include "clang/AST/StmtVisitor.h" +#include "clang/AST/NestedNameSpecifier.h" +#include "clang/AST/OperationKinds.h" +#include "clang/AST/PrettyPrinter.h" +#include "clang/AST/Stmt.h" +#include "clang/AST/TemplateBase.h" +#include "clang/AST/Type.h" +#include "clang/Basic/ABI.h" +#include "clang/Basic/AddressSpaces.h" #include "clang/Basic/Builtins.h" #include "clang/Basic/CharInfo.h" +#include "clang/Basic/Lambda.h" +#include "clang/Basic/LangOptions.h" +#include "clang/Basic/LLVM.h" +#include "clang/Basic/OperatorKinds.h" +#include "clang/Basic/SourceLocation.h" #include "clang/Basic/SourceManager.h" +#include "clang/Basic/Specifiers.h" #include "clang/Basic/TargetInfo.h" #include "clang/Lex/Lexer.h" #include "clang/Lex/LiteralSupport.h" -#include "clang/Sema/SemaDiagnostic.h" +#include "clang/Lex/Token.h" +#include "llvm/ADT/APFloat.h" +#include "llvm/ADT/APSInt.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/None.h" +#include "llvm/ADT/SmallString.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/AlignOf.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" #include +#include +#include #include +#include +#include +#include +#include +#include + using namespace clang; const CXXRecordDecl *Expr::getBestDynamicClassType() const { @@ -170,6 +204,7 @@ // // See also Stmt.cpp:{getLocStart(),getLocEnd()}. namespace { + /// This implementation is used when a class provides a custom /// implementation of getExprLoc. template @@ -187,7 +222,8 @@ SourceLocation (Expr::*v)() const) { return static_cast(expr)->getLocStart(); } -} + +} // end anonymous namespace SourceLocation Expr::getExprLoc() const { switch (getStmtClass()) { @@ -1022,7 +1058,7 @@ StringOffset = *StartTokenByteOffset; ByteNo -= StringOffset; } - while (1) { + while (true) { assert(TokNo < getNumConcatenated() && "Invalid byte number!"); SourceLocation StrTokLoc = getStrTokenLoc(TokNo); @@ -1077,8 +1113,6 @@ } } - - /// getOpcodeStr - Turn an Opcode enum value into the punctuation char it /// corresponds to, e.g. "sizeof" or "[pre]++". StringRef UnaryOperator::getOpcodeStr(Opcode Op) { @@ -1120,7 +1154,6 @@ } } - //===----------------------------------------------------------------------===// // Postfix Operators. //===----------------------------------------------------------------------===// @@ -1132,7 +1165,6 @@ fn->isValueDependent(), fn->isInstantiationDependent(), fn->containsUnexpandedParameterPack()), NumArgs(args.size()) { - unsigned NumPreArgs = preargs.size(); SubExprs = new (C) Stmt *[args.size()+PREARGS_START+NumPreArgs]; SubExprs[FN] = fn; @@ -1884,7 +1916,6 @@ return TheBlock->getBody(); } - //===----------------------------------------------------------------------===// // Generic Expression Routines //===----------------------------------------------------------------------===// @@ -2779,6 +2810,7 @@ } namespace { + /// \brief Look for any side effects within a Stmt. class SideEffectFinder : public ConstEvaluatedExprVisitor { typedef ConstEvaluatedExprVisitor Inherited; @@ -2798,7 +2830,8 @@ HasSideEffects = true; } }; -} + +} // end anonymous namespace bool Expr::HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects) const { @@ -3071,6 +3104,7 @@ } namespace { + /// \brief Look for a call to a non-trivial function within an expression. class NonTrivialCallFinder : public ConstEvaluatedExprVisitor { @@ -3116,7 +3150,8 @@ NonTrivial = true; } }; -} + +} // end anonymous namespace bool Expr::hasNonTrivialCall(const ASTContext &Ctx) const { NonTrivialCallFinder Finder(Ctx); Index: lib/AST/ExprCXX.cpp =================================================================== --- lib/AST/ExprCXX.cpp +++ lib/AST/ExprCXX.cpp @@ -13,13 +13,34 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/Attr.h" +#include "clang/AST/Decl.h" +#include "clang/AST/DeclAccessPair.h" +#include "clang/AST/DeclarationName.h" +#include "clang/AST/DeclBase.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclTemplate.h" +#include "clang/AST/Expr.h" #include "clang/AST/ExprCXX.h" +#include "clang/AST/LambdaCapture.h" +#include "clang/AST/NestedNameSpecifier.h" +#include "clang/AST/TemplateBase.h" +#include "clang/AST/Type.h" #include "clang/AST/TypeLoc.h" #include "clang/Basic/IdentifierTable.h" -using namespace clang; +#include "clang/Basic/LLVM.h" +#include "clang/Basic/OperatorKinds.h" +#include "clang/Basic/SourceLocation.h" +#include "clang/Basic/Specifiers.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/AlignOf.h" +#include "llvm/Support/Casting.h" +#include "llvm/Support/ErrorHandling.h" +#include +#include +#include +#include +using namespace clang; //===----------------------------------------------------------------------===// // Child Iterators for iterating over subexpressions/substatements @@ -477,7 +498,6 @@ return nullptr; } - CXXRecordDecl *CXXMemberCallExpr::getRecordDecl() const { Expr* ThisArg = getImplicitObjectArgument(); if (!ThisArg) @@ -489,7 +509,6 @@ return ThisArg->getType()->getAsCXXRecordDecl(); } - //===----------------------------------------------------------------------===// // Named casts //===----------------------------------------------------------------------===// @@ -1004,7 +1023,6 @@ TemplateParameterList *LambdaExpr::getTemplateParameterList() const { CXXRecordDecl *Record = getLambdaClass(); return Record->getGenericLambdaTemplateParameterList(); - } CompoundStmt *LambdaExpr::getBody() const { @@ -1012,7 +1030,7 @@ // initialized in ASTStmtReader::VisitLambdaExpr, but for reasons I // don't understand, that doesn't work. if (!getStoredStmts()[NumCaptures]) - *const_cast(&getStoredStmts()[NumCaptures]) = + *const_cast(&getStoredStmts()[NumCaptures]) = getCallOperator()->getBody(); return static_cast(getStoredStmts()[NumCaptures]); @@ -1174,7 +1192,7 @@ void *Mem = C.Allocate(Size, llvm::alignOf()); CXXDependentScopeMemberExpr *E = new (Mem) CXXDependentScopeMemberExpr(C, nullptr, QualType(), - 0, SourceLocation(), + false, SourceLocation(), NestedNameSpecifierLoc(), SourceLocation(), nullptr, DeclarationNameInfo(), nullptr); Index: lib/AST/Stmt.cpp =================================================================== --- lib/AST/Stmt.cpp +++ lib/AST/Stmt.cpp @@ -13,6 +13,8 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/ASTDiagnostic.h" +#include "clang/AST/Decl.h" +#include "clang/AST/DeclGroup.h" #include "clang/AST/ExprCXX.h" #include "clang/AST/ExprObjC.h" #include "clang/AST/ExprOpenMP.h" @@ -22,10 +24,24 @@ #include "clang/AST/StmtOpenMP.h" #include "clang/AST/Type.h" #include "clang/Basic/CharInfo.h" +#include "clang/Basic/LLVM.h" +#include "clang/Basic/SourceLocation.h" #include "clang/Basic/TargetInfo.h" #include "clang/Lex/Token.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/AlignOf.h" +#include "llvm/Support/Casting.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" +#include +#include +#include +#include + using namespace clang; static struct StmtClassNameTable { @@ -150,6 +166,7 @@ } namespace { + struct good {}; struct bad {}; @@ -191,7 +208,8 @@ (void) is_good(implements_getLocStart(&type::getLocStart)) #define ASSERT_IMPLEMENTS_getLocEnd(type) \ (void) is_good(implements_getLocEnd(&type::getLocEnd)) -} + +} // end anonymous namespace /// Check whether the various Stmt classes implement their member /// functions. @@ -222,6 +240,7 @@ // // See also Expr.cpp:getExprLoc(). namespace { + /// This implementation is used when a class provides a custom /// implementation of getSourceRange. template @@ -240,7 +259,8 @@ return SourceRange(static_cast(stmt)->getLocStart(), static_cast(stmt)->getLocEnd()); } -} + +} // end anonymous namespace SourceRange Stmt::getSourceRange() const { switch (getStmtClass()) { @@ -506,7 +526,7 @@ unsigned LastAsmStringToken = 0; unsigned LastAsmStringOffset = 0; - while (1) { + while (true) { // Done with the string? if (CurPtr == StrEnd) { if (!CurStringPiece.empty()) @@ -945,7 +965,7 @@ SEHExceptStmt* SEHExceptStmt::Create(const ASTContext &C, SourceLocation Loc, Expr *FilterExpr, Stmt *Block) { - return new(C) SEHExceptStmt(Loc,FilterExpr,Block); + return new(C) SEHExceptStmt(Loc, FilterExpr, Block); } SEHFinallyStmt::SEHFinallyStmt(SourceLocation Loc, @@ -957,7 +977,7 @@ SEHFinallyStmt* SEHFinallyStmt::Create(const ASTContext &C, SourceLocation Loc, Stmt *Block) { - return new(C)SEHFinallyStmt(Loc,Block); + return new(C)SEHFinallyStmt(Loc, Block); } CapturedStmt::Capture::Capture(SourceLocation Loc, VariableCaptureKind Kind, Index: lib/AST/Type.cpp =================================================================== --- lib/AST/Type.cpp +++ lib/AST/Type.cpp @@ -15,17 +15,29 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/Attr.h" #include "clang/AST/CharUnits.h" +#include "clang/AST/Decl.h" +#include "clang/AST/DeclBase.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclObjC.h" #include "clang/AST/DeclTemplate.h" #include "clang/AST/Expr.h" #include "clang/AST/PrettyPrinter.h" +#include "clang/AST/TemplateBase.h" #include "clang/AST/TypeVisitor.h" +#include "clang/Basic/LangOptions.h" #include "clang/Basic/Specifiers.h" #include "clang/Basic/TargetInfo.h" #include "llvm/ADT/APSInt.h" -#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/None.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/Support/Casting.h" +#include "llvm/Support/MathExtras.h" #include +#include +#include +#include + using namespace clang; bool Qualifiers::isStrictSupersetOf(Qualifiers Other) const { @@ -354,26 +366,31 @@ } } } + bool Type::isClassType() const { if (const RecordType *RT = getAs()) return RT->getDecl()->isClass(); return false; } + bool Type::isStructureType() const { if (const RecordType *RT = getAs()) return RT->getDecl()->isStruct(); return false; } + bool Type::isObjCBoxableRecordType() const { if (const RecordType *RT = getAs()) return RT->getDecl()->hasAttr(); return false; } + bool Type::isInterfaceType() const { if (const RecordType *RT = getAs()) return RT->getDecl()->isInterface(); return false; } + bool Type::isStructureOrClassType() const { if (const RecordType *RT = getAs()) { RecordDecl *RD = RT->getDecl(); @@ -381,6 +398,7 @@ } return false; } + bool Type::isVoidPointerType() const { if (const PointerType *PT = getAs()) return PT->getPointeeType()->isVoidType(); @@ -1501,6 +1519,7 @@ } return nullptr; } + const ObjCObjectPointerType *Type::getAsObjCInterfacePointerType() const { if (const ObjCObjectPointerType *OPT = getAs()) { if (OPT->getInterfaceType()) @@ -1538,6 +1557,7 @@ } namespace { + class GetContainedAutoVisitor : public TypeVisitor { public: @@ -1557,39 +1577,50 @@ AutoType *VisitPointerType(const PointerType *T) { return Visit(T->getPointeeType()); } + AutoType *VisitBlockPointerType(const BlockPointerType *T) { return Visit(T->getPointeeType()); } + AutoType *VisitReferenceType(const ReferenceType *T) { return Visit(T->getPointeeTypeAsWritten()); } + AutoType *VisitMemberPointerType(const MemberPointerType *T) { return Visit(T->getPointeeType()); } + AutoType *VisitArrayType(const ArrayType *T) { return Visit(T->getElementType()); } + AutoType *VisitDependentSizedExtVectorType( const DependentSizedExtVectorType *T) { return Visit(T->getElementType()); } + AutoType *VisitVectorType(const VectorType *T) { return Visit(T->getElementType()); } + AutoType *VisitFunctionType(const FunctionType *T) { return Visit(T->getReturnType()); } + AutoType *VisitParenType(const ParenType *T) { return Visit(T->getInnerType()); } + AutoType *VisitAttributedType(const AttributedType *T) { return Visit(T->getModifiedType()); } + AutoType *VisitAdjustedType(const AdjustedType *T) { return Visit(T->getOriginalType()); } }; -} + +} // end anonymous namespace AutoType *Type::getContainedAutoType() const { return GetContainedAutoVisitor().Visit(this); @@ -1634,7 +1665,6 @@ return false; } - bool Type::isIntegralOrUnscopedEnumerationType() const { if (const BuiltinType *BT = dyn_cast(CanonicalType)) return BT->getKind() >= BuiltinType::Bool && @@ -1650,8 +1680,6 @@ return false; } - - bool Type::isCharType() const { if (const BuiltinType *BT = dyn_cast(CanonicalType)) return BT->getKind() == BuiltinType::Char_U || @@ -1976,7 +2004,7 @@ // We return false for that case. Except for incomplete arrays of PODs, which // are PODs according to the standard. if (isNull()) - return 0; + return false; if ((*this)->isIncompleteArrayType()) return Context.getBaseElementType(*this).isCXX98PODType(Context); @@ -2036,7 +2064,7 @@ // We return false for that case. Except for incomplete arrays of PODs, which // are PODs according to the standard. if (isNull()) - return 0; + return false; if ((*this)->isArrayType()) return Context.getBaseElementType(*this).isTrivialType(Context); @@ -2149,8 +2177,6 @@ return false; } - - bool Type::isLiteralType(const ASTContext &Ctx) const { if (isDependentType()) return false; @@ -2939,7 +2965,6 @@ : UnaryTransformType(BaseType, C.DependentTy, UKind, QualType()) {} - TagType::TagType(TypeClass TC, const TagDecl *D, QualType can) : Type(TC, can, D->isDependentType(), /*InstantiationDependent=*/D->isDependentType(), @@ -3230,11 +3255,13 @@ L.hasLocalOrUnnamedType() | R.hasLocalOrUnnamedType()); } }; -} + +} // end anonymous namespace static CachedProperties computeCachedProperties(const Type *T); namespace clang { + /// The type-property cache. This is templated so as to be /// instantiated at an internal type to prevent unnecessary symbol /// leakage. @@ -3272,7 +3299,8 @@ T->TypeBits.CachedLocalOrUnnamed = Result.hasLocalOrUnnamedType(); } }; -} + +} // end namespace clang // Instantiate the friend template at a private class. In a // reasonable implementation, these symbols will be internal. @@ -3703,11 +3731,13 @@ return typedefType->getDecl()->hasAttr(); return false; } + bool Type::isObjCRetainableType() const { return isObjCObjectPointerType() || isBlockPointerType() || isObjCNSObjectType(); } + bool Type::isObjCIndirectLifetimeType() const { if (isObjCLifetimeType()) return true; Index: lib/AST/VTableBuilder.cpp =================================================================== --- lib/AST/VTableBuilder.cpp +++ lib/AST/VTableBuilder.cpp @@ -14,15 +14,38 @@ #include "clang/AST/VTableBuilder.h" #include "clang/AST/ASTContext.h" #include "clang/AST/ASTDiagnostic.h" +#include "clang/AST/CanonicalType.h" #include "clang/AST/CXXInheritance.h" +#include "clang/AST/Decl.h" +#include "clang/AST/DeclarationName.h" +#include "clang/AST/Expr.h" #include "clang/AST/RecordLayout.h" +#include "clang/AST/Type.h" +#include "clang/Basic/LangOptions.h" #include "clang/Basic/TargetInfo.h" +#include "llvm/ADT/DenseSet.h" +#include "llvm/ADT/iterator_range.h" #include "llvm/ADT/SetOperations.h" +#include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/Support/Casting.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace clang; @@ -152,9 +175,10 @@ dump(llvm::errs(), BaseSubobject(MostDerivedClass, CharUnits::Zero()), VisitedVirtualBases); } - }; +} // end anonymous namespace + FinalOverriders::FinalOverriders(const CXXRecordDecl *MostDerivedClass, CharUnits MostDerivedClassOffset, const CXXRecordDecl *LayoutClass) @@ -439,6 +463,8 @@ } } +namespace { + /// VCallOffsetMap - Keeps track of vcall offsets when building a vtable. struct VCallOffsetMap { @@ -467,6 +493,8 @@ bool empty() const { return Offsets.empty(); } }; +} // end anonymous namespace + static bool HasSameVirtualSignature(const CXXMethodDecl *LHS, const CXXMethodDecl *RHS) { const FunctionProtoType *LT = @@ -529,6 +557,8 @@ llvm_unreachable("Should always find a vcall offset offset!"); } +namespace { + /// VCallAndVBaseOffsetBuilder - Class for building vcall and vbase offsets. class VCallAndVBaseOffsetBuilder { public: @@ -606,6 +636,8 @@ return VBaseOffsetOffsets; } }; + +} // end anonymous namespace void VCallAndVBaseOffsetBuilder::AddVCallAndVBaseOffsets(BaseSubobject Base, @@ -767,6 +799,8 @@ } } +namespace { + /// ItaniumVTableBuilder - Class for building vtable layout information. class ItaniumVTableBuilder { public: @@ -930,7 +964,6 @@ CharUnits BaseOffsetInLayoutClass, const CXXRecordDecl *FirstBaseInPrimaryBaseChain, CharUnits FirstBaseOffsetInLayoutClass) const; - /// AddMethods - Add the methods of this base subobject and all its /// primary bases to the vtable components vector. @@ -1062,6 +1095,8 @@ void dumpLayout(raw_ostream&); }; +} // end anonymous namespace + void ItaniumVTableBuilder::AddThunk(const CXXMethodDecl *MD, const ThunkInfo &Thunk) { assert(!isBuildingConstructorVTable() && @@ -2028,8 +2063,8 @@ Out << "[unused] " << Str; if (MD->isPure()) Out << " [pure]"; + break; } - } Out << '\n'; @@ -2201,7 +2236,6 @@ Out << '\n'; } -} VTableLayout::VTableLayout(uint64_t NumVTableComponents, const VTableComponent *VTableComponents, @@ -2301,7 +2335,7 @@ return; ItaniumVTableBuilder Builder(*this, RD, CharUnits::Zero(), - /*MostDerivedClassIsVirtual=*/0, RD); + /*MostDerivedClassIsVirtual=*/false, RD); Entry = CreateVTableLayout(Builder); MethodVTableIndices.insert(Builder.vtable_indices_begin(), @@ -2591,7 +2625,7 @@ void dumpLayout(raw_ostream &); }; -} // end namespace +} // end anonymous namespace // Let's study one class hierarchy as an example: // struct A { @@ -3396,9 +3430,11 @@ } namespace { + typedef llvm::SetVector, llvm::DenseSet> FullPathTy; -} + +} // end anonymous namespace // This recursive function finds all paths from a subobject centered at // (RD, Offset) to the subobject located at IntroducingObject. Index: lib/ASTMatchers/Dynamic/Parser.cpp =================================================================== --- lib/ASTMatchers/Dynamic/Parser.cpp +++ lib/ASTMatchers/Dynamic/Parser.cpp @@ -1,4 +1,4 @@ -//===--- Parser.cpp - Matcher expression parser -----*- C++ -*-===// +//===--- Parser.cpp - Matcher expression parser -----------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -13,13 +13,20 @@ //===----------------------------------------------------------------------===// #include "clang/ASTMatchers/Dynamic/Parser.h" +#include "clang/ASTMatchers/Dynamic/Diagnostics.h" #include "clang/ASTMatchers/Dynamic/Registry.h" #include "clang/Basic/CharInfo.h" #include "llvm/ADT/Optional.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ManagedStatic.h" +#include +#include +#include #include +#include #include + namespace clang { namespace ast_matchers { namespace dynamic { @@ -138,7 +145,7 @@ if (isAlphanumeric(Code[0])) { // Parse an identifier size_t TokenLength = 1; - while (1) { + while (true) { // A code completion location in/immediately after an identifier will // cause the portion of the identifier before the code completion // location to become a code completion token. @@ -351,7 +358,7 @@ EndToken = Tokenizer->consumeNextToken(); break; } - if (Args.size() > 0) { + if (!Args.empty()) { // We must find a , token to continue. const TokenInfo CommaToken = Tokenizer->consumeNextToken(); if (CommaToken.Kind != TokenInfo::TK_Comma) { @@ -607,6 +614,6 @@ return Result; } -} // namespace dynamic -} // namespace ast_matchers -} // namespace clang +} // end namespace dynamic +} // end namespace ast_matchers +} // end namespace clang Index: lib/ASTMatchers/Dynamic/Registry.cpp =================================================================== --- lib/ASTMatchers/Dynamic/Registry.cpp +++ lib/ASTMatchers/Dynamic/Registry.cpp @@ -1,32 +1,39 @@ -//===--- Registry.cpp - Matcher registry -------------------------===// +//===--- Registry.cpp - Matcher registry ------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // -//===------------------------------------------------------------===// +//===----------------------------------------------------------------------===// /// /// \file /// \brief Registry map populated at static initialization time. /// -//===------------------------------------------------------------===// +//===----------------------------------------------------------------------===// #include "clang/ASTMatchers/Dynamic/Registry.h" #include "Marshallers.h" #include "clang/ASTMatchers/ASTMatchers.h" +#include "llvm/ADT/Optional.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/ManagedStatic.h" +#include "llvm/Support/raw_ostream.h" +#include +#include #include +#include #include +#include using namespace clang::ast_type_traits; namespace clang { namespace ast_matchers { namespace dynamic { + namespace { using internal::MatcherDescriptor; @@ -68,7 +75,7 @@ }; \ registerMatcher(#name, \ new internal::OverloadedMatcherDescriptor(Callbacks)); \ - } while (0) + } while (false) /// \brief Generate a registry map with all the known matchers. RegistryMaps::RegistryMaps() { @@ -432,7 +439,7 @@ static llvm::ManagedStatic RegistryData; -} // anonymous namespace +} // end anonymous namespace // static llvm::Optional Registry::lookupMatcherCtor(StringRef MatcherName) { @@ -461,7 +468,7 @@ return OS; } -} // namespace +} // end anonymous namespace std::vector Registry::getAcceptedCompletionTypes( ArrayRef> Context) { @@ -600,6 +607,6 @@ return VariantMatcher(); } -} // namespace dynamic -} // namespace ast_matchers -} // namespace clang +} // end namespace dynamic +} // end namespace ast_matchers +} // end namespace clang