Clang import; Rename files/namespace
This commit is contained in:
parent
8f1a50ffc0
commit
4c778e0999
14
Makefile
14
Makefile
|
@ -184,7 +184,7 @@ LIBOBJ = $(libcppdir)/analyzerinfo.o \
|
||||||
$(libcppdir)/checkunusedfunctions.o \
|
$(libcppdir)/checkunusedfunctions.o \
|
||||||
$(libcppdir)/checkunusedvar.o \
|
$(libcppdir)/checkunusedvar.o \
|
||||||
$(libcppdir)/checkvaarg.o \
|
$(libcppdir)/checkvaarg.o \
|
||||||
$(libcppdir)/clangastdump.o \
|
$(libcppdir)/clangimport.o \
|
||||||
$(libcppdir)/cppcheck.o \
|
$(libcppdir)/cppcheck.o \
|
||||||
$(libcppdir)/ctu.o \
|
$(libcppdir)/ctu.o \
|
||||||
$(libcppdir)/errorlogger.o \
|
$(libcppdir)/errorlogger.o \
|
||||||
|
@ -226,7 +226,7 @@ TESTOBJ = test/options.o \
|
||||||
test/testboost.o \
|
test/testboost.o \
|
||||||
test/testbufferoverrun.o \
|
test/testbufferoverrun.o \
|
||||||
test/testcharvar.o \
|
test/testcharvar.o \
|
||||||
test/testclangastdump.o \
|
test/testclangimport.o \
|
||||||
test/testclass.o \
|
test/testclass.o \
|
||||||
test/testcmdlineparser.o \
|
test/testcmdlineparser.o \
|
||||||
test/testcondition.o \
|
test/testcondition.o \
|
||||||
|
@ -481,10 +481,10 @@ $(libcppdir)/checkunusedvar.o: lib/checkunusedvar.cpp lib/astutils.h lib/check.h
|
||||||
$(libcppdir)/checkvaarg.o: lib/checkvaarg.cpp lib/astutils.h lib/check.h lib/checkvaarg.h lib/config.h lib/errorlogger.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h
|
$(libcppdir)/checkvaarg.o: lib/checkvaarg.cpp lib/astutils.h lib/check.h lib/checkvaarg.h lib/config.h lib/errorlogger.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h
|
||||||
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/checkvaarg.o $(libcppdir)/checkvaarg.cpp
|
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/checkvaarg.o $(libcppdir)/checkvaarg.cpp
|
||||||
|
|
||||||
$(libcppdir)/clangastdump.o: lib/clangastdump.cpp lib/clangastdump.h lib/config.h lib/errorlogger.h lib/library.h lib/mathlib.h lib/platform.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h
|
$(libcppdir)/clangimport.o: lib/clangimport.cpp lib/config.h lib/errorlogger.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h
|
||||||
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/clangastdump.o $(libcppdir)/clangastdump.cpp
|
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/clangimport.o $(libcppdir)/clangimport.cpp
|
||||||
|
|
||||||
$(libcppdir)/cppcheck.o: lib/cppcheck.cpp externals/picojson.h externals/simplecpp/simplecpp.h externals/tinyxml/tinyxml2.h lib/analyzerinfo.h lib/check.h lib/checkunusedfunctions.h lib/clangastdump.h lib/config.h lib/cppcheck.h lib/ctu.h lib/errorlogger.h lib/exprengine.h lib/importproject.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/version.h
|
$(libcppdir)/cppcheck.o: lib/cppcheck.cpp externals/picojson.h externals/simplecpp/simplecpp.h externals/tinyxml/tinyxml2.h lib/analyzerinfo.h lib/check.h lib/checkunusedfunctions.h lib/config.h lib/cppcheck.h lib/ctu.h lib/errorlogger.h lib/exprengine.h lib/importproject.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/version.h
|
||||||
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/cppcheck.o $(libcppdir)/cppcheck.cpp
|
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/cppcheck.o $(libcppdir)/cppcheck.cpp
|
||||||
|
|
||||||
$(libcppdir)/ctu.o: lib/ctu.cpp externals/tinyxml/tinyxml2.h lib/astutils.h lib/check.h lib/config.h lib/ctu.h lib/errorlogger.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h
|
$(libcppdir)/ctu.o: lib/ctu.cpp externals/tinyxml/tinyxml2.h lib/astutils.h lib/check.h lib/config.h lib/ctu.h lib/errorlogger.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h
|
||||||
|
@ -592,8 +592,8 @@ test/testbufferoverrun.o: test/testbufferoverrun.cpp externals/tinyxml/tinyxml2.
|
||||||
test/testcharvar.o: test/testcharvar.cpp lib/check.h lib/checkother.h lib/config.h lib/errorlogger.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h
|
test/testcharvar.o: test/testcharvar.cpp lib/check.h lib/checkother.h lib/config.h lib/errorlogger.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h
|
||||||
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testcharvar.o test/testcharvar.cpp
|
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testcharvar.o test/testcharvar.cpp
|
||||||
|
|
||||||
test/testclangastdump.o: test/testclangastdump.cpp lib/clangastdump.h lib/config.h lib/errorlogger.h lib/suppressions.h test/testsuite.h
|
test/testclangimport.o: test/testclangimport.cpp lib/config.h lib/errorlogger.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h
|
||||||
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testclangastdump.o test/testclangastdump.cpp
|
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testclangimport.o test/testclangimport.cpp
|
||||||
|
|
||||||
test/testclass.o: test/testclass.cpp externals/tinyxml/tinyxml2.h lib/check.h lib/checkclass.h lib/config.h lib/errorlogger.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h
|
test/testclass.o: test/testclass.cpp externals/tinyxml/tinyxml2.h lib/check.h lib/checkclass.h lib/config.h lib/errorlogger.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h
|
||||||
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testclass.o test/testclass.cpp
|
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testclass.o test/testclass.cpp
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "clangastdump.h"
|
#include "clangimport.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "symboldatabase.h"
|
#include "symboldatabase.h"
|
||||||
#include "tokenize.h"
|
#include "tokenize.h"
|
||||||
|
@ -119,7 +119,7 @@ static std::vector<std::string> splitString(const std::string &line)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace clangastdump {
|
namespace clangimport {
|
||||||
struct Data {
|
struct Data {
|
||||||
struct Decl {
|
struct Decl {
|
||||||
Decl(Token *def, Variable *var) : def(def), function(nullptr), var(var) {}
|
Decl(Token *def, Variable *var) : def(def), function(nullptr), var(var) {}
|
||||||
|
@ -234,7 +234,7 @@ namespace clangastdump {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string clangastdump::AstNode::getSpelling() const
|
std::string clangimport::AstNode::getSpelling() const
|
||||||
{
|
{
|
||||||
if (mExtTokens.back() == "extern")
|
if (mExtTokens.back() == "extern")
|
||||||
return mExtTokens[mExtTokens.size() - 3];
|
return mExtTokens[mExtTokens.size() - 3];
|
||||||
|
@ -245,7 +245,7 @@ std::string clangastdump::AstNode::getSpelling() const
|
||||||
return mExtTokens[mExtTokens.size() - 2];
|
return mExtTokens[mExtTokens.size() - 2];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string clangastdump::AstNode::getType() const
|
std::string clangimport::AstNode::getType() const
|
||||||
{
|
{
|
||||||
if (nodeType == BinaryOperator)
|
if (nodeType == BinaryOperator)
|
||||||
return unquote(mExtTokens[mExtTokens.size() - 2]);
|
return unquote(mExtTokens[mExtTokens.size() - 2]);
|
||||||
|
@ -270,7 +270,7 @@ std::string clangastdump::AstNode::getType() const
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string clangastdump::AstNode::getTemplateParameters() const
|
std::string clangimport::AstNode::getTemplateParameters() const
|
||||||
{
|
{
|
||||||
if (children.empty() || children[0]->nodeType != TemplateArgument)
|
if (children.empty() || children[0]->nodeType != TemplateArgument)
|
||||||
return "";
|
return "";
|
||||||
|
@ -287,7 +287,7 @@ std::string clangastdump::AstNode::getTemplateParameters() const
|
||||||
return templateParameters + ">";
|
return templateParameters + ">";
|
||||||
}
|
}
|
||||||
|
|
||||||
void clangastdump::AstNode::dumpAst(int num, int indent) const
|
void clangimport::AstNode::dumpAst(int num, int indent) const
|
||||||
{
|
{
|
||||||
(void)num;
|
(void)num;
|
||||||
std::cout << std::string(indent, ' ') << nodeType;
|
std::cout << std::string(indent, ' ') << nodeType;
|
||||||
|
@ -302,7 +302,7 @@ void clangastdump::AstNode::dumpAst(int num, int indent) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void clangastdump::AstNode::setLocations(TokenList *tokenList, int file, int line, int col)
|
void clangimport::AstNode::setLocations(TokenList *tokenList, int file, int line, int col)
|
||||||
{
|
{
|
||||||
for (const std::string &ext: mExtTokens) {
|
for (const std::string &ext: mExtTokens) {
|
||||||
if (ext.compare(0,5,"<col:") == 0)
|
if (ext.compare(0,5,"<col:") == 0)
|
||||||
|
@ -323,7 +323,7 @@ void clangastdump::AstNode::setLocations(TokenList *tokenList, int file, int lin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Token *clangastdump::AstNode::addtoken(TokenList *tokenList, const std::string &str, bool valueType)
|
Token *clangimport::AstNode::addtoken(TokenList *tokenList, const std::string &str, bool valueType)
|
||||||
{
|
{
|
||||||
const Scope *scope = getNestedInScope(tokenList);
|
const Scope *scope = getNestedInScope(tokenList);
|
||||||
tokenList->addtoken(str, mLine, mFile);
|
tokenList->addtoken(str, mLine, mFile);
|
||||||
|
@ -334,7 +334,7 @@ Token *clangastdump::AstNode::addtoken(TokenList *tokenList, const std::string &
|
||||||
return tokenList->back();
|
return tokenList->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
void clangastdump::AstNode::addTypeTokens(TokenList *tokenList, const std::string &str)
|
void clangimport::AstNode::addTypeTokens(TokenList *tokenList, const std::string &str)
|
||||||
{
|
{
|
||||||
if (str.find("\':\'") != std::string::npos) {
|
if (str.find("\':\'") != std::string::npos) {
|
||||||
addTypeTokens(tokenList, str.substr(0, str.find("\':\'") + 1));
|
addTypeTokens(tokenList, str.substr(0, str.find("\':\'") + 1));
|
||||||
|
@ -354,7 +354,7 @@ void clangastdump::AstNode::addTypeTokens(TokenList *tokenList, const std::strin
|
||||||
addtoken(tokenList, s, false);
|
addtoken(tokenList, s, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Scope *clangastdump::AstNode::getNestedInScope(TokenList *tokenList)
|
const Scope *clangimport::AstNode::getNestedInScope(TokenList *tokenList)
|
||||||
{
|
{
|
||||||
if (!tokenList->back())
|
if (!tokenList->back())
|
||||||
return &mData->mSymbolDatabase->scopeList.front();
|
return &mData->mSymbolDatabase->scopeList.front();
|
||||||
|
@ -363,7 +363,7 @@ const Scope *clangastdump::AstNode::getNestedInScope(TokenList *tokenList)
|
||||||
return tokenList->back()->scope();
|
return tokenList->back()->scope();
|
||||||
}
|
}
|
||||||
|
|
||||||
void clangastdump::AstNode::setValueType(Token *tok)
|
void clangimport::AstNode::setValueType(Token *tok)
|
||||||
{
|
{
|
||||||
const std::string &type = getType();
|
const std::string &type = getType();
|
||||||
|
|
||||||
|
@ -397,13 +397,13 @@ void clangastdump::AstNode::setValueType(Token *tok)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Scope *clangastdump::AstNode::createScope(TokenList *tokenList, Scope::ScopeType scopeType, AstNodePtr astNode)
|
Scope *clangimport::AstNode::createScope(TokenList *tokenList, Scope::ScopeType scopeType, AstNodePtr astNode)
|
||||||
{
|
{
|
||||||
std::vector<AstNodePtr> children{astNode};
|
std::vector<AstNodePtr> children{astNode};
|
||||||
return createScope(tokenList, scopeType, children);
|
return createScope(tokenList, scopeType, children);
|
||||||
}
|
}
|
||||||
|
|
||||||
Scope *clangastdump::AstNode::createScope(TokenList *tokenList, Scope::ScopeType scopeType, const std::vector<AstNodePtr> &children)
|
Scope *clangimport::AstNode::createScope(TokenList *tokenList, Scope::ScopeType scopeType, const std::vector<AstNodePtr> &children)
|
||||||
{
|
{
|
||||||
SymbolDatabase *symbolDatabase = mData->mSymbolDatabase;
|
SymbolDatabase *symbolDatabase = mData->mSymbolDatabase;
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ Scope *clangastdump::AstNode::createScope(TokenList *tokenList, Scope::ScopeType
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
Token *clangastdump::AstNode::createTokens(TokenList *tokenList)
|
Token *clangimport::AstNode::createTokens(TokenList *tokenList)
|
||||||
{
|
{
|
||||||
if (nodeType == ArraySubscriptExpr) {
|
if (nodeType == ArraySubscriptExpr) {
|
||||||
Token *array = children[0]->createTokens(tokenList);
|
Token *array = children[0]->createTokens(tokenList);
|
||||||
|
@ -716,7 +716,7 @@ Token *clangastdump::AstNode::createTokens(TokenList *tokenList)
|
||||||
return addtoken(tokenList, "?" + nodeType + "?");
|
return addtoken(tokenList, "?" + nodeType + "?");
|
||||||
}
|
}
|
||||||
|
|
||||||
Token * clangastdump::AstNode::createTokensCall(TokenList *tokenList)
|
Token * clangimport::AstNode::createTokensCall(TokenList *tokenList)
|
||||||
{
|
{
|
||||||
int firstParam;
|
int firstParam;
|
||||||
Token *f;
|
Token *f;
|
||||||
|
@ -752,7 +752,7 @@ Token * clangastdump::AstNode::createTokensCall(TokenList *tokenList)
|
||||||
return par1;
|
return par1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clangastdump::AstNode::createTokensFunctionDecl(TokenList *tokenList)
|
void clangimport::AstNode::createTokensFunctionDecl(TokenList *tokenList)
|
||||||
{
|
{
|
||||||
SymbolDatabase *symbolDatabase = mData->mSymbolDatabase;
|
SymbolDatabase *symbolDatabase = mData->mSymbolDatabase;
|
||||||
const int nameIndex = (mExtTokens.back() == "extern") ?
|
const int nameIndex = (mExtTokens.back() == "extern") ?
|
||||||
|
@ -804,7 +804,7 @@ void clangastdump::AstNode::createTokensFunctionDecl(TokenList *tokenList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void clangastdump::AstNode::createTokensForCXXRecord(TokenList *tokenList)
|
void clangimport::AstNode::createTokensForCXXRecord(TokenList *tokenList)
|
||||||
{
|
{
|
||||||
Token *classToken = addtoken(tokenList, "class");
|
Token *classToken = addtoken(tokenList, "class");
|
||||||
const std::string className = mExtTokens[mExtTokens.size() - 2] + getTemplateParameters();
|
const std::string className = mExtTokens[mExtTokens.size() - 2] + getTemplateParameters();
|
||||||
|
@ -827,7 +827,7 @@ void clangastdump::AstNode::createTokensForCXXRecord(TokenList *tokenList)
|
||||||
scope->definedType = &mData->mSymbolDatabase->typeList.back();
|
scope->definedType = &mData->mSymbolDatabase->typeList.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
Token * clangastdump::AstNode::createTokensVarDecl(TokenList *tokenList)
|
Token * clangimport::AstNode::createTokensVarDecl(TokenList *tokenList)
|
||||||
{
|
{
|
||||||
const std::string addr = mExtTokens.front();
|
const std::string addr = mExtTokens.front();
|
||||||
int typeIndex = mExtTokens.size() - 1;
|
int typeIndex = mExtTokens.size() - 1;
|
||||||
|
@ -850,7 +850,7 @@ Token * clangastdump::AstNode::createTokensVarDecl(TokenList *tokenList)
|
||||||
return vartok1;
|
return vartok1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clangastdump::parseClangAstDump(Tokenizer *tokenizer, std::istream &f)
|
void clangimport::parseClangAstDump(Tokenizer *tokenizer, std::istream &f)
|
||||||
{
|
{
|
||||||
TokenList *tokenList = &tokenizer->list;
|
TokenList *tokenList = &tokenizer->list;
|
||||||
|
|
||||||
|
@ -859,7 +859,7 @@ void clangastdump::parseClangAstDump(Tokenizer *tokenizer, std::istream &f)
|
||||||
symbolDatabase->scopeList.push_back(Scope(nullptr, nullptr, nullptr));
|
symbolDatabase->scopeList.push_back(Scope(nullptr, nullptr, nullptr));
|
||||||
symbolDatabase->scopeList.back().type = Scope::ScopeType::eGlobal;
|
symbolDatabase->scopeList.back().type = Scope::ScopeType::eGlobal;
|
||||||
|
|
||||||
clangastdump::Data data;
|
clangimport::Data data;
|
||||||
data.mSymbolDatabase = symbolDatabase;
|
data.mSymbolDatabase = symbolDatabase;
|
||||||
std::string line;
|
std::string line;
|
||||||
std::vector<AstNodePtr> tree;
|
std::vector<AstNodePtr> tree;
|
|
@ -18,19 +18,16 @@
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
#ifndef clangastdumpH
|
#ifndef clangimportH
|
||||||
#define clangastdumpH
|
#define clangimportH
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <string>
|
#include <istream>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
class Tokenizer;
|
class Tokenizer;
|
||||||
|
|
||||||
namespace clangastdump {
|
namespace clangimport {
|
||||||
|
|
||||||
void parseClangAstDump(Tokenizer *tokenizer, std::istream &f);
|
void parseClangAstDump(Tokenizer *tokenizer, std::istream &f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
#include "checkunusedfunctions.h"
|
#include "checkunusedfunctions.h"
|
||||||
#include "clangastdump.h"
|
#include "clangimport.h"
|
||||||
#include "ctu.h"
|
#include "ctu.h"
|
||||||
#include "library.h"
|
#include "library.h"
|
||||||
#include "mathlib.h"
|
#include "mathlib.h"
|
||||||
|
@ -282,7 +282,7 @@ unsigned int CppCheck::check(const std::string &path)
|
||||||
std::istringstream ast(res.second);
|
std::istringstream ast(res.second);
|
||||||
Tokenizer tokenizer(&mSettings, this);
|
Tokenizer tokenizer(&mSettings, this);
|
||||||
tokenizer.list.appendFileIfNew(path);
|
tokenizer.list.appendFileIfNew(path);
|
||||||
clangastdump::parseClangAstDump(&tokenizer, ast);
|
clangimport::parseClangAstDump(&tokenizer, ast);
|
||||||
//ValueFlow::setValues(&tokenizer.list, const_cast<SymbolDatabase *>(tokenizer.getSymbolDatabase()), this, &mSettings);
|
//ValueFlow::setValues(&tokenizer.list, const_cast<SymbolDatabase *>(tokenizer.getSymbolDatabase()), this, &mSettings);
|
||||||
if (mSettings.debugnormal)
|
if (mSettings.debugnormal)
|
||||||
tokenizer.printDebugOutput(1);
|
tokenizer.printDebugOutput(1);
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
<ClCompile Include="checkunusedfunctions.cpp" />
|
<ClCompile Include="checkunusedfunctions.cpp" />
|
||||||
<ClCompile Include="checkunusedvar.cpp" />
|
<ClCompile Include="checkunusedvar.cpp" />
|
||||||
<ClCompile Include="checkvaarg.cpp" />
|
<ClCompile Include="checkvaarg.cpp" />
|
||||||
<ClCompile Include="clangastdump.cpp" />
|
<ClCompile Include="clangimport.cpp" />
|
||||||
<ClCompile Include="cppcheck.cpp" />
|
<ClCompile Include="cppcheck.cpp" />
|
||||||
<ClCompile Include="ctu.cpp" />
|
<ClCompile Include="ctu.cpp" />
|
||||||
<ClCompile Include="errorlogger.cpp" />
|
<ClCompile Include="errorlogger.cpp" />
|
||||||
|
@ -129,7 +129,7 @@
|
||||||
<ClInclude Include="checkunusedfunctions.h" />
|
<ClInclude Include="checkunusedfunctions.h" />
|
||||||
<ClInclude Include="checkunusedvar.h" />
|
<ClInclude Include="checkunusedvar.h" />
|
||||||
<ClInclude Include="checkvaarg.h" />
|
<ClInclude Include="checkvaarg.h" />
|
||||||
<ClInclude Include="clangastdump.h" />
|
<ClInclude Include="clangimport.h" />
|
||||||
<ClInclude Include="config.h" />
|
<ClInclude Include="config.h" />
|
||||||
<ClInclude Include="cppcheck.h" />
|
<ClInclude Include="cppcheck.h" />
|
||||||
<ClInclude Include="ctu.h" />
|
<ClInclude Include="ctu.h" />
|
||||||
|
|
|
@ -167,7 +167,7 @@
|
||||||
<ClCompile Include="programmemory.cpp">
|
<ClCompile Include="programmemory.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="clangastdump.cpp">
|
<ClCompile Include="clangimport.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -328,7 +328,7 @@
|
||||||
<ClInclude Include="ctu.h">
|
<ClInclude Include="ctu.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="clangastdump.h">
|
<ClInclude Include="clangimport.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -31,7 +31,7 @@ HEADERS += $${PWD}/analyzerinfo.h \
|
||||||
$${PWD}/checkunusedfunctions.h \
|
$${PWD}/checkunusedfunctions.h \
|
||||||
$${PWD}/checkunusedvar.h \
|
$${PWD}/checkunusedvar.h \
|
||||||
$${PWD}/checkvaarg.h \
|
$${PWD}/checkvaarg.h \
|
||||||
$${PWD}/clangastdump.h \
|
$${PWD}/clangimport.h \
|
||||||
$${PWD}/cppcheck.h \
|
$${PWD}/cppcheck.h \
|
||||||
$${PWD}/ctu.h \
|
$${PWD}/ctu.h \
|
||||||
$${PWD}/errorlogger.h \
|
$${PWD}/errorlogger.h \
|
||||||
|
@ -83,7 +83,7 @@ SOURCES += $${PWD}/analyzerinfo.cpp \
|
||||||
$${PWD}/checkunusedfunctions.cpp \
|
$${PWD}/checkunusedfunctions.cpp \
|
||||||
$${PWD}/checkunusedvar.cpp \
|
$${PWD}/checkunusedvar.cpp \
|
||||||
$${PWD}/checkvaarg.cpp \
|
$${PWD}/checkvaarg.cpp \
|
||||||
$${PWD}/clangastdump.cpp \
|
$${PWD}/clangimport.cpp \
|
||||||
$${PWD}/cppcheck.cpp \
|
$${PWD}/cppcheck.cpp \
|
||||||
$${PWD}/ctu.cpp \
|
$${PWD}/ctu.cpp \
|
||||||
$${PWD}/errorlogger.cpp \
|
$${PWD}/errorlogger.cpp \
|
||||||
|
|
|
@ -14,16 +14,16 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "clangastdump.h"
|
#include "clangimport.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "tokenize.h"
|
#include "tokenize.h"
|
||||||
#include "testsuite.h"
|
#include "testsuite.h"
|
||||||
|
|
||||||
|
|
||||||
class TestClangAstDump: public TestFixture {
|
class TestClangImport: public TestFixture {
|
||||||
public:
|
public:
|
||||||
TestClangAstDump()
|
TestClangImport()
|
||||||
:TestFixture("TestClangAstDump") {
|
:TestFixture("TestClangImport") {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ private:
|
||||||
Settings settings;
|
Settings settings;
|
||||||
Tokenizer tokenizer(&settings, this);
|
Tokenizer tokenizer(&settings, this);
|
||||||
std::istringstream istr(clang);
|
std::istringstream istr(clang);
|
||||||
clangastdump::parseClangAstDump(&tokenizer, istr);
|
clangimport::parseClangAstDump(&tokenizer, istr);
|
||||||
return tokenizer.tokens()->stringifyList(true, false, false, true, false);
|
return tokenizer.tokens()->stringifyList(true, false, false, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,4 +485,4 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
REGISTER_TEST(TestClangAstDump)
|
REGISTER_TEST(TestClangImport)
|
Loading…
Reference in New Issue