[AMDGPU][AsmParser][NFC] Translate parsed MIMG instructions to MCInsts automatically.
[llvm-project.git] / clang-tools-extra / clang-tidy / fuchsia / DefaultArgumentsCallsCheck.cpp
blob96cd30e0badac1991c8159e1c9b36f168c387514
1 //===--- DefaultArgumentsCallsCheck.cpp - clang-tidy-----------------------===//
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 "DefaultArgumentsCallsCheck.h"
11 using namespace clang::ast_matchers;
13 namespace clang::tidy::fuchsia {
15 void DefaultArgumentsCallsCheck::registerMatchers(MatchFinder *Finder) {
16 // Calling a function which uses default arguments is disallowed.
17 Finder->addMatcher(cxxDefaultArgExpr().bind("stmt"), this);
20 void DefaultArgumentsCallsCheck::check(const MatchFinder::MatchResult &Result) {
21 const auto *S = Result.Nodes.getNodeAs<CXXDefaultArgExpr>("stmt");
22 if (!S)
23 return;
25 diag(S->getUsedLocation(),
26 "calling a function that uses a default argument is disallowed");
27 diag(S->getParam()->getBeginLoc(), "default parameter was declared here",
28 DiagnosticIDs::Note);
31 } // namespace clang::tidy::fuchsia