Skip to content

[gardening][IDE] Replace typedef with using #15512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions include/swift/IDE/ModuleInterfacePrinting.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enum class ModuleTraversal : unsigned {
};

/// Options used to describe the traversal of a module for printing.
typedef OptionSet<ModuleTraversal> ModuleTraversalOptions;
using ModuleTraversalOptions = OptionSet<ModuleTraversal>;

ArrayRef<StringRef> collectModuleGroups(ModuleDecl *M,
std::vector<StringRef> &Scratch);
Expand Down Expand Up @@ -82,4 +82,3 @@ void printSwiftSourceInterface(SourceFile &File, ASTPrinter &Printer,
} // namespace swift

#endif // SWIFT_IDE_MODULE_INTERFACE_PRINTING_H

4 changes: 2 additions & 2 deletions lib/IDE/CodeCompletion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
using namespace swift;
using namespace ide;

typedef std::vector<std::pair<StringRef, StringRef>> CommandWordsPairs;
using CommandWordsPairs = std::vector<std::pair<StringRef, StringRef>>;

enum CodeCompletionCommandKind {
none,
Expand Down Expand Up @@ -309,7 +309,7 @@ static bool shouldHideDeclFromCompletionResults(const ValueDecl *D) {
return false;
}

typedef std::function<bool(ValueDecl*, DeclVisibilityKind)> DeclFilter;
using DeclFilter = std::function<bool(ValueDecl *, DeclVisibilityKind)>;
static bool DefaultFilter(ValueDecl* VD, DeclVisibilityKind Kind) {
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/IDE/Formatting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct TokenInfo {
operator bool() { return StartOfLineTarget && StartOfLineBeforeTarget; }
};

typedef llvm::SmallString<64> StringBuilder;
using StringBuilder = llvm::SmallString<64>;

static SourceLoc getVarDeclInitEnd(VarDecl *VD) {
return VD->getBracesRange().isValid()
Expand Down Expand Up @@ -485,7 +485,7 @@ class FormatContext {
};

class FormatWalker : public SourceEntityWalker {
typedef ArrayRef<Token>::iterator TokenIt;
using TokenIt = ArrayRef<Token>::iterator;
class SiblingCollector {
SourceLoc FoundSibling;
SourceManager &SM;
Expand Down
8 changes: 5 additions & 3 deletions lib/IDE/IDETypeChecking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,10 @@ struct SynthesizedExtensionAnalyzer::Implementation {
}
};

typedef llvm::MapVector<ExtensionDecl*, SynthesizedExtensionInfo> ExtensionInfoMap;
typedef llvm::MapVector<ExtensionDecl*, ExtensionMergeInfo> ExtensionMergeInfoMap;
using ExtensionInfoMap =
llvm::MapVector<ExtensionDecl *, SynthesizedExtensionInfo>;
using ExtensionMergeInfoMap =
llvm::MapVector<ExtensionDecl *, ExtensionMergeInfo>;

struct ExtensionMergeGroup {

Expand Down Expand Up @@ -240,7 +242,7 @@ struct SynthesizedExtensionAnalyzer::Implementation {
}
};

typedef std::vector<ExtensionMergeGroup> MergeGroupVector;
using MergeGroupVector = std::vector<ExtensionMergeGroup>;

NominalTypeDecl *Target;
Type BaseType;
Expand Down
4 changes: 2 additions & 2 deletions lib/IDE/SyntaxModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ SyntaxModelContext::~SyntaxModelContext() {

namespace {

typedef ASTWalker::ParentTy ASTNodeType;
using ASTNodeType = ASTWalker::ParentTy;

struct StructureElement {
SyntaxStructureNode StructureNode;
Expand Down Expand Up @@ -286,7 +286,7 @@ class ModelASTWalker : public ASTWalker {
bool handleAttrs(const DeclAttributes &Attrs);
bool handleAttrs(const TypeAttributes &Attrs);

typedef std::pair<const DeclAttribute *, SourceRange> DeclAttributeAndRange;
using DeclAttributeAndRange = std::pair<const DeclAttribute *, SourceRange>;

bool handleSpecialDeclAttribute(const DeclAttribute *Decl,
ArrayRef<Token> Toks);
Expand Down
6 changes: 3 additions & 3 deletions lib/IDE/TypeReconstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
using namespace swift;

// FIXME: replace with std::string and StringRef as appropriate to each case.
typedef const std::string ConstString;
using ConstString = const std::string;

static std::string stringWithFormat(const char *fmt_str, ...) {
int final_n, n = ((int)strlen(fmt_str)) * 2;
Expand Down Expand Up @@ -76,7 +76,7 @@ GetClangTypeKindFromSwiftKind(DeclKind decl_kind) {

class DeclsLookupSource {
public:
typedef SmallVectorImpl<ValueDecl *> ValueDecls;
using ValueDecls = SmallVectorImpl<ValueDecl *>;

private:
class VisibleDeclsConsumer : public VisibleDeclConsumer {
Expand Down Expand Up @@ -124,7 +124,7 @@ class DeclsLookupSource {
Invalid
};

typedef Optional<std::string> PrivateDeclIdentifier;
using PrivateDeclIdentifier = Optional<std::string>;

static DeclsLookupSource
GetDeclsLookupSource(ASTContext &ast, ConstString module_name,
Expand Down