1 # Copyright 2022 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 Filters clang args to make them suitable for libclang.
7 Rust involves several libclang-based tools that parse C++.
8 We pass such tools our complete {{cflags}}, but a few of the
9 arguments aren't appropriate for libclang (for example those
12 This function filters them out.
16 def filter_clang_args(clangargs):
20 # Intercept plugin arguments
21 if args[i] == '-Xclang':
23 if args[i] == '-add-plugin':
25 elif args[i].startswith('-plugin-arg'):
31 return list(do_filter(clangargs))