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 <clang-c/Index.h>
|
|
|
|
|
|
|
|
|
|
#include <utf8string.h>
|
|
|
|
|
|
|
|
|
|
namespace ClangBackEnd {
|
|
|
|
|
|
|
|
|
|
class SourceLocationContainer;
|
2016-09-07 10:42:12 +02:00
|
|
|
class Document;
|
2015-08-31 16:28:26 +02:00
|
|
|
|
|
|
|
|
class SourceLocation
|
|
|
|
|
{
|
|
|
|
|
friend class Diagnostic;
|
|
|
|
|
friend class SourceRange;
|
2016-09-07 14:50:58 +02:00
|
|
|
friend class TranslationUnit;
|
2015-11-17 13:33:31 +01:00
|
|
|
friend class Cursor;
|
2018-01-26 15:12:38 +01:00
|
|
|
friend class FullTokenInfo;
|
2015-11-17 13:33:31 +01:00
|
|
|
friend bool operator==(const SourceLocation &first, const SourceLocation &second);
|
2015-08-31 16:28:26 +02:00
|
|
|
|
|
|
|
|
public:
|
2015-11-17 13:33:31 +01:00
|
|
|
SourceLocation();
|
2017-06-16 10:45:05 +02:00
|
|
|
SourceLocation(CXTranslationUnit cxTranslationUnit,
|
|
|
|
|
const Utf8String &filePath,
|
|
|
|
|
uint line,
|
|
|
|
|
uint column);
|
2015-11-17 13:33:31 +01:00
|
|
|
|
2015-08-31 16:28:26 +02:00
|
|
|
const Utf8String &filePath() const;
|
|
|
|
|
uint line() const;
|
|
|
|
|
uint column() const;
|
|
|
|
|
uint offset() const;
|
|
|
|
|
|
|
|
|
|
SourceLocationContainer toSourceLocationContainer() const;
|
|
|
|
|
|
|
|
|
|
private:
|
2017-11-29 16:08:06 +01:00
|
|
|
SourceLocation(CXTranslationUnit cxTranslationUnit,
|
|
|
|
|
CXSourceLocation cxSourceLocation);
|
2015-11-17 13:33:31 +01:00
|
|
|
|
|
|
|
|
operator CXSourceLocation() const;
|
2015-08-31 16:28:26 +02:00
|
|
|
|
|
|
|
|
private:
|
2015-11-17 13:33:31 +01:00
|
|
|
CXSourceLocation cxSourceLocation;
|
2017-11-29 16:08:06 +01:00
|
|
|
CXTranslationUnit cxTranslationUnit;
|
2016-07-01 15:07:32 +02:00
|
|
|
mutable Utf8String filePath_;
|
2015-11-17 13:33:31 +01:00
|
|
|
uint line_ = 0;
|
|
|
|
|
uint column_ = 0;
|
|
|
|
|
uint offset_ = 0;
|
2016-07-01 15:07:32 +02:00
|
|
|
mutable bool isFilePathNormalized_ = true;
|
2015-08-31 16:28:26 +02:00
|
|
|
};
|
|
|
|
|
|
2015-11-17 13:33:31 +01:00
|
|
|
bool operator==(const SourceLocation &first, const SourceLocation &second);
|
|
|
|
|
|
2017-06-13 18:23:05 +02:00
|
|
|
std::ostream &operator<<(std::ostream &os, const SourceLocation &sourceLocation);
|
2015-08-31 16:28:26 +02:00
|
|
|
|
|
|
|
|
} // namespace ClangBackEnd
|