/// <summary> /// Gets all ranges that were skipped by the preprocessor. /// </summary> /// <remarks> /// The preprocessor will skip lines when they are surrounded by an if/ifdef/ifndef /// directive whose condition does not evaluate to true. /// </remarks> /// <returns>All ranges that were skipped by the preprocessor.</returns> /// <exception cref="ArgumentNullException"> /// <paramref name="file"/> is null. /// </exception> public SourceRange[] GetSkippedRanges(SourceFile file) { Requires.NotNull(file, nameof(file)); ThrowIfDisposed(); var ptr = NativeMethods.clang_getSkippedRanges(Ptr, file.Ptr); if (ptr == null) { return(Array.Empty <SourceRange>()); } else { try { var ranges = new SourceRange[ptr->count]; ranges.SetValues(i => SourceRange.Create(ptr->ranges[i], this)); return(ranges); } finally { NativeMethods.clang_disposeSourceRangeList(ptr); } } }
/// <summary> /// Gets all ranges from all files that were skipped by the preprocessor. /// </summary> /// <remarks> /// The preprocessor will skip lines when they are surrounded by an if/ifdef/ifndef /// directive whose condition does not evaluate to true. /// </remarks> /// <returns>All ranges from all files that were skipped by the preprocessor.</returns> public SourceRange[] GetAllSkippedRanges() { ThrowIfDisposed(); var ptr = NativeMethods.clang_getAllSkippedRanges(Ptr); if (ptr == null) { return(Array.Empty <SourceRange>()); } else { try { var ranges = new SourceRange[ptr->count]; ranges.SetValues(i => SourceRange.Create(ptr->ranges[i], this)); return(ranges); } finally { NativeMethods.clang_disposeSourceRangeList(ptr); } } }