From e1581540876f51af1aa1389bdb21388ae88c1b90 Mon Sep 17 00:00:00 2001 From: Eric Schweitz Date: Mon, 29 Jun 2020 14:15:59 -0700 Subject: [PATCH] [clang-tidy] Allows the prevailing include header guard in Flang to be recognized rather than flagged as a violation in phabricator. Differential revision: https://reviews.llvm.org/D82807 --- clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp b/clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp index 56156ff2fb38..3e4c39d94193 100644 --- a/clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp +++ b/clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp @@ -54,6 +54,10 @@ std::string LLVMHeaderGuardCheck::getHeaderGuard(StringRef Filename, if (StringRef(Guard).startswith("clang")) Guard = "LLVM_" + Guard; + // The prevalent style in flang is FORTRAN_FOO_BAR_H + if (StringRef(Guard).startswith("flang")) + Guard = "FORTRAN" + Guard.substr(sizeof("flang") - 1); + return StringRef(Guard).upper(); }