Coverage Report

Created: 2022-07-16 07:03

/Users/buildslave/jenkins/workspace/coverage/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
77
void clang::quoteMakeTarget(StringRef Target, SmallVectorImpl<char> &Res) {
12
2.90k
  for (unsigned i = 0, e = Target.size(); i != e; 
++i2.83k
) {
13
2.83k
    switch (Target[i]) {
14
5
    case ' ':
15
5
    case '\t':
16
      // Escape the preceding backslashes
17
8
      for (int j = i - 1; j >= 0 && 
Target[j] == '\\'7
;
--j3
)
18
3
        Res.push_back('\\');
19
20
      // Escape the space/tab
21
5
      Res.push_back('\\');
22
5
      break;
23
2
    case '$':
24
2
      Res.push_back('$');
25
2
      break;
26
1
    case '#':
27
1
      Res.push_back('\\');
28
1
      break;
29
2.82k
    default:
30
2.82k
      break;
31
2.83k
    }
32
33
2.83k
    Res.push_back(Target[i]);
34
2.83k
  }
35
77
}