[clang-tools-extra] e158154 - [clang-tidy] Allows the prevailing include header guard in Flang to be recognized rather than flagged as a violation in phabricator.
Eric Schweitz via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 1 12:47:51 PDT 2020
Author: Eric Schweitz
Date: 2020-07-01T12:47:36-07:00
New Revision: e1581540876f51af1aa1389bdb21388ae88c1b90
URL: https://github.com/llvm/llvm-project/commit/e1581540876f51af1aa1389bdb21388ae88c1b90
DIFF: https://github.com/llvm/llvm-project/commit/e1581540876f51af1aa1389bdb21388ae88c1b90.diff
LOG: [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
Added:
Modified:
clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp
Removed:
################################################################################
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();
}
More information about the cfe-commits
mailing list