Coverage Report

Created: 2022-05-14 11:35

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Parse/ParseHLSL.cpp
Line
Count
Source (jump to first uncovered line)
1
//===--- ParseHLSL.cpp - HLSL-specific parsing support --------------------===//
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
// This file implements the parsing logic for HLSL language features.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#include "clang/Basic/AttributeCommonInfo.h"
14
#include "clang/Parse/ParseDiagnostic.h"
15
#include "clang/Parse/Parser.h"
16
17
using namespace clang;
18
19
void Parser::ParseHLSLSemantics(ParsedAttributes &Attrs,
20
4
                                SourceLocation *EndLoc) {
21
4
  assert(Tok.is(tok::colon) && "Not a HLSL Semantic");
22
0
  ConsumeToken();
23
24
4
  if (!Tok.is(tok::identifier)) {
25
1
    Diag(Tok.getLocation(), diag::err_expected_semantic_identifier);
26
1
    return;
27
1
  }
28
29
3
  IdentifierInfo *II = Tok.getIdentifierInfo();
30
3
  SourceLocation Loc = ConsumeToken();
31
3
  if (EndLoc)
32
0
    *EndLoc = Tok.getLocation();
33
3
  ParsedAttr::Kind AttrKind =
34
3
      ParsedAttr::getParsedKind(II, nullptr, ParsedAttr::AS_HLSLSemantic);
35
36
3
  if (AttrKind == ParsedAttr::UnknownAttribute) {
37
1
    Diag(Loc, diag::err_unknown_hlsl_semantic) << II;
38
1
    return;
39
1
  }
40
2
  Attrs.addNew(II, Loc, nullptr, SourceLocation(), nullptr, 0,
41
2
               ParsedAttr::AS_HLSLSemantic);
42
2
}