Coverage Report

Created: 2023-11-11 10:31

/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
78
void clang::quoteMakeTarget(StringRef Target, SmallVectorImpl<char> &Res) {
12
3.58k
  for (unsigned i = 0, e = Target.size(); i != e; 
++i3.50k
) {
13
3.50k
    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
3.50k
    default:
30
3.50k
      break;
31
3.50k
    }
32
33
3.50k
    Res.push_back(Target[i]);
34
3.50k
  }
35
78
}