[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / lib / Basic / MakeSupport.cpp
blob4ddfcc350410c957f674a4299b27e91181bd1a9e
1 //===-- MakeSuport.cpp --------------------------------------------------*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "clang/Basic/MakeSupport.h"
11 void clang::quoteMakeTarget(StringRef Target, SmallVectorImpl<char> &Res) {
12 for (unsigned i = 0, e = Target.size(); i != e; ++i) {
13 switch (Target[i]) {
14 case ' ':
15 case '\t':
16 // Escape the preceding backslashes
17 for (int j = i - 1; j >= 0 && Target[j] == '\\'; --j)
18 Res.push_back('\\');
20 // Escape the space/tab
21 Res.push_back('\\');
22 break;
23 case '$':
24 Res.push_back('$');
25 break;
26 case '#':
27 Res.push_back('\\');
28 break;
29 default:
30 break;
33 Res.push_back(Target[i]);