2016-05-18 00:48:49 +08:00
|
|
|
//===-- HeaderMapCoolector.h - find all symbols------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// 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
|
2016-05-18 00:48:49 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CLANG_TOOLS_EXTRA_FIND_ALL_SYMBOLS_HEADER_MAP_COLLECTOR_H
|
|
|
|
#define LLVM_CLANG_TOOLS_EXTRA_FIND_ALL_SYMBOLS_HEADER_MAP_COLLECTOR_H
|
|
|
|
|
|
|
|
#include "llvm/ADT/StringMap.h"
|
2016-07-04 19:22:35 +08:00
|
|
|
#include "llvm/Support/Regex.h"
|
2016-05-18 00:48:49 +08:00
|
|
|
#include <string>
|
2016-07-04 19:42:37 +08:00
|
|
|
#include <vector>
|
2016-05-18 00:48:49 +08:00
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace find_all_symbols {
|
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// HeaderMappCollector collects all remapping header files. This maps
|
2016-07-04 19:22:35 +08:00
|
|
|
/// complete header names or header name regex patterns to header names.
|
2016-05-18 00:48:49 +08:00
|
|
|
class HeaderMapCollector {
|
|
|
|
public:
|
|
|
|
typedef llvm::StringMap<std::string> HeaderMap;
|
2016-07-04 21:34:11 +08:00
|
|
|
typedef std::vector<std::pair<const char *, const char *>> RegexHeaderMap;
|
2016-05-18 00:48:49 +08:00
|
|
|
|
2017-11-22 23:38:23 +08:00
|
|
|
HeaderMapCollector() = default;
|
|
|
|
explicit HeaderMapCollector(const RegexHeaderMap *RegexHeaderMappingTable);
|
2016-05-24 23:10:58 +08:00
|
|
|
|
2016-05-18 00:48:49 +08:00
|
|
|
void addHeaderMapping(llvm::StringRef OrignalHeaderPath,
|
|
|
|
llvm::StringRef MappingHeaderPath) {
|
2020-01-29 03:23:46 +08:00
|
|
|
HeaderMappingTable[OrignalHeaderPath] = std::string(MappingHeaderPath);
|
2016-05-18 00:48:49 +08:00
|
|
|
};
|
2016-05-24 23:10:58 +08:00
|
|
|
|
2016-07-04 19:22:35 +08:00
|
|
|
/// Check if there is a mapping from \p Header or a regex pattern that matches
|
|
|
|
/// it to another header name.
|
2016-05-24 23:10:58 +08:00
|
|
|
/// \param Header A header name.
|
|
|
|
/// \return \p Header itself if there is no mapping for it; otherwise, return
|
|
|
|
/// a mapped header name.
|
|
|
|
llvm::StringRef getMappedHeader(llvm::StringRef Header) const;
|
2016-05-18 00:48:49 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
/// A string-to-string map saving the mapping relationship.
|
|
|
|
HeaderMap HeaderMappingTable;
|
2016-05-24 23:10:58 +08:00
|
|
|
|
2016-07-04 19:22:35 +08:00
|
|
|
// A map from header patterns to header names.
|
2017-11-22 23:38:23 +08:00
|
|
|
// The header names are not owned. This is only threadsafe because the regexes
|
|
|
|
// never fail.
|
|
|
|
mutable std::vector<std::pair<llvm::Regex, const char *>>
|
|
|
|
RegexHeaderMappingTable;
|
2016-05-18 00:48:49 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace find_all_symbols
|
|
|
|
} // namespace clang
|
|
|
|
|
|
|
|
#endif // LLVM_CLANG_TOOLS_EXTRA_FIND_ALL_SYMBOLS_HEADER_MAP_COLLECTOR_H
|