include-what-you-use: rebuild for llvm11
This commit is contained in:
parent
71e9bf173f
commit
e5ad85e524
|
@ -0,0 +1,146 @@
|
|||
From 53487d209729d5781007dc0fd6076dc585cb3727 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Bocci <andrea.bocci@cern.ch>
|
||||
Date: Fri, 28 Feb 2020 17:45:03 +0100
|
||||
Subject: [PATCH] Add explicit conversion from llvm::StringRef to std::string
|
||||
|
||||
llvm/llvm-project@777180a makes the llvm::StringRef conversion operator
|
||||
to std::string explicit.
|
||||
These changes add a call to the str() method to perform the conversion.
|
||||
|
||||
Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
|
||||
---
|
||||
iwyu_driver.cc | 2 +-
|
||||
iwyu_globals.cc | 4 ++--
|
||||
iwyu_lexer_utils.cc | 2 +-
|
||||
iwyu_location_util.h | 2 +-
|
||||
iwyu_output.cc | 2 +-
|
||||
iwyu_path_util.cc | 6 +++---
|
||||
iwyu_preprocessor.cc | 4 ++--
|
||||
7 files changed, 11 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/iwyu_driver.cc b/iwyu_driver.cc
|
||||
index bd163144..42fea35b 100644
|
||||
--- a/iwyu_driver.cc
|
||||
+++ b/iwyu_driver.cc
|
||||
@@ -79,7 +79,7 @@ std::string GetExecutablePath(const char *Argv0) {
|
||||
}
|
||||
|
||||
const char *SaveStringInSet(std::set<std::string> &SavedStrings, StringRef S) {
|
||||
- return SavedStrings.insert(S).first->c_str();
|
||||
+ return SavedStrings.insert(S.str()).first->c_str();
|
||||
}
|
||||
|
||||
void ExpandArgsFromBuf(const char *Arg,
|
||||
diff --git a/iwyu_globals.cc b/iwyu_globals.cc
|
||||
index 0f58b4dc..26998966 100644
|
||||
--- a/iwyu_globals.cc
|
||||
+++ b/iwyu_globals.cc
|
||||
@@ -293,7 +293,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
|
||||
for (auto it = header_search->system_dir_begin();
|
||||
it != header_search->system_dir_end(); ++it) {
|
||||
if (const DirectoryEntry* entry = it->getDir()) {
|
||||
- const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
|
||||
+ const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
|
||||
search_path_map[path] = HeaderSearchPath::kSystemPath;
|
||||
}
|
||||
}
|
||||
@@ -303,7 +303,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
|
||||
// search_dir_begin()/end() includes both system and user paths.
|
||||
// If it's a system path, it's already in the map, so everything
|
||||
// new is a user path. The insert only 'takes' for new entries.
|
||||
- const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
|
||||
+ const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
|
||||
search_path_map.insert(make_pair(path, HeaderSearchPath::kUserPath));
|
||||
}
|
||||
}
|
||||
diff --git a/iwyu_lexer_utils.cc b/iwyu_lexer_utils.cc
|
||||
index fcea2d28..648c9da8 100644
|
||||
--- a/iwyu_lexer_utils.cc
|
||||
+++ b/iwyu_lexer_utils.cc
|
||||
@@ -70,7 +70,7 @@ SourceLocation GetLocationAfter(
|
||||
string GetIncludeNameAsWritten(
|
||||
SourceLocation include_loc,
|
||||
const CharacterDataGetterInterface& data_getter) {
|
||||
- const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter);
|
||||
+ const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter).str();
|
||||
if (data.empty())
|
||||
return data;
|
||||
string::size_type endpos = string::npos;
|
||||
diff --git a/iwyu_location_util.h b/iwyu_location_util.h
|
||||
index 3892a424..6f8cf81c 100644
|
||||
--- a/iwyu_location_util.h
|
||||
+++ b/iwyu_location_util.h
|
||||
@@ -89,7 +89,7 @@ bool IsInScratchSpace(clang::SourceLocation loc);
|
||||
|
||||
inline string GetFilePath(const clang::FileEntry* file) {
|
||||
return (IsBuiltinFile(file) ? "<built-in>" :
|
||||
- NormalizeFilePath(file->getName()));
|
||||
+ NormalizeFilePath(file->getName().str()));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
diff --git a/iwyu_output.cc b/iwyu_output.cc
|
||||
index ca145710..8666c26c 100644
|
||||
--- a/iwyu_output.cc
|
||||
+++ b/iwyu_output.cc
|
||||
@@ -168,7 +168,7 @@ string GetKindName(const clang::TagDecl* tag_decl) {
|
||||
if (const FakeNamedDecl* fake = FakeNamedDeclIfItIsOne(named_decl)) {
|
||||
return fake->kind_name();
|
||||
}
|
||||
- return tag_decl->getKindName();
|
||||
+ return tag_decl->getKindName().str();
|
||||
}
|
||||
|
||||
string GetQualifiedNameAsString(const clang::NamedDecl* named_decl) {
|
||||
diff --git a/iwyu_path_util.cc b/iwyu_path_util.cc
|
||||
index ab4fc800..9987ea47 100644
|
||||
--- a/iwyu_path_util.cc
|
||||
+++ b/iwyu_path_util.cc
|
||||
@@ -134,7 +134,7 @@ string NormalizeFilePath(const string& path) {
|
||||
std::replace(normalized.begin(), normalized.end(), '\\', '/');
|
||||
#endif
|
||||
|
||||
- return normalized.str();
|
||||
+ return normalized.str().str();
|
||||
}
|
||||
|
||||
string NormalizeDirPath(const string& path) {
|
||||
@@ -154,14 +154,14 @@ string MakeAbsolutePath(const string& path) {
|
||||
std::error_code error = llvm::sys::fs::make_absolute(absolute_path);
|
||||
CHECK_(!error);
|
||||
|
||||
- return absolute_path.str();
|
||||
+ return absolute_path.str().str();
|
||||
}
|
||||
|
||||
string MakeAbsolutePath(const string& base_path, const string& relative_path) {
|
||||
llvm::SmallString<128> absolute_path(base_path);
|
||||
llvm::sys::path::append(absolute_path, relative_path);
|
||||
|
||||
- return absolute_path.str();
|
||||
+ return absolute_path.str().str();
|
||||
}
|
||||
|
||||
string GetParentPath(const string& path) {
|
||||
diff --git a/iwyu_preprocessor.cc b/iwyu_preprocessor.cc
|
||||
index 58e78595..88b93144 100644
|
||||
--- a/iwyu_preprocessor.cc
|
||||
+++ b/iwyu_preprocessor.cc
|
||||
@@ -313,7 +313,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
|
||||
break;
|
||||
}
|
||||
const string filename = GetSourceTextUntilEndOfLine(current_loc,
|
||||
- DefaultDataGetter());
|
||||
+ DefaultDataGetter()).str();
|
||||
// Use "" or <> based on where the file lives.
|
||||
string quoted_private_include;
|
||||
if (IsSystemIncludeFile(GetFilePath(current_loc)))
|
||||
@@ -332,7 +332,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
|
||||
}
|
||||
|
||||
string after_text = GetSourceTextUntilEndOfLine(current_loc,
|
||||
- DefaultDataGetter());
|
||||
+ DefaultDataGetter()).str();
|
||||
const string::size_type close_brace_pos = after_text.find('}');
|
||||
if (close_brace_pos == string::npos) {
|
||||
Warn(current_loc, "@headername directive missing a closing brace");
|
|
@ -0,0 +1,54 @@
|
|||
From 30549c6931972456d1e09ff5dbeecd258a8df72b Mon Sep 17 00:00:00 2001
|
||||
From: Kim Grasman <kim.grasman@gmail.com>
|
||||
Date: Thu, 9 Jul 2020 18:47:56 +0200
|
||||
Subject: [PATCH] Implement Stmt printing with ASTDumper
|
||||
|
||||
The Clang API changed in commit 473fbc90d1fbf17e so that Stmt::dump
|
||||
takes an ASTContext instead of a SourceManager.
|
||||
|
||||
Rather than wire a global ASTContext, reimplement PrintableStmt and
|
||||
PrintStmt to duplicate the most trivial implementations not requiring
|
||||
ASTContext.
|
||||
|
||||
No functional change.
|
||||
---
|
||||
iwyu_ast_util.cc | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/iwyu_ast_util.cc b/iwyu_ast_util.cc
|
||||
index d3d4dd1f..b19a11fb 100644
|
||||
--- a/iwyu_ast_util.cc
|
||||
+++ b/iwyu_ast_util.cc
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
+#include "clang/AST/ASTDumper.h"
|
||||
#include "clang/AST/CanonicalType.h"
|
||||
#include "clang/AST/Decl.h"
|
||||
#include "clang/AST/DeclBase.h"
|
||||
@@ -46,6 +47,7 @@ namespace clang {
|
||||
class FileEntry;
|
||||
} // namespace clang
|
||||
|
||||
+using clang::ASTDumper;
|
||||
using clang::BlockPointerType;
|
||||
using clang::CXXConstructExpr;
|
||||
using clang::CXXConstructorDecl;
|
||||
@@ -450,12 +452,14 @@ string PrintableDecl(const Decl* decl, bool terse/*=true*/) {
|
||||
string PrintableStmt(const Stmt* stmt) {
|
||||
std::string buffer;
|
||||
raw_string_ostream ostream(buffer);
|
||||
- stmt->dump(ostream, *GlobalSourceManager());
|
||||
+ ASTDumper dumper(ostream, /*ShowColors=*/false);
|
||||
+ dumper.Visit(stmt);
|
||||
return ostream.str();
|
||||
}
|
||||
|
||||
void PrintStmt(const Stmt* stmt) {
|
||||
- stmt->dump(*GlobalSourceManager()); // This prints to errs().
|
||||
+ ASTDumper dumper(llvm::errs(), /*ShowColors=*/false);
|
||||
+ dumper.Visit(stmt);
|
||||
}
|
||||
|
||||
string PrintableType(const Type* type) {
|
|
@ -1,7 +1,7 @@
|
|||
# Template file for 'include-what-you-use'
|
||||
pkgname=include-what-you-use
|
||||
version=0.14
|
||||
revision=1
|
||||
revision=2
|
||||
wrksrc="${pkgname}"
|
||||
build_style=cmake
|
||||
configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
|
||||
|
@ -15,6 +15,12 @@ distfiles="https://include-what-you-use.org/downloads/${pkgname}-${version}.src.
|
|||
checksum=43184397db57660c32e3298a6b1fd5ab82e808a1f5ab0591d6745f8d256200ef
|
||||
python_version=3
|
||||
|
||||
post_extract() {
|
||||
for i in ${FILESDIR}/include-what-you-use-*.patch; do
|
||||
patch -sNp1 -i ${i}
|
||||
done
|
||||
}
|
||||
|
||||
post_install() {
|
||||
vlicense LICENSE.TXT
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue