[M120 Migration] Implement ewk_view_is_video_playing api
[platform/framework/web/chromium-efl.git] / build / rust / filter_clang_args.py
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.
4 """
5 Filters clang args to make them suitable for libclang.
6
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
10 which load plugins).
11
12 This function filters them out.
13 """
14
15
16 def filter_clang_args(clangargs):
17   def do_filter(args):
18     i = 0
19     while i < len(args):
20       # Intercept plugin arguments
21       if args[i] == '-Xclang':
22         i += 1
23         if args[i] == '-add-plugin':
24           pass
25         elif args[i].startswith('-plugin-arg'):
26           i += 2
27       else:
28         yield args[i]
29       i += 1
30
31   return list(do_filter(clangargs))