Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 9403e6f4 authored by Olivier JG's avatar Olivier JG

Port from kDebug to qCDebug

parent af55a4d6
......@@ -41,9 +41,9 @@
#include "duchain/parsesession.h"
#include "duchain/clangindex.h"
#include "duchain/clangparsingenvironmentfile.h"
#include "util/clangdebug.h"
#include "util/clangtypes.h"
#include "debug.h"
#include "clangsupport.h"
#include <QFile>
......
......@@ -25,8 +25,8 @@
#include "clangparsejob.h"
#include "version.h"
#include "debug.h"
#include "util/clangdebug.h"
#include "util/clangtypes.h"
#include "codecompletion/model.h"
......@@ -141,7 +141,7 @@ QPair<TopDUContextPointer, KTextEditor::Range> importedContextForPosition(const
// Since this is called by the editor while editing, use a fast timeout so the editor stays responsive
DUChainReadLocker lock(nullptr, 100);
if (!lock.locked()) {
debug() << "Failed to lock the du-chain in time";
clangDebug() << "Failed to lock the du-chain in time";
return {TopDUContextPointer(), KTextEditor::Range::invalid()};
}
......@@ -151,7 +151,7 @@ QPair<TopDUContextPointer, KTextEditor::Range> importedContextForPosition(const
}
if ((topContext->parsingEnvironmentFile() && topContext->parsingEnvironmentFile()->isProxyContext())) {
debug() << "Strange: standard-context for" << topContext->url().str() << "is a proxy-context";
clangDebug() << "Strange: standard-context for" << topContext->url().str() << "is a proxy-context";
return {TopDUContextPointer(), KTextEditor::Range::invalid()};
}
......
......@@ -23,9 +23,9 @@
#include "../duchain/cursorkindtraits.h"
#include "../duchain/parsesession.h"
#include "../util/clangdebug.h"
#include "../util/clangtypes.h"
#include "../util/clangutils.h"
#include "../debug.h"
#include <language/duchain/stringhelpers.h>
......@@ -269,7 +269,7 @@ void CompletionHelper::computeCompletions(const ParseSession& session, const KTe
CXSourceLocation location = clang_getLocation(unit, session.file(), position.line() + 1, position.column() + 1);
if (clang_equalLocations(clang_getNullLocation(), location)) {
debug() << "Completion helper given invalid position " << position
clangDebug() << "Completion helper given invalid position " << position
<< " in file " << session.file();
return;
}
......
......@@ -32,12 +32,12 @@
#include <language/codecompletion/codecompletionmodel.h>
#include <language/codecompletion/normaldeclarationcompletionitem.h>
#include "../duchain/parsesession.h"
#include "../util/clangdebug.h"
#include "../util/clangtypes.h"
#include "../duchain/parsesession.h"
#include "../duchain/cursorkindtraits.h"
#include "../duchain/navigationwidget.h"
#include "../debug.h"
#include <memory>
......@@ -339,7 +339,7 @@ ClangCodeCompletionContext::ClangCodeCompletionContext(const DUContextPointer& c
const unsigned int completeOptions = clang_defaultCodeCompleteOptions();
if (!m_text.isEmpty()) {
debug() << "Unsaved contents found for file" << file << "- creating CXUnsavedFile";
clangDebug() << "Unsaved contents found for file" << file << "- creating CXUnsavedFile";
CXUnsavedFile unsaved;
const QByteArray content = m_text.toUtf8();
......@@ -381,7 +381,7 @@ bool ClangCodeCompletionContext::isValidPosition() const
{
ParseSession session(m_parseSessionData);
if (isInsideComment(session.unit(), session.file(), m_position.castToSimpleCursor())) {
debug() << "Invalid completion context: Inside comment";
clangDebug() << "Invalid completion context: Inside comment";
return false;
}
return true;
......@@ -406,7 +406,7 @@ QList<CompletionTreeItemPointer> ClangCodeCompletionContext::completionItems(boo
DUContext* ctx = m_duContext->findContextAt(m_position);
debug() << "Clang found" << m_results->NumResults << "completion results";
clangDebug() << "Clang found" << m_results->NumResults << "completion results";
for (uint i = 0; i < m_results->NumResults; ++i) {
if (abort) {
......@@ -550,7 +550,7 @@ QList<CompletionTreeItemPointer> ClangCodeCompletionContext::completionItems(boo
item = declarationItem;
} else {
// still, let's trust that Clang found something useful and put it into the completion result list
debug() << "Could not find declaration for" << qid;
clangDebug() << "Could not find declaration for" << qid;
item = CompletionTreeItemPointer(new SimpleItem(display, resultType, replacement));
}
......
......@@ -21,7 +21,7 @@
#include "codegenhelper.h"
#include "../duchain/duchainutils.h"
#include "../debug.h"
#include "../util/clangdebug.h"
#include <language/assistant/renameaction.h>
#include <language/codegen/documentchangeset.h>
......@@ -144,7 +144,7 @@ void AdaptSignatureAction::execute()
lock.unlock();
m_otherSideTopContext = DUChain::self()->waitForUpdate(url, TopDUContext::AllDeclarationsContextsAndUses);
if (!m_otherSideTopContext) {
debug() << "failed to update" << url.str();
clangDebug() << "failed to update" << url.str();
return;
}
......@@ -152,16 +152,16 @@ void AdaptSignatureAction::execute()
Declaration* otherSide = m_otherSideId.getDeclaration(m_otherSideTopContext.data());
if (!otherSide) {
debug() << "could not find definition";
clangDebug() << "could not find definition";
return;
}
DUContext* functionContext = DUChainUtils::getFunctionContext(otherSide);
if (!functionContext) {
debug() << "no function context";
clangDebug() << "no function context";
return;
}
if (!functionContext || functionContext->type() != DUContext::Function) {
debug() << "no correct function context";
clangDebug() << "no correct function context";
return;
}
......
......@@ -31,7 +31,7 @@
#include <KTextEditor/Document>
#include <KTextEditor/View>
#include "../debug.h"
#include "../util/clangdebug.h"
using namespace KDevelop;
......@@ -110,7 +110,7 @@ void AdaptSignatureAssistant::textChanged(KTextEditor::View* view, const KTextEd
DUChainReadLocker lock(DUChain::lock(), 300);
if (!lock.locked()) {
debug() << "failed to lock duchain in time";
clangDebug() << "failed to lock duchain in time";
return;
}
KTextEditor::Range simpleInvocationRange = KTextEditor::Range(sigAssistRange);
......
......@@ -43,8 +43,6 @@
#include "../util/clangutils.h"
#include "../util/clangtypes.h"
#include "../debug.h"
using namespace KDevelop;
namespace {
......@@ -137,7 +135,7 @@ KTextEditor::Cursor findSignatureEnd(KTextEditor::Document *targetDoc, CXCursor
}
}
if (searchChar != endChar) {
debug() << "Could not find ending character of declaration";
clangDebug() << "Could not find ending character of declaration";
return KTextEditor::Cursor::invalid();
}
......@@ -161,13 +159,13 @@ KUrl findCompanionFile(const KUrl& fileUrl, const KTextEditor::Cursor& sc, const
} else if (srcMime.contains(me)) {
targetTypes = headerMime;
} else {
debug() << "Unrecgonized file extension";
clangDebug() << "Unrecgonized file extension";
return KUrl();
}
IBuddyDocumentFinder* buddyFinder = IBuddyDocumentFinder::finderForMimeType(KMimeType::findByUrl(fileUrl)->name());
if (!buddyFinder) {
debug() << "Could not create buddy finder for " << fileUrl;
clangDebug() << "Could not create buddy finder for " << fileUrl;
return KUrl();
}
foreach (KUrl potentialUrl, buddyFinder->getPotentialBuddies(fileUrl)) {
......@@ -359,13 +357,13 @@ void ClangSignatureAssistant::textChanged(KTextEditor::View* view, const KTextEd
CXFile otherFile;
clang_getFileLocation(clang_getCursorLocation(otherSide), &otherFile, nullptr, nullptr, nullptr);
if (!otherFile) {
debug() << "Could not find file corresponding to other side of definition";
clangDebug() << "Could not find file corresponding to other side of definition";
return;
}
m_targetUnit = KUrl(ClangString(clang_getFileName(otherFile)).toString());
if (m_targetUnit.isEmpty()) {
debug() << "Could not access file " << clang_getFileName(otherFile);
clangDebug() << "Could not access file " << clang_getFileName(otherFile);
return;
}
}
......@@ -382,7 +380,7 @@ void ClangSignatureAssistant::textChanged(KTextEditor::View* view, const KTextEd
m_targetUnit = findCompanionFile(fileUrl, simpleCursor, session.file(), otherSide);
if (m_targetUnit.isEmpty()) {
debug() << "Could not find candidate target for " << fileUrl;
clangDebug() << "Could not find candidate target for " << fileUrl;
return;
}
m_targetDecl = false;
......@@ -450,13 +448,13 @@ void ClangSignatureAssistant::parseJobFinished(ParseJob* job)
CXCursor cursor = getFunctionCursor(c, sourceSession.unit(), sourceSession.file());
CXCursor otherCursor = getFunctionCursor(m_otherLoc, targetUnit, otherFile);
if (clang_Cursor_isNull(cursor)) {
debug() << "Couldn't get source cursor " << clang_getFileName(sourceSession.file()) << ":" << c;
clangDebug() << "Couldn't get source cursor " << clang_getFileName(sourceSession.file()) << ":" << c;
reset();
return;
}
if (clang_Cursor_isNull(otherCursor)) {
debug() << "Couldn't get target cursor " << clang_getFileName(otherFile) << ":" << m_otherLoc;
clangDebug() << "Couldn't get target cursor " << clang_getFileName(otherFile) << ":" << m_otherLoc;
reset();
return;
}
......
/*
This file is part of KDevelop
Copyright 2013 Olivier de Gaalon <olivier.jg@gmail.com>
Copyright 2013 Milian Wolff <mail@milianw.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef DEBUG_H
#define DEBUG_H
#include <KDebug>
static int debugArea()
{
static int s_area = KDebug::registerArea("kdevelop (Clang support)");
return s_area;
}
#define debug() kDebug(debugArea())
#endif // DEBUG_H
......@@ -21,7 +21,7 @@
#include "clangducontext.h"
#include "duchain/navigationwidget.h"
#include "../debug.h"
#include "../util/clangdebug.h"
#include <language/duchain/duchainregister.h>
#include <language/duchain/topducontextdata.h>
......@@ -55,7 +55,7 @@ QWidget* ClangNormalDUContext::createNavigationWidget(Declaration* decl, TopDUCo
{
if (!decl) {
debug() << "no declaration, not returning navigationwidget";
clangDebug() << "no declaration, not returning navigationwidget";
return 0;
}
return new ClangNavigationWidget(DeclarationPointer(decl));
......
......@@ -27,7 +27,7 @@
#include "parsesession.h"
#include "clangparsingenvironment.h"
#include "../debug.h"
#include "../util/clangdebug.h"
using namespace KDevelop;
......@@ -90,7 +90,7 @@ bool ClangParsingEnvironmentFile::needsUpdate(const ParsingEnvironment* environm
if (!d_func()->isSystemHeader && env->hash() != d_func()->environmentHash
&& (env->projectKnown() || env->projectKnown() == d_func()->projectWasKnown))
{
debug() << "environment differs, require update:" << url()
clangDebug() << "environment differs, require update:" << url()
<< "new hash:" << env->hash() << "new project known:" << env->projectKnown()
<< "old hash:" << d_func()->environmentHash << "old project known:" << d_func()->projectWasKnown;
return true;
......@@ -99,7 +99,7 @@ bool ClangParsingEnvironmentFile::needsUpdate(const ParsingEnvironment* environm
bool ret = KDevelop::ParsingEnvironmentFile::needsUpdate(environment);
if (ret) {
debug() << "modification revision requires update:" << url();
clangDebug() << "modification revision requires update:" << url();
}
return ret;
}
......
......@@ -22,7 +22,7 @@
#include "clangproblem.h"
#include "util/clangtypes.h"
#include "../debug.h"
#include "util/clangdebug.h"
#include <language/duchain/duchainlock.h>
#include <language/codegen/documentchangeset.h>
......
......@@ -26,8 +26,6 @@
#include <language/duchain/functiondefinition.h>
#include <language/codegen/coderepresentation.h>
#include "../debug.h"
using namespace KDevelop;
namespace ClangIntegration {
......
......@@ -28,9 +28,8 @@
#include "clanghelpers.h"
#include "clangindex.h"
#include "clangparsingenvironment.h"
#include "debug.h"
#include "util/clangdebug.h"
#include "util/clangtypes.h"
#include "../debug.h"
#include <language/duchain/duchainlock.h>
#include <language/duchain/duchain.h>
......@@ -177,7 +176,7 @@ ParseSessionData::ParseSessionData(const IndexedString& url, const QByteArray& c
&m_unit
);
if (code != CXError_Success) {
debug() << "clang_parseTranslationUnit2 return with error code" << code;
clangDebug() << "clang_parseTranslationUnit2 return with error code" << code;
}
#else
m_unit = clang_parseTranslationUnit(
......@@ -196,7 +195,7 @@ ParseSessionData::ParseSessionData(const IndexedString& url, const QByteArray& c
clang_saveTranslationUnit(m_unit, path + ".pch", CXSaveTranslationUnit_None);
}
} else {
debug() << "Failed to parse file:" << file.Filename;
clangDebug() << "Failed to parse file:" << file.Filename;
}
}
......
......@@ -22,7 +22,6 @@
#include "todoextractor.h"
#include "../util/clangtypes.h"
#include "../debug.h"
#include <language/duchain/problem.h>
#include <language/duchain/stringhelpers.h>
......
......@@ -21,7 +21,7 @@
#include "tuduchain.h"
#include "debug.h"
#include "util/clangdebug.h"
#include <language/duchain/types/indexedtype.h>
......@@ -457,7 +457,7 @@ CXChildVisitResult TUDUChain::buildUse<CXCursor_CXXBaseSpecifier>(CXCursor curso
auto decl = findDeclaration(classDeclCursor);
if (!decl) {
// this happens for templates with template-dependent base classes e.g. - dunno whether we can/should do more here
debug() << "failed to find declaration for base specifier:" << ClangString(clang_getCursorDisplayName(cursor));
clangDebug() << "failed to find declaration for base specifier:" << ClangString(clang_getCursorDisplayName(cursor));
return CXChildVisit_Continue;
}
......
......@@ -31,7 +31,6 @@
#include "util/clangdebug.h"
#include "util/clangutils.h"
#include "util/clangtypes.h"
#include "../debug.h"
#include <util/pushvalue.h>
......@@ -130,7 +129,7 @@ private:
EnableIf<IsDefinition == Decision::Maybe && IsInClass != Decision::Maybe> = dummy>
CXChildVisitResult dispatchCursor(CXCursor cursor, CXCursor parent)
{
IF_DEBUG(debug() << "IsInClass:" << IsInClass << "- isDefinition:" << IsDefinition;)
IF_DEBUG(clangDebug() << "IsInClass:" << IsInClass << "- isDefinition:" << IsDefinition;)
const bool isDefinition = clang_isCursorDefinition(cursor);
return isDefinition ?
......@@ -145,7 +144,7 @@ private:
EnableIf<IsInClass != Decision::Maybe && IsDefinition != Decision::Maybe> = dummy>
CXChildVisitResult dispatchCursor(CXCursor cursor, CXCursor parent)
{
IF_DEBUG(debug() << "IsInClass:" << IsInClass << "- isDefinition:" << IsDefinition;)
IF_DEBUG(clangDebug() << "IsInClass:" << IsInClass << "- isDefinition:" << IsDefinition;)
// We may end up visiting the same cursor twice in some cases
// see discussion on https://git.reviewboard.kde.org/r/119526/
......@@ -164,7 +163,7 @@ private:
template<CXTypeKind TK>
AbstractType *dispatchType(CXType type, CXCursor cursor)
{
IF_DEBUG(debug() << "TK:" << type.kind;)
IF_DEBUG(clangDebug() << "TK:" << type.kind;)
auto kdevType = createType<TK>(type, cursor);
setTypeModifiers<TK>(type, kdevType);
......@@ -177,7 +176,7 @@ private:
CXChildVisitResult buildDeclaration(CXCursor cursor)
{
auto id = makeId(cursor);
IF_DEBUG(debug() << "id:" << id << "- CK:" << CK << "- DeclType:" << typeid(DeclType).name() << "- hasContext:" << hasContext;)
IF_DEBUG(clangDebug() << "id:" << id << "- CK:" << CK << "- DeclType:" << typeid(DeclType).name() << "- hasContext:" << hasContext;)
// Code path for class declarations that may be defined "out-of-line", e.g.
// "SomeNameSpace::SomeClass {};"
......
......@@ -23,7 +23,7 @@
#include "unknowndeclarationproblem.h"
#include "clanghelpers.h"
#include "../debug.h"
#include "../util/clangdebug.h"
#include "../util/clangutils.h"
#include "../util/clangtypes.h"
......@@ -98,7 +98,7 @@ QStringList scanIncludePaths( const QString& identifier, const QDir& dir, int ma
continue;
}
debug() << "Found candidate file" << path + "/" + identifier + ext;
clangDebug() << "Found candidate file" << path + "/" + identifier + ext;
candidates.append( path + "/" + identifier + ext );
}
......@@ -159,7 +159,7 @@ KDevelop::DocumentRange includeDirectivePosition(const KDevelop::Path& source, c
DUChainReadLocker lock;
const TopDUContext* top = DUChainUtils::standardContextForUrl( source.toUrl() );
if( !top ) {
debug() << "unable to find standard context for" << source.toLocalFile() << "Creating null range";
clangDebug() << "unable to find standard context for" << source.toLocalFile() << "Creating null range";
return KDevelop::DocumentRange::invalid();
}
......@@ -191,7 +191,7 @@ KDevelop::DocumentRange forwardDeclarationPosition( const KDevelop::Path& source
DUChainReadLocker lock;
const TopDUContext* top = DUChainUtils::standardContextForUrl( source.toUrl() );
if( !top ) {
debug() << "unable to find standard context for" << source.toLocalFile() << "Creating null range";
clangDebug() << "unable to find standard context for" << source.toLocalFile() << "Creating null range";
return KDevelop::DocumentRange::invalid();
}
......@@ -216,13 +216,13 @@ QVector<KDevelop::QualifiedIdentifier> possibleDeclarations( const QualifiedIden
const TopDUContext* top = DUChainUtils::standardContextForUrl( file.toUrl() );
if( !top ) {
debug() << "unable to find standard context for" << file.toLocalFile() << "Not creating duchain candidates";
clangDebug() << "unable to find standard context for" << file.toLocalFile() << "Not creating duchain candidates";
return {};
}
const auto* context = top->findContextAt( cursor );
if( !context ) {
debug() << "No context found at" << cursor;
clangDebug() << "No context found at" << cursor;
return {};
}
......@@ -254,7 +254,7 @@ QVector<KDevelop::QualifiedIdentifier> possibleDeclarations( const QualifiedIden
declarations.append( scopes + identifier );
}
debug() << "Possible declarations:" << declarations;
clangDebug() << "Possible declarations:" << declarations;
return declarations;
}
......@@ -267,7 +267,7 @@ QStringList duchainCandidates( const QualifiedIdentifier& identifier, const KDev
*/
QStringList candidates;
for( const auto& declaration : possibleDeclarations( identifier, file, cursor ) ) {
debug() << "Considering candidate declaration" << declaration;
clangDebug() << "Considering candidate declaration" << declaration;
const IndexedDeclaration* declarations;
uint declarationCount;
PersistentSymbolTable::self().declarations( declaration , declarationCount, declarations );
......@@ -293,7 +293,7 @@ QStringList duchainCandidates( const QualifiedIdentifier& identifier, const KDev
if( !isBlacklisted( filepath ) ) {
candidates << filepath;
debug() << "Adding" << filepath << "determined from candidate" << declaration;
clangDebug() << "Adding" << filepath << "determined from candidate" << declaration;
}
for( const auto importer : decl->topContext()->parsingEnvironmentFile()->importers() ) {
......@@ -314,14 +314,14 @@ QStringList duchainCandidates( const QualifiedIdentifier& identifier, const KDev
* we prefer this to other headers
*/
candidates << filePath;
debug() << "Adding forwarder file" << filePath << "to the result set";
clangDebug() << "Adding forwarder file" << filePath << "to the result set";
}
}
}
std::sort( candidates.begin(), candidates.end() );
candidates.erase( std::unique( candidates.begin(), candidates.end() ), candidates.end() );
debug() << "Candidates: " << candidates;
clangDebug() << "Candidates: " << candidates;
return candidates;
}
......@@ -361,7 +361,7 @@ ClangFixit directiveForFile( const QString& includefile, const KDevelop::Path::L
const auto range = DocumentRange(IndexedString(source.pathOrUrl()), includeDirectivePosition(source, canonicalFile.lastPathSegment()));
if( !range.isValid() ) {
debug() << "unable to determine valid position for" << includefile << "in" << source.pathOrUrl();
clangDebug() << "unable to determine valid position for" << includefile << "in" << source.pathOrUrl();
return {};
}
......@@ -394,7 +394,7 @@ QStringList includeFiles( const QualifiedIdentifier& identifier, const KDevelop:
const auto includes = includePaths( file );
if( includes.isEmpty() ) {
debug() << "Include path is empty";
clangDebug() << "Include path is empty";
return {};
}
......@@ -442,7 +442,7 @@ ClangFixits fixUnknownDeclaration( const QualifiedIdentifier& identifier, const
for( const auto& includeFile : includefiles ) {
const auto fixit = directiveForFile( includeFile, includepaths, file /* UP */ );
if (!fixit.range.isValid()) {
debug() << "unable to create directive for" << includeFile << "in" << file.toLocalFile();
clangDebug() << "unable to create directive for" << includeFile << "in" << file.toLocalFile();
continue;
}
......
......@@ -20,8 +20,6 @@
#include "test_buddies.h"
#include "../debug.h"
#include <qtest_kde.h>
#include <QSplitter>
......@@ -77,7 +75,7 @@ void TestBuddies::verifyFilename(Sublime::View *view, const QString& endOfFilena
Sublime::UrlDocument *urlDoc = dynamic_cast<Sublime::UrlDocument *>(view->document());
QVERIFY(urlDoc);
if (urlDoc) {
debug() << urlDoc->url().toLocalFile() << endOfFilename;
qDebug() << urlDoc->url().toLocalFile() << endOfFilename;
QVERIFY(urlDoc->url().toLocalFile().endsWith(endOfFilename));
}
}
......
......@@ -22,7 +22,7 @@
#include "../util/clangutils.h"
#include "../util/clangtypes.h"
#include "../debug.h"
#include "../util/clangdebug.h"
#include <language/editor/documentrange.h>
#include <tests/testcore.h>
......@@ -130,7 +130,7 @@ void TestClangUtils::testGetScope()
runVisitor(code, visitor);
QVERIFY(cursorIndex < visitor.cursors.size());
const auto cursor = visitor.cursors[cursorIndex];
debug() << "Found decl:" << ClangString(clang_getCursorSpelling(cursor)) << "| range:" << ClangRange(clang_getCursorExtent(cursor)).toRange();
clangDebug() << "Found decl:" << ClangString(clang_getCursorSpelling(cursor)) << "| range:" << ClangRange(clang_getCursorExtent(cursor)).toRange();
const QString scope = ClangUtils::getScope(cursor);
QCOMPARE(scope, expectedScope);
......
......@@ -31,9 +31,6 @@
#include "testfilepaths.h"
//HACK: TODO: Don't define debug as an alias for our future qCDebug area
#undef debug
//Include all used json tests, otherwise "Test not found"
#include <tests/json/jsondeclarationtests.h>
#include <tests/json/jsonducontexttests.h>
......
......@@ -27,6 +27,8 @@
#include <language/editor/documentcursor.h>
#include <language/editor/documentrange.h>
Q_LOGGING_CATEGORY(KDEV_CLANG, "kdev-clang")
using namespace KDevelop;
QDebug operator<<(QDebug dbg, CXString string)
......
......@@ -22,10 +22,13 @@
#ifndef CLANGDEBUG_H
#define CLANGDEBUG_H
#include <QDebug>
#include <QtCore/QLoggingCategory>
#include <clang-c/Index.h>
Q_DECLARE_LOGGING_CATEGORY(KDEV_CLANG)
#define clangDebug() qCDebug(KDEV_CLANG)
QDebug operator<<(QDebug dbg, CXString string);
QDebug operator<<(QDebug dbg, CXSourceLocation location);
QDebug operator<<(QDebug dbg, CXSourceRange range);
......
......@@ -24,7 +24,6 @@
#include "../util/clangdebug.h"
#include "../util/clangtypes.h"
#include "../duchain/cursorkindtraits.h"
#include "../debug.h"
#include <serialization/indexedstring.h>
#include <language/editor/documentrange.h>
......@@ -40,14 +39,14 @@ using namespace KDevelop;
CXCursor ClangUtils::getCXCursor(int line, int column, const CXTranslationUnit& unit, const CXFile& file)
{
if (!file) {
debug() << "getCXCursor couldn't find file: " << clang_getFileName(file);
clangDebug() << "getCXCursor couldn't find file: " << clang_getFileName(file);
return clang_getNullCursor();
}
CXSourceLocation location = clang_getLocation(unit, file, line + 1, column + 1);
if (clang_equalLocations(clang_getNullLocation(), location)) {
debug() << "getCXCursor given invalid position " << line << ", " << column
clangDebug() << "getCXCursor given invalid position " << line << ", " << column
<< " for file " << clang_getFileName(file);
return clang_getNullCursor();
}
......@@ -80,7 +79,7 @@ CXChildVisitResult paramVisitor(CXCursor cursor, CXCursor /*parent*/, CXClientDa
CXFile file;
clang_getFileLocation(clang_getCursorLocation(cursor),&file,nullptr,nullptr,nullptr);
if (!file) {
debug() << "Couldn't find file associated with default parameter cursor!";
clangDebug() << "Couldn't find file associated with default parameter cursor!";
//We keep going, because getting an error because we accidentally duplicated
//a default parameter is better than deleting a default parameter
}
......@@ -114,7 +113,7 @@ QVector<QString> ClangUtils::getDefaultArguments(CXCursor cursor, DefaultArgumen
CXFile file;
clang_getFileLocation(clang_getCursorLocation(cursor),&file,nullptr,nullptr,nullptr);
if (!file) {
debug() << "Couldn't find file associated with default parameter cursor!";
clangDebug() << "Couldn't find file associated with default parameter cursor!";
//The empty string serves as a wildcard string, because it's better to
//duplicate a default parameter than delete one
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment