Coverage Report

Created: 2024-01-17 10:31

/src/llvm-project/clang/lib/Basic/MakeSupport.cpp
Line
Count
Source (jump to first uncovered line)
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
//===----------------------------------------------------------------------===//
8
9
#include "clang/Basic/MakeSupport.h"
10
11
0
void clang::quoteMakeTarget(StringRef Target, SmallVectorImpl<char> &Res) {
12
0
  for (unsigned i = 0, e = Target.size(); i != e; ++i) {
13
0
    switch (Target[i]) {
14
0
    case ' ':
15
0
    case '\t':
16
      // Escape the preceding backslashes
17
0
      for (int j = i - 1; j >= 0 && Target[j] == '\\'; --j)
18
0
        Res.push_back('\\');
19
20
      // Escape the space/tab
21
0
      Res.push_back('\\');
22
0
      break;
23
0
    case '$':
24
0
      Res.push_back('$');
25
0
      break;
26
0
    case '#':
27
0
      Res.push_back('\\');
28
0
      break;
29
0
    default:
30
0
      break;
31
0
    }
32
33
0
    Res.push_back(Target[i]);
34
0
  }
35
0
}