Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2014-09-04 22:44:59 +0000
committerSergey Prigogin2014-09-04 22:50:04 +0000
commita6265b01d4cd3bef3f4f20f7a42816ebf4d846b6 (patch)
tree70dd74837cd6313630d4e267bf1e4a21103815f4
parent4fac47d2ea0b0aeb6fa882f24dece7c6fc948eb4 (diff)
downloadorg.eclipse.cdt-a6265b01d4cd3bef3f4f20f7a42816ebf4d846b6.tar.gz
org.eclipse.cdt-a6265b01d4cd3bef3f4f20f7a42816ebf4d846b6.tar.xz
org.eclipse.cdt-a6265b01d4cd3bef3f4f20f7a42816ebf4d846b6.zip
Bug 443356 - Organize Includes adds an unnecessary include for a
function referenced by a macro
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/includes/BindingClassifierTest.java10
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java2
2 files changed, 12 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/includes/BindingClassifierTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/includes/BindingClassifierTest.java
index a4f8afe32e1..c297ee96fb9 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/includes/BindingClassifierTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/includes/BindingClassifierTest.java
@@ -631,4 +631,14 @@ public class BindingClassifierTest extends OneSourceMultipleHeadersTestCase {
assertDefined("MACRO");
assertDeclared();
}
+
+ // void f(int);
+ // #define MACRO(name, arg) void name() { f(arg); }
+
+ // int bar;
+ // MACRO(foo, bar);
+ public void testMacro_4() throws Exception {
+ assertDefined("MACRO");
+ assertDeclared();
+ }
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java
index 199c09434af..8d6a20334ef 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java
@@ -693,6 +693,8 @@ public class BindingClassifier {
*/
IASTFunctionCallExpression functionCallExpression = (IASTFunctionCallExpression) expression;
IASTExpression functionNameExpression = functionCallExpression.getFunctionNameExpression();
+ if (isPartOfExternalMacroDefinition(functionNameExpression))
+ return PROCESS_CONTINUE;
IBinding binding = getBindingOfExpression(functionNameExpression);
if (binding != null) {

Back to the top