Files
qt-creator/tests/manual/cplusplus-frontend/main.cpp

81 lines
2.2 KiB
C++
Raw Normal View History

/**************************************************************************
2008-12-03 11:37:35 +01:00
**
** This file is part of Qt Creator
**
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
2008-12-03 11:37:35 +01:00
**
** Contact: http://www.qt-project.org/
2008-12-03 11:37:35 +01:00
**
**
** GNU Lesser General Public License Usage
2008-12-03 11:37:35 +01:00
**
2011-04-13 08:42:33 +02:00
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
2008-12-03 11:37:35 +01:00
**
2010-12-17 16:01:08 +01:00
** In addition, as a special exception, Nokia gives you certain additional
2011-04-13 08:42:33 +02:00
** rights. These rights are described in the Nokia Qt LGPL Exception
2010-12-17 16:01:08 +01:00
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
2011-04-13 08:42:33 +02:00
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
2008-12-03 11:37:35 +01:00
**
**************************************************************************/
2008-12-09 15:25:01 +01:00
#include <AST.h>
2009-01-02 16:10:28 +01:00
#include <ASTVisitor.h>
2009-11-16 14:46:07 +01:00
#include <ASTPatternBuilder.h>
2009-11-13 12:13:49 +01:00
#include <ASTMatcher.h>
2008-12-09 15:25:01 +01:00
#include <Control.h>
#include <Scope.h>
#include <TranslationUnit.h>
#include <Literals.h>
#include <Symbols.h>
#include <Names.h>
#include <CoreTypes.h>
#include <CppDocument.h>
2008-12-09 15:25:01 +01:00
2009-01-06 15:15:13 +01:00
#include <QFile>
#include <QList>
#include <QCoreApplication>
#include <QStringList>
#include <QFileInfo>
#include <QTime>
2009-01-02 16:10:28 +01:00
#include <QtDebug>
#include <cstdio>
#include <cstdlib>
2009-01-06 15:15:13 +01:00
#include <iostream>
2009-10-21 14:56:42 +02:00
using namespace CPlusPlus;
2009-01-02 16:10:28 +01:00
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QStringList files = app.arguments();
files.removeFirst();
foreach (const QString &fileName, files) {
QFile file(fileName);
if (! file.open(QFile::ReadOnly))
continue;
const QByteArray source = file.readAll();
file.close();
Document::Ptr doc = Document::create(fileName);
doc->control()->setDiagnosticClient(0);
doc->setUtf8Source(source);
doc->parse();
}
return EXIT_SUCCESS;
}