This revision was automatically updated to reflect the committed changes.
Closed by commit rC320696: [Frontend] Treat function with skipped body as 
definition (authored by ibiryukov, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D41189?vs=126787&id=126932#toc

Repository:
  rC Clang

https://reviews.llvm.org/D41189

Files:
  include/clang/AST/Decl.h
  test/Index/skipped_function_bodies.cpp


Index: include/clang/AST/Decl.h
===================================================================
--- include/clang/AST/Decl.h
+++ include/clang/AST/Decl.h
@@ -1967,8 +1967,8 @@
   /// This does not determine whether the function has been defined (e.g., in a
   /// previous definition); for that information, use isDefined.
   bool isThisDeclarationADefinition() const {
-    return IsDeleted || IsDefaulted || Body || IsLateTemplateParsed ||
-      WillHaveBody || hasDefiningAttr();
+    return IsDeleted || IsDefaulted || Body || HasSkippedBody ||
+           IsLateTemplateParsed || WillHaveBody || hasDefiningAttr();
   }
 
   /// doesThisDeclarationHaveABody - Returns whether this specific
Index: test/Index/skipped_function_bodies.cpp
===================================================================
--- test/Index/skipped_function_bodies.cpp
+++ test/Index/skipped_function_bodies.cpp
@@ -0,0 +1,9 @@
+// RUN: env CINDEXTEST_SKIP_FUNCTION_BODIES=1 c-index-test -test-load-source 
all %s 2>&1 \
+// RUN: | FileCheck %s
+
+inline int with_body() { return 10; }
+inline int without_body();
+
+int x = with_body() + without_body();
+// CHECK: warning: inline function 'without_body' is not defined
+// CHECK-NOT: warning: inline function 'with_body' is not defined


Index: include/clang/AST/Decl.h
===================================================================
--- include/clang/AST/Decl.h
+++ include/clang/AST/Decl.h
@@ -1967,8 +1967,8 @@
   /// This does not determine whether the function has been defined (e.g., in a
   /// previous definition); for that information, use isDefined.
   bool isThisDeclarationADefinition() const {
-    return IsDeleted || IsDefaulted || Body || IsLateTemplateParsed ||
-      WillHaveBody || hasDefiningAttr();
+    return IsDeleted || IsDefaulted || Body || HasSkippedBody ||
+           IsLateTemplateParsed || WillHaveBody || hasDefiningAttr();
   }
 
   /// doesThisDeclarationHaveABody - Returns whether this specific
Index: test/Index/skipped_function_bodies.cpp
===================================================================
--- test/Index/skipped_function_bodies.cpp
+++ test/Index/skipped_function_bodies.cpp
@@ -0,0 +1,9 @@
+// RUN: env CINDEXTEST_SKIP_FUNCTION_BODIES=1 c-index-test -test-load-source all %s 2>&1 \
+// RUN: | FileCheck %s
+
+inline int with_body() { return 10; }
+inline int without_body();
+
+int x = with_body() + without_body();
+// CHECK: warning: inline function 'without_body' is not defined
+// CHECK-NOT: warning: inline function 'with_body' is not defined
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to