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