mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-10 18:45:26 +02:00
Cosmetics.
This commit is contained in:
parent
83c26578b8
commit
4545b4c873
6 changed files with 45 additions and 28 deletions
|
@ -167,7 +167,7 @@ public abstract class ASTNode implements IASTNode {
|
||||||
if (floc != null && ast != null) {
|
if (floc != null && ast != null) {
|
||||||
ILocationResolver lr= (ILocationResolver) ast.getAdapter(ILocationResolver.class);
|
ILocationResolver lr= (ILocationResolver) ast.getAdapter(ILocationResolver.class);
|
||||||
if (lr != null) {
|
if (lr != null) {
|
||||||
return lr.getUnpreprocessedSignature(getFileLocation());
|
return lr.getUnpreprocessedSignature(floc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CharArrayUtils.EMPTY;
|
return CharArrayUtils.EMPTY;
|
||||||
|
|
|
@ -31,7 +31,9 @@ import org.eclipse.cdt.internal.core.dom.Linkage;
|
||||||
class ASTPreprocessorName extends ASTPreprocessorNode implements IASTName {
|
class ASTPreprocessorName extends ASTPreprocessorNode implements IASTName {
|
||||||
private final char[] fName;
|
private final char[] fName;
|
||||||
private final IBinding fBinding;
|
private final IBinding fBinding;
|
||||||
public ASTPreprocessorName(IASTNode parent, ASTNodeProperty property, int startNumber, int endNumber, char[] name, IBinding binding) {
|
|
||||||
|
public ASTPreprocessorName(IASTNode parent, ASTNodeProperty property, int startNumber,
|
||||||
|
int endNumber, char[] name, IBinding binding) {
|
||||||
super(parent, property, startNumber, endNumber);
|
super(parent, property, startNumber, endNumber);
|
||||||
fName= name;
|
fName= name;
|
||||||
fBinding= binding;
|
fBinding= binding;
|
||||||
|
@ -41,31 +43,38 @@ class ASTPreprocessorName extends ASTPreprocessorNode implements IASTName {
|
||||||
public IBinding resolveBinding() {
|
public IBinding resolveBinding() {
|
||||||
return fBinding;
|
return fBinding;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBinding resolvePreBinding() {
|
public IBinding resolvePreBinding() {
|
||||||
return fBinding;
|
return fBinding;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBinding getBinding() {
|
public IBinding getBinding() {
|
||||||
return fBinding;
|
return fBinding;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBinding getPreBinding() {
|
public IBinding getPreBinding() {
|
||||||
return fBinding;
|
return fBinding;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ILinkage getLinkage() {
|
public ILinkage getLinkage() {
|
||||||
final IASTTranslationUnit tu= getTranslationUnit();
|
final IASTTranslationUnit tu= getTranslationUnit();
|
||||||
return tu == null ? Linkage.NO_LINKAGE : tu.getLinkage();
|
return tu == null ? Linkage.NO_LINKAGE : tu.getLinkage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTCompletionContext getCompletionContext() {
|
public IASTCompletionContext getCompletionContext() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDeclaration() {
|
public boolean isDeclaration() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDefinition() {
|
public boolean isDefinition() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -74,14 +83,17 @@ class ASTPreprocessorName extends ASTPreprocessorNode implements IASTName {
|
||||||
public boolean isReference() {
|
public boolean isReference() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char[] toCharArray() {
|
public char[] toCharArray() {
|
||||||
return fName;
|
return fName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char[] getSimpleID() {
|
public char[] getSimpleID() {
|
||||||
return fName;
|
return fName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char[] getLookupKey() {
|
public char[] getLookupKey() {
|
||||||
return fName;
|
return fName;
|
||||||
|
@ -91,6 +103,7 @@ class ASTPreprocessorName extends ASTPreprocessorNode implements IASTName {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new String(fName);
|
return new String(fName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBinding(IBinding binding) {assert false;}
|
public void setBinding(IBinding binding) {assert false;}
|
||||||
|
|
||||||
|
@ -98,14 +111,17 @@ class ASTPreprocessorName extends ASTPreprocessorNode implements IASTName {
|
||||||
public int getRoleOfName(boolean allowResolution) {
|
public int getRoleOfName(boolean allowResolution) {
|
||||||
return IASTNameOwner.r_unclear;
|
return IASTNameOwner.r_unclear;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTName getLastName() {
|
public IASTName getLastName() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isQualified() {
|
public boolean isQualified() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTName copy() {
|
public IASTName copy() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
@ -134,11 +150,11 @@ class ASTPreprocessorDefinition extends ASTPreprocessorName {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ASTBuiltinName extends ASTPreprocessorDefinition {
|
class ASTBuiltinName extends ASTPreprocessorDefinition {
|
||||||
private final IASTFileLocation fFileLocation;
|
private final IASTFileLocation fFileLocation;
|
||||||
|
|
||||||
public ASTBuiltinName(IASTNode parent, ASTNodeProperty property, IASTFileLocation floc, char[] name, IBinding binding) {
|
public ASTBuiltinName(IASTNode parent, ASTNodeProperty property, IASTFileLocation floc,
|
||||||
|
char[] name, IBinding binding) {
|
||||||
super(parent, property, -1, -1, name, binding);
|
super(parent, property, -1, -1, name, binding);
|
||||||
fFileLocation= floc;
|
fFileLocation= floc;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +197,8 @@ class ASTBuiltinName extends ASTPreprocessorDefinition {
|
||||||
class ASTMacroReferenceName extends ASTPreprocessorName {
|
class ASTMacroReferenceName extends ASTPreprocessorName {
|
||||||
private ImageLocationInfo fImageLocationInfo;
|
private ImageLocationInfo fImageLocationInfo;
|
||||||
|
|
||||||
public ASTMacroReferenceName(IASTNode parent, ASTNodeProperty property, int offset, int endOffset, IMacroBinding macro, ImageLocationInfo imgLocationInfo) {
|
public ASTMacroReferenceName(IASTNode parent, ASTNodeProperty property,
|
||||||
|
int offset, int endOffset, IMacroBinding macro, ImageLocationInfo imgLocationInfo) {
|
||||||
super(parent, property, offset, endOffset, macro.getNameCharArray(), macro);
|
super(parent, property, offset, endOffset, macro.getNameCharArray(), macro);
|
||||||
fImageLocationInfo= imgLocationInfo;
|
fImageLocationInfo= imgLocationInfo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -509,7 +509,6 @@ class ASTMacroDefinition extends ASTPreprocessorNode implements IASTPreprocessor
|
||||||
fExpansionOffset= expansionOffset;
|
fExpansionOffset= expansionOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getContainingFilename() {
|
public String getContainingFilename() {
|
||||||
if (fName instanceof ASTBuiltinName) {
|
if (fName instanceof ASTBuiltinName) {
|
||||||
|
@ -534,7 +533,7 @@ class ASTMacroDefinition extends ASTPreprocessorNode implements IASTPreprocessor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRoleForName(IASTName n) {
|
public int getRoleForName(IASTName n) {
|
||||||
return (fName == n) ? r_definition : r_unclear;
|
return fName == n ? r_definition : r_unclear;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -545,6 +544,7 @@ class ASTMacroDefinition extends ASTPreprocessorNode implements IASTPreprocessor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setExpansion(String exp) {assert false;}
|
public void setExpansion(String exp) {assert false;}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setName(IASTName name) {assert false;}
|
public void setName(IASTName name) {assert false;}
|
||||||
|
|
||||||
|
|
|
@ -1930,8 +1930,8 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
}
|
}
|
||||||
final boolean contentAssist = fContentAssistLimit >= 0 && fCurrentContext == fRootContext;
|
final boolean contentAssist = fContentAssistLimit >= 0 && fCurrentContext == fRootContext;
|
||||||
final ITokenSequence input= stopAtNewline ? fLineInputToMacroExpansion : fInputToMacroExpansion;
|
final ITokenSequence input= stopAtNewline ? fLineInputToMacroExpansion : fInputToMacroExpansion;
|
||||||
final MacroExpander expander = withinExpansion ? new MacroExpander(this, fMacroDictionary,
|
final MacroExpander expander = withinExpansion ?
|
||||||
fLocationMap, fLexOptions) : fMacroExpander;
|
new MacroExpander(this, fMacroDictionary, fLocationMap, fLexOptions) : fMacroExpander;
|
||||||
TokenList replacement= expander.expand(input, options, macro, identifier, contentAssist, fCurrentContext);
|
TokenList replacement= expander.expand(input, options, macro, identifier, contentAssist, fCurrentContext);
|
||||||
final IASTName[] expansions= expander.clearImplicitExpansions();
|
final IASTName[] expansions= expander.clearImplicitExpansions();
|
||||||
final ImageLocationInfo[] ili= expander.clearImageLocationInfos();
|
final ImageLocationInfo[] ili= expander.clearImageLocationInfos();
|
||||||
|
|
|
@ -57,12 +57,12 @@ public class LocationMap implements ILocationResolver {
|
||||||
private ArrayList<ASTMacroDefinition> fBuiltinMacros= new ArrayList<ASTMacroDefinition>();
|
private ArrayList<ASTMacroDefinition> fBuiltinMacros= new ArrayList<ASTMacroDefinition>();
|
||||||
private ArrayList<ASTPreprocessorName> fMacroReferences= new ArrayList<ASTPreprocessorName>();
|
private ArrayList<ASTPreprocessorName> fMacroReferences= new ArrayList<ASTPreprocessorName>();
|
||||||
|
|
||||||
private LocationCtxFile fRootContext= null;
|
private LocationCtxFile fRootContext;
|
||||||
private LocationCtx fCurrentContext= null;
|
private LocationCtx fCurrentContext;
|
||||||
private int fLastChildInsertionOffset;
|
private int fLastChildInsertionOffset;
|
||||||
|
|
||||||
// stuff computed on demand
|
// stuff computed on demand
|
||||||
private IdentityHashMap<IBinding, IASTPreprocessorMacroDefinition> fMacroDefinitionMap= null;
|
private IdentityHashMap<IBinding, IASTPreprocessorMacroDefinition> fMacroDefinitionMap;
|
||||||
private List<ISkippedIndexedFilesListener> fSkippedFilesListeners= new ArrayList<ISkippedIndexedFilesListener>();
|
private List<ISkippedIndexedFilesListener> fSkippedFilesListeners= new ArrayList<ISkippedIndexedFilesListener>();
|
||||||
|
|
||||||
public LocationMap(LexerOptions lexOptions) {
|
public LocationMap(LexerOptions lexOptions) {
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class MultiMacroExpansionExplorer extends MacroExpansionExplorer {
|
||||||
fOffset= offset;
|
fOffset= offset;
|
||||||
fLength= length;
|
fLength= length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNodeOffset() { return fOffset; }
|
public int getNodeOffset() { return fOffset; }
|
||||||
@Override
|
@Override
|
||||||
|
@ -200,7 +201,6 @@ public class MultiMacroExpansionExplorer extends MacroExpansionExplorer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getExpansionStepCount() {
|
public int getExpansionStepCount() {
|
||||||
int result= 0;
|
int result= 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue