================ @@ -0,0 +1,105 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "HeaderGuardCheck.h" +#include "../utils/OptionsUtils.h" +#include "clang/Basic/SourceManager.h" +#include "clang/Lex/PPCallbacks.h" +#include "clang/Lex/Preprocessor.h" +#include "clang/Tooling/Tooling.h" +#include "llvm/Support/Path.h" + +namespace clang::tidy::misc { + +HeaderGuardCheck::HeaderGuardCheck(StringRef Name, ClangTidyContext *Context) + : clang::tidy::utils::HeaderGuardCheck(Name, Context), + AllowPragmaOnce(Options.get("AllowPragmaOnce", false)), + HeaderDirs(utils::options::parseStringList( + Options.get("HeaderDirs", "include"))), + EndifComment(Options.get("EndifComment", false)), + Prefix(Options.get("Prefix", "")) {} + +std::string HeaderGuardCheck::getHeaderGuard(StringRef Filename, + StringRef OldGuard) { + std::string Guard = tooling::getAbsolutePath(Filename); ---------------- vbvictor wrote:
Can we name this variable `AbsPath`? `Guard` Looks a bit misleading and hard to understand in current context (while we work mostly with paths). https://github.com/llvm/llvm-project/pull/177315 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
