diff --git a/include/swift/AST/Expr.h b/include/swift/AST/Expr.h index 679cc010a96..e6af2df8196 100644 --- a/include/swift/AST/Expr.h +++ b/include/swift/AST/Expr.h @@ -4685,6 +4685,9 @@ public: SourceRange getSourceRange() const { return Loc; } TypeLoc &getTypeLoc() { return PlaceholderTy; } TypeLoc getTypeLoc() const { return PlaceholderTy; } + SourceLoc getTrailingAngleBracketLoc() const { + return Loc.getAdvancedLoc(Placeholder.getLength() - 1); + } /// The TypeRepr to be considered for placeholder expansion. TypeRepr *getTypeForExpansion() const { return ExpansionTyR; } diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index ceb92a5432c..2a205bcd845 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -2635,7 +2635,19 @@ public: PrintWithColorRAII(OS, ParenthesisColor) << ')'; } void visitEditorPlaceholderExpr(EditorPlaceholderExpr *E) { - printCommon(E, "editor_placeholder_expr") << '\n'; + printCommon(E, "editor_placeholder_expr") << ' '; + + // Print the trailing angle bracket location + if (auto Ty = GetTypeOfExpr(E)) { + auto &Ctx = Ty->getASTContext(); + auto TABL = E->getTrailingAngleBracketLoc(); + if (TABL.isValid()) { + PrintWithColorRAII(OS, LocationColor) << " trailing_angle_bracket_loc="; + TABL.print(PrintWithColorRAII(OS, LocationColor).getOS(), + Ctx.SourceMgr); + } + } + OS << '\n'; auto *TyR = E->getTypeLoc().getTypeRepr(); auto *ExpTyR = E->getTypeForExpansion(); if (TyR) diff --git a/test/Parse/source_locs.swift b/test/Parse/source_locs.swift index c1553fccebb..98e96eb76a4 100644 --- a/test/Parse/source_locs.swift +++ b/test/Parse/source_locs.swift @@ -2,7 +2,10 @@ func string_interpolation() { "\("abc")" + <#Int#> } -// RUN: %target-swift-frontend -dump-ast %s | %FileCheck %s +// RUN: not %target-swift-frontend -dump-ast %s | %FileCheck %s // CHECK: (interpolated_string_literal_expr {{.*}} trailing_quote_loc=SOURCE_DIR{{/|\\}}test{{/|\\}}Parse{{/|\\}}source_locs.swift:4:12 {{.*}} +// CHECK: (editor_placeholder_expr type='()' {{.*}} trailing_angle_bracket_loc=SOURCE_DIR{{/|\\}}test{{/|\\}}Parse{{/|\\}}source_locs.swift:5:9 + diff --git a/utils/build-script-impl b/utils/build-script-impl index e675fc46c39..dba8cb93b1e 100755 --- a/utils/build-script-impl +++ b/utils/build-script-impl @@ -2153,8 +2153,18 @@ for host in "${ALL_HOSTS[@]}"; do fi if [ "${SKIP_BUILD_LLVM}" ] ; then # We can't skip the build completely because the standalone - # build of Swift depend on these for testing etc. - build_targets=(llvm-tblgen clang-resource-headers intrinsics_gen clang-tablegen-targets FileCheck not) + # build of Swift depend on these for building and testing. + build_targets=(llvm-tblgen clang-resource-headers intrinsics_gen clang-tablegen-targets) + # If we are not performing a toolchain only build, then we + # also want to include FileCheck and not for testing + # purposes. + if [[ ! "${BUILD_TOOLCHAIN_ONLY}" ]] ; then + build_targets=( + "${build_targets[@]}" + FileCheck + not + ) + fi fi if [ "${HOST_LIBTOOL}" ] ; then