예제 #1
0
        private Module GetModule(TranslationUnit unit)
        {
            if (unit.IsSystemHeader)
            {
                return(Options.SystemModule);
            }

            var includeDir = Path.GetDirectoryName(unit.FilePath);

            if (string.IsNullOrWhiteSpace(includeDir))
            {
                includeDir = ".";
            }
            includeDir = Path.GetFullPath(includeDir);

            Module module = Options.Modules.Find(
                m => m.IncludeDirs.Any(i => Path.GetFullPath(i) == includeDir));

            if (module == null)
            {
                unit.ExplicitlyIgnore();
                module = Options.Modules[1];
            }
            return(module);
        }
예제 #2
0
        public override bool VisitTranslationUnit(TranslationUnit unit)
        {
            var expansions = unit.PreprocessedEntities.OfType <MacroExpansion>();

            if (expansions.Any(e => e.Text == Prefix + "_IGNORE_FILE"))
            {
                unit.ExplicitlyIgnore();
            }

            return(base.VisitTranslationUnit(unit));
        }