Simplify complex/_Complex types (#6939)
This commit is contained in:
parent
c8c59aa92b
commit
37aec52399
|
@ -381,6 +381,12 @@ public:
|
||||||
void isOperatorKeyword(bool value) {
|
void isOperatorKeyword(bool value) {
|
||||||
setFlag(fIsOperatorKeyword, value);
|
setFlag(fIsOperatorKeyword, value);
|
||||||
}
|
}
|
||||||
|
bool isComplex() const {
|
||||||
|
return getFlag(fIsComplex);
|
||||||
|
}
|
||||||
|
void isComplex(bool value) {
|
||||||
|
setFlag(fIsComplex, value);
|
||||||
|
}
|
||||||
|
|
||||||
static const Token *findsimplematch(const Token *tok, const char pattern[]);
|
static const Token *findsimplematch(const Token *tok, const char pattern[]);
|
||||||
static const Token *findsimplematch(const Token *tok, const char pattern[], const Token *end);
|
static const Token *findsimplematch(const Token *tok, const char pattern[], const Token *end);
|
||||||
|
@ -802,7 +808,8 @@ private:
|
||||||
fIsAttributeNoreturn = (1 << 12), // __attribute__((noreturn)), __declspec(noreturn)
|
fIsAttributeNoreturn = (1 << 12), // __attribute__((noreturn)), __declspec(noreturn)
|
||||||
fIsAttributeNothrow = (1 << 13), // __attribute__((nothrow)), __declspec(nothrow)
|
fIsAttributeNothrow = (1 << 13), // __attribute__((nothrow)), __declspec(nothrow)
|
||||||
fIsAttributeUsed = (1 << 14), // __attribute__((used))
|
fIsAttributeUsed = (1 << 14), // __attribute__((used))
|
||||||
fIsOperatorKeyword = (1 << 15) // operator=, etc
|
fIsOperatorKeyword = (1 << 15), // operator=, etc
|
||||||
|
fIsComplex = (1 << 16) // complex/_Complex type
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned int _flags;
|
unsigned int _flags;
|
||||||
|
|
|
@ -5652,6 +5652,11 @@ void Tokenizer::simplifyStdType()
|
||||||
tok->isSigned(!isUnsigned);
|
tok->isSigned(!isUnsigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (Token::Match(tok, "float|double complex|_Complex")) {
|
||||||
|
tok->deleteNext();
|
||||||
|
tok->isComplex(true);
|
||||||
|
}
|
||||||
|
|
||||||
else if (!Token::Match(tok, "unsigned|signed|char|short|int|long"))
|
else if (!Token::Match(tok, "unsigned|signed|char|short|int|long"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -4590,6 +4590,11 @@ private:
|
||||||
const char expected[] = "signed short x ;";
|
const char expected[] = "signed short x ;";
|
||||||
ASSERT_EQUALS(expected, tokenizeAndStringify(code));
|
ASSERT_EQUALS(expected, tokenizeAndStringify(code));
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
const char code[] = "float complex x;";
|
||||||
|
const char expected[] = "float x ;";
|
||||||
|
ASSERT_EQUALS(expected, tokenizeAndStringify(code));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void createLinks() {
|
void createLinks() {
|
||||||
|
|
Loading…
Reference in New Issue