2015-08-31 16:28:26 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:14 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2015-08-31 16:28:26 +02:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:14 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2015-08-31 16:28:26 +02:00
|
|
|
**
|
2016-01-15 14:57:14 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2015-08-31 16:28:26 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2015-08-31 16:28:26 +02:00
|
|
|
|
|
|
|
|
#include "sourcelocation.h"
|
|
|
|
|
|
|
|
|
|
namespace ClangBackEnd {
|
|
|
|
|
|
|
|
|
|
class SourceRangeContainer;
|
|
|
|
|
|
|
|
|
|
class SourceRange
|
|
|
|
|
{
|
|
|
|
|
friend class Diagnostic;
|
|
|
|
|
friend class FixIt;
|
2015-11-17 13:33:31 +01:00
|
|
|
friend class Cursor;
|
|
|
|
|
friend bool operator==(const SourceRange &first, const SourceRange &second);
|
2021-12-06 05:11:04 +01:00
|
|
|
friend std::ostream &operator<<(std::ostream &os, const SourceRange &sourceRange);
|
2015-08-31 16:28:26 +02:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
SourceRange();
|
2017-11-29 16:08:06 +01:00
|
|
|
SourceRange(CXTranslationUnit cxTranslationUnit, CXSourceRange cxSourceRange);
|
2015-11-17 13:33:31 +01:00
|
|
|
SourceRange(const SourceLocation &start, const SourceLocation &end);
|
2015-11-02 10:39:08 +01:00
|
|
|
|
|
|
|
|
bool isNull() const;
|
|
|
|
|
bool isValid() const;
|
|
|
|
|
|
2015-08-31 16:28:26 +02:00
|
|
|
SourceLocation start() const;
|
|
|
|
|
SourceLocation end() const;
|
|
|
|
|
|
2019-07-24 18:40:10 +02:00
|
|
|
bool contains(int line, int column) const;
|
2017-06-09 12:19:09 +02:00
|
|
|
|
2015-08-31 16:28:26 +02:00
|
|
|
SourceRangeContainer toSourceRangeContainer() const;
|
|
|
|
|
|
2015-11-17 13:33:31 +01:00
|
|
|
operator CXSourceRange() const;
|
|
|
|
|
operator SourceRangeContainer() const;
|
2015-08-31 16:28:26 +02:00
|
|
|
|
2018-09-24 12:10:19 +02:00
|
|
|
CXTranslationUnit tu() const { return cxTranslationUnit; }
|
|
|
|
|
|
2015-08-31 16:28:26 +02:00
|
|
|
private:
|
|
|
|
|
CXSourceRange cxSourceRange;
|
2017-11-29 16:08:06 +01:00
|
|
|
CXTranslationUnit cxTranslationUnit = nullptr;
|
2015-08-31 16:28:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace ClangBackEnd
|