Path: blob/main/contrib/llvm-project/clang/lib/Basic/MakeSupport.cpp
35233 views
//===-- MakeSuport.cpp --------------------------------------------------*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "clang/Basic/MakeSupport.h"910void clang::quoteMakeTarget(StringRef Target, SmallVectorImpl<char> &Res) {11for (unsigned i = 0, e = Target.size(); i != e; ++i) {12switch (Target[i]) {13case ' ':14case '\t':15// Escape the preceding backslashes16for (int j = i - 1; j >= 0 && Target[j] == '\\'; --j)17Res.push_back('\\');1819// Escape the space/tab20Res.push_back('\\');21break;22case '$':23Res.push_back('$');24break;25case '#':26Res.push_back('\\');27break;28default:29break;30}3132Res.push_back(Target[i]);33}34}353637