summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debian/changelog237
-rw-r--r--debian/control30
-rw-r--r--debian/copyright37
-rw-r--r--debian/docs1
-rw-r--r--debian/fix_include.182
-rw-r--r--debian/iwyu.install1
-rw-r--r--debian/iwyu.links2
-rw-r--r--debian/iwyu.manpages4
-rw-r--r--debian/iwyu_tool.134
-rw-r--r--debian/patches/GlobalSourceManager.patch210
-rw-r--r--debian/patches/PrintableStmt.patch54
-rw-r--r--debian/patches/python3.diff20
-rw-r--r--debian/patches/series1
-rwxr-xr-xdebian/rules48
-rw-r--r--debian/source/format1
-rw-r--r--debian/upstream/metadata4
-rw-r--r--debian/watch2
17 files changed, 768 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..196a863
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,237 @@
+iwyu (8.17-1) unstable; urgency=medium
+
+ * New upstream release
+ * Update llvm/clang from 12 to 13
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Thu, 09 Dec 2021 13:25:46 +0100
+
+iwyu (8.16-1) unstable; urgency=medium
+
+ * New upstream release
+ * Update llvm/clang from 11 to 12
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Sun, 20 Jun 2021 18:51:18 +0200
+
+iwyu (8.15-2) unstable; urgency=medium
+
+ * Do not fail the testsuite on some arch (only a test is failing)
+ (Closes: #981061)
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Wed, 03 Feb 2021 09:15:49 +0100
+
+iwyu (8.15-1) unstable; urgency=medium
+
+ [ Debian Janitor ]
+ * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository.
+
+ [ Sylvestre Ledru ]
+ * New upstream release 0.15
+ * Move to clang-11 (Closes: #974814)
+ * Add clang-{11,12} in the depends
+ * Upstream updated their versioning on github. it was called
+ clang_8.0, it is now 0.14; Called this version 8.14 as we cannot
+ go back to 0.14. Update watch
+ * Update watch file format version to 4.
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Thu, 26 Nov 2020 15:39:04 +0100
+
+iwyu (8.0-3) unstable; urgency=medium
+
+ [ Debian Janitor ]
+ * Trim trailing whitespace.
+ * Use secure copyright file specification URI.
+ * Use secure URI in Homepage field.
+ * Bump debhelper from old 10 to 12.
+ * Set debhelper-compat version in Build-Depends.
+ * Set upstream metadata fields: Repository, Repository-Browse.
+ * Rely on pre-initialized dpkg-architecture variables.
+
+ [ Sylvestre Ledru ]
+ * Move to llvm/clang 9 (instead of 8)
+ * Move dep to python 3 (Closes: #945688)
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Wed, 01 Jan 2020 13:51:01 +0100
+
+iwyu (8.0-2) unstable; urgency=medium
+
+ * Cherry-pick the upstream patch to address
+ the struct issue (Closes: #929492)
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Tue, 05 Nov 2019 11:52:50 +0100
+
+iwyu (8.0-1) unstable; urgency=medium
+
+ * Upload to unstable
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Sun, 07 Jul 2019 09:58:08 +0200
+
+iwyu (8.0-1~exp1) experimental; urgency=medium
+
+ * New upstream release
+ * Uses clang-8
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Sun, 28 Apr 2019 11:24:24 +0200
+
+iwyu (7.0-3) unstable; urgency=medium
+
+ * Link against latomic on armhf to workaround a FTBFS
+ Thanks to Adrian Bunk (Closes: #918060)
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Thu, 03 Jan 2019 16:01:39 +0100
+
+iwyu (7.0-2) unstable; urgency=medium
+
+ * chrpath -d was enough to be able to remove my bad workaround
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Thu, 27 Dec 2018 12:12:15 +0100
+
+iwyu (7.0-1) unstable; urgency=medium
+
+ * New upstream release
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Thu, 27 Dec 2018 11:22:19 +0100
+
+iwyu (6.0-2) unstable; urgency=medium
+
+ * Switch to llvm/clang 7
+ - debian/patches/clang-7-build.diff needed
+ * Standards-Version updated to 4.2.1
+ * Fix space-in-std-shortname-in-dep5-copyright
+ * Also ship a manpage for iwyu_tool
+ * Refresh manpage for fix_include
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Sun, 23 Sep 2018 22:12:33 +0100
+
+iwyu (6.0-1) unstable; urgency=medium
+
+ * New upstream release
+ - Switched to llvm/clang 6
+ * Package moved to salsa & git
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Sat, 28 Apr 2018 10:20:19 +0200
+
+iwyu (5.0-1) unstable; urgency=medium
+
+ * New upstream release
+ * Switch to llvm/clang 5
+ * Add clang-7 as part of the options
+ * Standards-Version updated to 4.1.3
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Wed, 07 Feb 2018 20:56:47 +0100
+
+iwyu (4.0-2) unstable; urgency=medium
+
+ * Cleanup the list of dependencies to add clang and remove
+ old clang versionc
+ * Standards-Version updated to 4.1.1
+ * fix priority-extra-is-replaced-by-priority-optional
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Tue, 21 Nov 2017 12:03:26 +0100
+
+iwyu (4.0-1) unstable; urgency=medium
+
+ * New upstream release
+ * Standards-Version updated to 4.0.0
+ * bump llvm deps to 4.0
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Thu, 03 Aug 2017 11:10:20 +0200
+
+iwyu (3.9-2) unstable; urgency=medium
+
+ * Rebuild to manage clang 3.9.1 (Closes: #849402)
+ yes, this needs to be properly fixed and managed at runtime
+ * Remove usr/bin/fix_includes.py to fix script-with-language-extension
+ (was already shipped under fix_includes anyway)
+ * Rename usr/bin/iwyu_tool.py to usr/bin/iwyu_tool
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Mon, 26 Dec 2016 18:49:23 +0100
+
+iwyu (3.9-1) unstable; urgency=medium
+
+ * New upstream release
+ (Closes: #828734)
+ * Fix FTBFS on mips64el (Closes: #775435)
+ Thanks to James Cowgill
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Thu, 10 Nov 2016 12:49:29 +0100
+
+iwyu (3.8-1) unstable; urgency=medium
+
+ * New upstream release
+ * Switch to clang 3.8
+ * Standards-Version to 3.9.8
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Sat, 25 Jun 2016 20:16:19 +0200
+
+iwyu (3.7-1) unstable; urgency=medium
+
+ * New upstream release
+ * Remove old dep from the list (clang-3.3 | clang-3.4)
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Sat, 26 Dec 2015 23:56:01 +0100
+
+iwyu (3.6-2) unstable; urgency=medium
+
+ * Fix the FTBFS under kfreebsd
+ Thanks to Steven Chamberlain for the patch
+ (Closes: #794563)
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Tue, 08 Sep 2015 08:48:51 +0200
+
+iwyu (3.6-1) unstable; urgency=low
+
+ * Team upload (Sylvestre prepared the upload)
+ * New upstream release (Closes: #795499)
+
+ -- Michael Vogt <mvo@debian.org> Fri, 14 Aug 2015 20:00:47 +0200
+
+ciwyu (3.5-1) unstable; urgency=medium
+
+ * Upload to unstable
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Tue, 16 Jun 2015 11:14:00 +0200
+
+iwyu (3.5-1~exp1) experimental; urgency=medium
+
+ * New upstream release
+ * Switch to llvm/clang 3.5
+ * Standards-Version updated to 3.9.6
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Tue, 30 Dec 2014 14:32:11 +0100
+
+iwyu (3.4-1) unstable; urgency=medium
+
+ * New upstream release
+ * Add libncurses5-dev as a build deps
+ * Add a watch file
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Tue, 06 May 2014 17:11:05 +0200
+
+iwyu (3.3-4) unstable; urgency=medium
+
+ * Make iwyu co-installable with clang 3.5 (Closes: #734900)
+ * Standards-Version updated to 3.9.5
+ * Switch the default clang to 3.4
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Wed, 15 Jan 2014 10:14:58 +0100
+
+iwyu (3.3-3) unstable; urgency=low
+
+ * Remove the trailing debian/ from debian/control
+ * Also ship fix_include in iwyu. It applies the changes (Closes: #728590)
+ * Fix the clean of the package
+ * Remove the "SEE ALSO" section from the manpage (Closes: #722225)
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Mon, 04 Nov 2013 09:02:17 +0100
+
+iwyu (3.3-2) unstable; urgency=low
+
+ * clang is a mandatory dependency (Closes: #722132)
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Sun, 08 Sep 2013 12:33:59 +0200
+
+iwyu (3.3-1) unstable; urgency=low
+
+ * Initial release (Closes: #721267)
+
+ -- Sylvestre Ledru <sylvestre@debian.org> Thu, 29 Aug 2013 17:16:23 +0200
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..d1ff033
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,30 @@
+Source: iwyu
+Section: devel
+Priority: optional
+Maintainer: LLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>
+Uploaders: Sylvestre Ledru <sylvestre@debian.org>
+Build-Depends: debhelper-compat (= 12), cmake, clang-13, libclang-13-dev,
+ llvm-13-dev, help2man, libncurses5-dev, zlib1g-dev, chrpath
+Build-Conflicts: llvm-5.0-dev, llvm-6.0-dev
+Standards-Version: 4.2.1
+Homepage: https://include-what-you-use.org/
+Vcs-Git: https://salsa.debian.org/pkg-llvm-team/iwyu.git
+Vcs-Browser: https://salsa.debian.org/pkg-llvm-team/iwyu
+
+Package: iwyu
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends},
+ clang | clang-4.0 | clang-5.0 | clang-6.0 | clang-7 | clang-8 | clang-9 | clang-10 | clang-11 | clang-12 | clang-13,
+ python3
+Description: Analyze #includes in C and C++ source files
+ "Include what you use" means this: for every symbol (type, function variable,
+ or macro) that you use in foo.cc, either foo.cc or foo.h should #include a .h
+ file that exports the declaration of that symbol. The include-what-you-use
+ tool is a program that can be built with the clang libraries in order to
+ analyze #includes of source files to find include-what-you-use violations,
+ and suggest fixes for them.
+ .
+ The main goal of include-what-you-use is to remove superfluous #includes.
+ It does this both by figuring out what #includes are not actually needed for
+ this file (for both .cc and .h files), and replacing #includes with
+ forward-declares when possible.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..5ce9c59
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,37 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: iwyu (include what you use)
+Upstream-Contact: https://groups.google.com/forum/#!forum/include-what-you-use
+Source: https://github.com/include-what-you-use/include-what-you-use
+
+Files: *
+Copyright: Google and others 2010 - 2013
+License: U-OF-I-BSD-LIKE
+
+License: U-OF-I-BSD-LIKE
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal with
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished to do
+ so, subject to the following conditions:
+ .
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimers.
+ .
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimers in the
+ documentation and/or other materials provided with the distribution.
+ .
+ * Neither the names of the LLVM Team, University of Illinois at
+ Urbana-Champaign, nor the names of its contributors may be used to
+ endorse or promote products derived from this Software without specific
+ prior written permission.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+ SOFTWARE.
+
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..b43bf86
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1 @@
+README.md
diff --git a/debian/fix_include.1 b/debian/fix_include.1
new file mode 100644
index 0000000..7ebe68e
--- /dev/null
+++ b/debian/fix_include.1
@@ -0,0 +1,82 @@
+.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
+.TH FIX_INCLUDES.PY "1" "September 2018" "fix_includes.py 6.0-2" "User Commands"
+.SH NAME
+fix_includes.py \- manual page for fix_includes.py 6.0-2
+.SH SYNOPSIS
+.B fix_includes.py
+[\fI\,options\/\fR] [\fI\,filename\/\fR] ... \fI\,< <output from include-what-you-use script>\/\fR
+.SH DESCRIPTION
+.IP
+OR fix_includes.py \fB\-s\fR [other options] <filename> ...
+.PP
+fix_includes.py reads the output from the include\-what\-you\-use
+script on stdin \fB\-\-\fR run with \fB\-\-v\fR=\fI\,1\/\fR (default) verbose or above \fB\-\-\fR and,
+unless \fB\-\-sort_only\fR or \fB\-\-dry_run\fR is specified,
+modifies the files mentioned in the output, removing their old
+#include lines and replacing them with the lines given by the
+include_what_you_use script. It also sorts the #include and
+forward\-declare lines.
+.PP
+All files mentioned in the include\-what\-you\-use script are modified,
+unless filenames are specified on the commandline, in which case only
+those files are modified.
+.PP
+The exit code is the number of files that were modified (or that would
+be modified if \fB\-\-dry_run\fR was specified) unless that number exceeds 100,
+in which case 100 is returned.
+.SH OPTIONS
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+show this help message and exit
+.TP
+\fB\-b\fR, \fB\-\-blank_lines\fR
+Put a blank line between primary header file and C/C++
+system #includes, and another blank line between
+system #includes and google #includes [default]
+.HP
+\fB\-\-noblank_lines\fR
+.TP
+\fB\-\-comments\fR
+Put comments after the #include lines
+.HP
+\fB\-\-nocomments\fR
+.TP
+\fB\-\-safe_headers\fR
+Do not remove unused #includes/fwd\-declares from
+header files; just add new ones [default]
+.HP
+\fB\-\-nosafe_headers\fR
+.TP
+\fB\-s\fR, \fB\-\-sort_only\fR
+Just sort #includes of files listed on cmdline; do not
+add or remove any #includes
+.TP
+\fB\-n\fR, \fB\-\-dry_run\fR
+Do not actually edit any files; just print diffs.
+Return code is 0 if no changes are needed, else
+min(the number of files that would be modified, 100)
+.TP
+\fB\-\-ignore_re\fR=\fI\,IGNORE_RE\/\fR
+fix_includes.py will skip editing any file whose name
+matches this regular expression.
+.TP
+\fB\-\-separate_project_includes\fR=\fI\,SEPARATE_PROJECT_INCLUDES\/\fR
+Sort #includes for current project separately from all
+other #includes. This flag specifies the root
+directory of the current project. If the value is
+"<tld>", #includes that share the same top\-level
+directory are assumed to be in the same project. If
+not specified, project #includes will be sorted with
+other non\-system #includes.
+.TP
+\fB\-\-invoking_command_line\fR=\fI\,INVOKING_COMMAND_LINE\/\fR
+Internal flag used by iwyu.py, It should be the
+command line used to invoke iwyu.py
+.TP
+\fB\-m\fR, \fB\-\-keep_iwyu_namespace_format\fR
+Keep forward\-declaration namespaces in IWYU format,
+eg. namespace n1 { namespace n2 { class c1; } }. Do
+not convert to "normalized" Google format: namespace
+n1 {\ennamespace n2 {\en class c1;\en}\en}.
+.HP
+\fB\-\-nokeep_iwyu_namespace_format\fR
diff --git a/debian/iwyu.install b/debian/iwyu.install
new file mode 100644
index 0000000..f98d13f
--- /dev/null
+++ b/debian/iwyu.install
@@ -0,0 +1 @@
+iwyu-build/fix_include usr/bin
diff --git a/debian/iwyu.links b/debian/iwyu.links
new file mode 100644
index 0000000..207e821
--- /dev/null
+++ b/debian/iwyu.links
@@ -0,0 +1,2 @@
+/usr/bin/include-what-you-use usr/bin/iwyu
+
diff --git a/debian/iwyu.manpages b/debian/iwyu.manpages
new file mode 100644
index 0000000..2d99591
--- /dev/null
+++ b/debian/iwyu.manpages
@@ -0,0 +1,4 @@
+iwyu-build/include-what-you-use.1
+iwyu-build/iwyu.1
+debian/iwyu_tool.1
+debian/fix_include.1
diff --git a/debian/iwyu_tool.1 b/debian/iwyu_tool.1
new file mode 100644
index 0000000..4ecf175
--- /dev/null
+++ b/debian/iwyu_tool.1
@@ -0,0 +1,34 @@
+.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
+.TH IWYU_TOOL.PY "1" "September 2018" "iwyu_tool.py 6.0-2" "User Commands"
+.SH NAME
+iwyu_tool.py \- Include-what-you-use compilation database driver
+.SH DESCRIPTION
+usage: iwyu_tool.py [\-h] [\-v] [\-o {clang,iwyu}] [\-j JOBS] \fB\-p\fR <build\-path>
+.TP
+[source [source ...]] \fB\-\-\fR [<IWYU args>]
+[source [source ...]]
+.PP
+Include\-what\-you\-use compilation database driver.
+.SS "positional arguments:"
+.TP
+source
+Zero or more source files to run IWYU on. Defaults to
+all in compilation database.
+.SS "optional arguments:"
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+show this help message and exit
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Print IWYU commands
+.TP
+\fB\-o\fR {clang,iwyu}, \fB\-\-output\-format\fR {clang,iwyu}
+Output format (default: iwyu)
+.TP
+\fB\-j\fR JOBS, \fB\-\-jobs\fR JOBS
+Number of concurrent subprocesses
+.TP
+\fB\-p\fR <build\-path>
+Compilation database path
+.PP
+Assumes include\-what\-you\-use is available on the PATH.
diff --git a/debian/patches/GlobalSourceManager.patch b/debian/patches/GlobalSourceManager.patch
new file mode 100644
index 0000000..b865b55
--- /dev/null
+++ b/debian/patches/GlobalSourceManager.patch
@@ -0,0 +1,210 @@
+From fbffd6e3be4c409109b06f858368bcee1ea2f99d Mon Sep 17 00:00:00 2001
+From: Kim Grasman <kim.grasman@gmail.com>
+Date: Tue, 22 Sep 2020 19:28:24 +0200
+Subject: [PATCH] Remove source manager from ASTNode constructor
+
+ASTNode was consistently instantiated using GlobalSourceManager(). The
+passed-in source manager was only used in ASTNode::GetLocation().
+
+Use GlobalSourceManager() there directly instead to keep the constructor
+interface simpler.
+
+No functional change.
+---
+ iwyu.cc | 20 ++++++++++----------
+ iwyu_ast_util.cc | 9 ++++-----
+ iwyu_ast_util.h | 42 ++++++++++++++++++------------------------
+ 3 files changed, 32 insertions(+), 39 deletions(-)
+
+Index: iwyu/iwyu.cc
+===================================================================
+--- iwyu.orig/iwyu.cc
++++ iwyu/iwyu.cc
+@@ -329,7 +329,7 @@ class BaseAstVisitor : public RecursiveA
+ bool TraverseDecl(Decl* decl) {
+ if (current_ast_node_->StackContainsContent(decl))
+ return true; // avoid recursion
+- ASTNode node(decl, *GlobalSourceManager());
++ ASTNode node(decl);
+ CurrentASTNodeUpdater canu(&current_ast_node_, &node);
+ return Base::TraverseDecl(decl);
+ }
+@@ -337,7 +337,7 @@ class BaseAstVisitor : public RecursiveA
+ bool TraverseStmt(Stmt* stmt) {
+ if (current_ast_node_->StackContainsContent(stmt))
+ return true; // avoid recursion
+- ASTNode node(stmt, *GlobalSourceManager());
++ ASTNode node(stmt);
+ CurrentASTNodeUpdater canu(&current_ast_node_, &node);
+ return Base::TraverseStmt(stmt);
+ }
+@@ -348,7 +348,7 @@ class BaseAstVisitor : public RecursiveA
+ const Type* type = qualtype.getTypePtr();
+ if (current_ast_node_->StackContainsContent(type))
+ return true; // avoid recursion
+- ASTNode node(type, *GlobalSourceManager());
++ ASTNode node(type);
+ CurrentASTNodeUpdater canu(&current_ast_node_, &node);
+ return Base::TraverseType(qualtype);
+ }
+@@ -372,7 +372,7 @@ class BaseAstVisitor : public RecursiveA
+ }
+ if (current_ast_node_->StackContainsContent(&typeloc))
+ return true; // avoid recursion
+- ASTNode node(&typeloc, *GlobalSourceManager());
++ ASTNode node(&typeloc);
+ CurrentASTNodeUpdater canu(&current_ast_node_, &node);
+ return Base::TraverseTypeLoc(typeloc);
+ }
+@@ -380,7 +380,7 @@ class BaseAstVisitor : public RecursiveA
+ bool TraverseNestedNameSpecifier(NestedNameSpecifier* nns) {
+ if (nns == nullptr)
+ return true;
+- ASTNode node(nns, *GlobalSourceManager());
++ ASTNode node(nns);
+ CurrentASTNodeUpdater canu(&current_ast_node_, &node);
+ if (!this->getDerived().VisitNestedNameSpecifier(nns))
+ return false;
+@@ -390,7 +390,7 @@ class BaseAstVisitor : public RecursiveA
+ bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc nns_loc) {
+ if (!nns_loc) // using NNSLoc::operator bool()
+ return true;
+- ASTNode node(&nns_loc, *GlobalSourceManager());
++ ASTNode node(&nns_loc);
+ CurrentASTNodeUpdater canu(&current_ast_node_, &node);
+ // TODO(csilvers): have VisitNestedNameSpecifierLoc instead.
+ if (!this->getDerived().VisitNestedNameSpecifier(
+@@ -400,7 +400,7 @@ class BaseAstVisitor : public RecursiveA
+ }
+
+ bool TraverseTemplateName(TemplateName template_name) {
+- ASTNode node(&template_name, *GlobalSourceManager());
++ ASTNode node(&template_name);
+ CurrentASTNodeUpdater canu(&current_ast_node_, &node);
+ if (!this->getDerived().VisitTemplateName(template_name))
+ return false;
+@@ -408,7 +408,7 @@ class BaseAstVisitor : public RecursiveA
+ }
+
+ bool TraverseTemplateArgument(const TemplateArgument& arg) {
+- ASTNode node(&arg, *GlobalSourceManager());
++ ASTNode node(&arg);
+ CurrentASTNodeUpdater canu(&current_ast_node_, &node);
+ if (!this->getDerived().VisitTemplateArgument(arg))
+ return false;
+@@ -416,7 +416,7 @@ class BaseAstVisitor : public RecursiveA
+ }
+
+ bool TraverseTemplateArgumentLoc(const TemplateArgumentLoc& argloc) {
+- ASTNode node(&argloc, *GlobalSourceManager());
++ ASTNode node(&argloc);
+ CurrentASTNodeUpdater canu(&current_ast_node_, &node);
+ if (!this->getDerived().VisitTemplateArgumentLoc(argloc))
+ return false;
+@@ -3940,7 +3940,7 @@ class IwyuAstConsumer
+ if (const TemplateSpecializationType* arg_tmpl = DynCastFrom(arg_type)) {
+ // Special case: We are instantiating the type in the context of an
+ // expression. Need to push the type to the AST stack explicitly.
+- ASTNode node(arg_tmpl, *GlobalSourceManager());
++ ASTNode node(arg_tmpl);
+ node.SetParent(current_ast_node());
+
+ instantiated_template_visitor_.ScanInstantiatedType(
+Index: iwyu/iwyu_ast_util.cc
+===================================================================
+--- iwyu.orig/iwyu_ast_util.cc
++++ iwyu/iwyu_ast_util.cc
+@@ -183,13 +183,12 @@ SourceLocation ASTNode::GetLocation() co
+ // locations are in a different file, then we're uncertain of our
+ // own location. Return an invalid location.
+ if (retval.isValid()) {
+- FullSourceLoc full_loc(retval, source_manager_);
++ clang::SourceManager& sm = *GlobalSourceManager();
++ FullSourceLoc full_loc(retval, sm);
+ const FileEntry* spelling_file =
+- source_manager_.getFileEntryForID(
+- source_manager_.getFileID(full_loc.getSpellingLoc()));
++ sm.getFileEntryForID(sm.getFileID(full_loc.getSpellingLoc()));
+ const FileEntry* instantiation_file =
+- source_manager_.getFileEntryForID(
+- source_manager_.getFileID(full_loc.getExpansionLoc()));
++ sm.getFileEntryForID(sm.getFileID(full_loc.getExpansionLoc()));
+ if (spelling_file != instantiation_file)
+ return SourceLocation();
+ }
+Index: iwyu/iwyu_ast_util.h
+===================================================================
+--- iwyu.orig/iwyu_ast_util.h
++++ iwyu/iwyu_ast_util.h
+@@ -40,7 +40,6 @@ class ClassTemplateDecl;
+ class Expr;
+ class FunctionDecl;
+ class NamedDecl;
+-class SourceManager;
+ class TagDecl;
+ class TemplateDecl;
+ class TemplateName;
+@@ -72,37 +71,33 @@ class ASTNode {
+ public:
+ // In each case, the caller owns the object, and must guarantee it
+ // lives for at least as long as the ASTNode object does.
+- ASTNode(const clang::Decl* decl, const clang::SourceManager& sm)
++ ASTNode(const clang::Decl* decl)
+ : kind_(kDeclKind), as_decl_(decl),
+- parent_(nullptr), in_fwd_decl_context_(false), source_manager_(sm) { }
+- ASTNode(const clang::Stmt* stmt, const clang::SourceManager& sm)
++ parent_(nullptr), in_fwd_decl_context_(false) { }
++ ASTNode(const clang::Stmt* stmt)
+ : kind_(kStmtKind), as_stmt_(stmt),
+- parent_(nullptr), in_fwd_decl_context_(false), source_manager_(sm) { }
+- ASTNode(const clang::Type* type, const clang::SourceManager& sm)
++ parent_(nullptr), in_fwd_decl_context_(false) { }
++ ASTNode(const clang::Type* type)
+ : kind_(kTypeKind), as_type_(type),
+- parent_(nullptr), in_fwd_decl_context_(false), source_manager_(sm) { }
+- ASTNode(const clang::TypeLoc* typeloc, const clang::SourceManager& sm)
++ parent_(nullptr), in_fwd_decl_context_(false) { }
++ ASTNode(const clang::TypeLoc* typeloc)
+ : kind_(kTypelocKind), as_typeloc_(typeloc),
+- parent_(nullptr), in_fwd_decl_context_(false), source_manager_(sm) { }
+- ASTNode(const clang::NestedNameSpecifier* nns, const clang::SourceManager& sm)
++ parent_(nullptr), in_fwd_decl_context_(false) { }
++ ASTNode(const clang::NestedNameSpecifier* nns)
+ : kind_(kNNSKind), as_nns_(nns),
+- parent_(nullptr), in_fwd_decl_context_(false), source_manager_(sm) { }
+- ASTNode(const clang::NestedNameSpecifierLoc* nnsloc,
+- const clang::SourceManager& sm)
++ parent_(nullptr), in_fwd_decl_context_(false) { }
++ ASTNode(const clang::NestedNameSpecifierLoc* nnsloc)
+ : kind_(kNNSLocKind), as_nnsloc_(nnsloc),
+- parent_(nullptr), in_fwd_decl_context_(false), source_manager_(sm) { }
+- ASTNode(const clang::TemplateName* template_name,
+- const clang::SourceManager& sm)
++ parent_(nullptr), in_fwd_decl_context_(false) { }
++ ASTNode(const clang::TemplateName* template_name)
+ : kind_(kTemplateNameKind), as_template_name_(template_name),
+- parent_(nullptr), in_fwd_decl_context_(false), source_manager_(sm) { }
+- ASTNode(const clang::TemplateArgument* template_arg,
+- const clang::SourceManager& sm)
++ parent_(nullptr), in_fwd_decl_context_(false) { }
++ ASTNode(const clang::TemplateArgument* template_arg)
+ : kind_(kTemplateArgumentKind), as_template_arg_(template_arg),
+- parent_(nullptr), in_fwd_decl_context_(false), source_manager_(sm) { }
+- ASTNode(const clang::TemplateArgumentLoc* template_argloc,
+- const clang::SourceManager& sm)
++ parent_(nullptr), in_fwd_decl_context_(false) { }
++ ASTNode(const clang::TemplateArgumentLoc* template_argloc)
+ : kind_(kTemplateArgumentLocKind), as_template_argloc_(template_argloc),
+- parent_(nullptr), in_fwd_decl_context_(false), source_manager_(sm) { }
++ parent_(nullptr), in_fwd_decl_context_(false) { }
+
+ // A 'forward-declare' context means some parent of us can be
+ // forward-declared, which means we can be too. e.g. in
+@@ -327,7 +322,6 @@ class ASTNode {
+ };
+ const ASTNode* parent_;
+ bool in_fwd_decl_context_;
+- const clang::SourceManager& source_manager_;
+ };
+
+ // --- Helper classes for ASTNode.
diff --git a/debian/patches/PrintableStmt.patch b/debian/patches/PrintableStmt.patch
new file mode 100644
index 0000000..52bc05f
--- /dev/null
+++ b/debian/patches/PrintableStmt.patch
@@ -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(-)
+
+Index: iwyu/iwyu_ast_util.cc
+===================================================================
+--- iwyu.orig/iwyu_ast_util.cc
++++ iwyu/iwyu_ast_util.cc
+@@ -26,6 +26,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"
+@@ -47,6 +48,7 @@ namespace clang {
+ class FileEntry;
+ } // namespace clang
+
++using clang::ASTDumper;
+ using clang::BlockPointerType;
+ using clang::CXXConstructExpr;
+ using clang::CXXConstructorDecl;
+@@ -440,12 +442,14 @@ string PrintableDecl(const Decl* decl, b
+ 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) {
diff --git a/debian/patches/python3.diff b/debian/patches/python3.diff
new file mode 100644
index 0000000..2c19594
--- /dev/null
+++ b/debian/patches/python3.diff
@@ -0,0 +1,20 @@
+Index: iwyu/fix_includes.py
+===================================================================
+--- iwyu.orig/fix_includes.py
++++ iwyu/fix_includes.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+
+ ##===--- fix_includes.py - rewrite source files based on iwyu output ------===##
+ #
+Index: iwyu/iwyu_tool.py
+===================================================================
+--- iwyu.orig/iwyu_tool.py
++++ iwyu/iwyu_tool.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+
+ ##===--- iwyu_tool.py -----------------------------------------------------===##
+ #
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..151ff26
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+python3.diff
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..6b9d561
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,48 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+TARGET_BUILD=iwyu-build
+VERSION=$(shell dpkg-parsechangelog |grep "^Version:"|sed -e "s|Version: \(.*\)|\1|")
+include /usr/share/dpkg/architecture.mk
+ADDITIONAL_CXX_FLAGS=""
+
+ifneq (,$(filter $(DEB_BUILD_ARCH),mips64el))
+ ADDITIONAL_CXX_FLAGS += -mxgot
+endif
+
+ifneq (,$(filter $(DEB_HOST_ARCH), armel))
+ export DEB_LDFLAGS_MAINT_APPEND = -latomic
+endif
+
+%:
+ dh $@ --buildsystem=cmake --builddirectory=$(TARGET_BUILD)
+
+
+override_dh_auto_configure:
+ dh_auto_configure -- -DCMAKE_CXX_FLAGS="$(ADDITIONAL_CXX_FLAGS)" -DLLVM_PATH=/usr/lib/llvm-12/ -DCMAKE_PREFIX_PATH=/usr/lib/llvm-12/
+
+
+override_dh_auto_build:
+ dh_auto_build
+ help2man --no-info --version-string "$(VERSION)" -n "Analyze #includes in C and C++ source files" $(TARGET_BUILD)/bin/include-what-you-use > $(TARGET_BUILD)/include-what-you-use.1
+ cd $(TARGET_BUILD) && ln -s include-what-you-use.1 iwyu.1 && \
+ cp ../fix_includes.py fix_include
+ chrpath -d $(TARGET_BUILD)/bin/include-what-you-use
+
+
+override_dh_auto_install:
+ dh_auto_install
+ cd debian/iwyu/usr/bin; \
+ rm -f fix_includes.py; \
+ mv iwyu_tool.py iwyu_tool
+
+override_dh_auto_test:
+# Do not fail the build if a test is failing.
+# It isn't tested upstream besides i386 & amd64
+ dh_auto_test || true
+
+override_dh_auto_clean:
+ rm -rf $(TARGET_BUILD)
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/upstream/metadata b/debian/upstream/metadata
new file mode 100644
index 0000000..9741b01
--- /dev/null
+++ b/debian/upstream/metadata
@@ -0,0 +1,4 @@
+Bug-Database: https://github.com/include-what-you-use/include-what-you-use/issues
+Bug-Submit: https://github.com/include-what-you-use/include-what-you-use/issues/new
+Repository: https://github.com/include-what-you-use/include-what-you-use.git
+Repository-Browse: https://github.com/include-what-you-use/include-what-you-use
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..bcfb0db
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,2 @@
+version=4
+opts=uversionmangle=s/^/8./ https://github.com/include-what-you-use/include-what-you-use/tags .*/0.(.*)\.tar\.gz