mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 09:25:31 +02:00
Bug 527872: UDL operator name gets duplicated on rewrite
Change-Id: Id1cda5f09f6fc3852a99a607be21f6ea33f5faf5 Signed-off-by: Hansruedi Patzen <hansruedi.patzen@hsr.ch>
This commit is contained in:
parent
6db1357b1a
commit
7d208e098f
2 changed files with 9 additions and 6 deletions
|
@ -171,3 +171,10 @@ void foo() noexcept (noexcept (1 + 1))
|
|||
void foo() noexcept (noexcept (1 + 1) && noexcept (2 + 3))
|
||||
{
|
||||
}
|
||||
|
||||
//!Basic UDL operator
|
||||
//%CPP
|
||||
constexpr long double operator ""_deg(long double deg)
|
||||
{
|
||||
return deg * 3.141592 / 180;
|
||||
}
|
||||
|
|
|
@ -913,7 +913,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
IToken ident = consume(IToken.tIDENTIFIER);
|
||||
|
||||
char[] operatorName = CharArrayUtils.concat(firstToken.getCharImage(), " ".toCharArray()); //$NON-NLS-1$
|
||||
operatorName = CharArrayUtils.concat(operatorName, strOp.getCharImage());
|
||||
operatorName = CharArrayUtils.concat(operatorName, strOp.getCharImage());
|
||||
operatorName = CharArrayUtils.concat(operatorName, ident.getCharImage());
|
||||
|
||||
IASTName name = getNodeFactory().newOperatorName(operatorName);
|
||||
|
@ -929,12 +929,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
int startQuote = image.indexOf('"');
|
||||
int endQuote = image.lastIndexOf('"');
|
||||
if (startQuote != -1 && endQuote == startQuote + 1) {
|
||||
char[] ident = image.substring(endQuote + 1).toCharArray();
|
||||
|
||||
char[] operatorName = CharArrayUtils.concat(firstToken.getCharImage(), " ".toCharArray()); //$NON-NLS-1$
|
||||
operatorName = CharArrayUtils.concat(operatorName, strOp.getCharImage());
|
||||
operatorName = CharArrayUtils.concat(operatorName, ident);
|
||||
|
||||
operatorName = CharArrayUtils.concat(operatorName, strOp.getCharImage());
|
||||
IASTName name = getNodeFactory().newOperatorName(operatorName);
|
||||
setRange(name, firstToken.getOffset(), strOp.getEndOffset());
|
||||
return name;
|
||||
|
|
Loading…
Add table
Reference in a new issue