[cfe-dev] ExternCSystem semantics question

Dave Lee via cfe-dev cfe-dev at lists.llvm.org
Sun May 21 13:09:25 PDT 2017


For include paths marked C_ExternCSystem, is it expected that their header
files will be processed with an implicit extern "C" {} block? If so, this
is currently not working. I've attached a failing test.

I also looked through the code and I don't see where C_ExternCSystem is
treated differently from C_System. I changed the definition:
C_ExternCSystem = C_System and then ran ninja check-clang and there were no
failures.

thanks,
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170521/33b63f39/attachment.html>
-------------- next part --------------
diff --git a/test/CodeGenCXX/Inputs/externc/c_function.h b/test/CodeGenCXX/Inputs/externc/c_function.h
new file mode 100644
index 0000000000..65da19ffc1
--- /dev/null
+++ b/test/CodeGenCXX/Inputs/externc/c_function.h
@@ -0,0 +1 @@
+void c_function();
diff --git a/test/CodeGenCXX/extern-c-isystem.cpp b/test/CodeGenCXX/extern-c-isystem.cpp
new file mode 100644
index 0000000000..8bf0c937f4
--- /dev/null
+++ b/test/CodeGenCXX/extern-c-isystem.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -triple i686-unknown-linux -emit-llvm -internal-externc-isystem %S/Inputs/externc -o - %s | FileCheck %s
+
+#include "c_function.h"
+
+void f() { c_function(); }
+
+// CHECK-NOT: call void @_Z10c_functionv()
+// CHECK: call void @c_function()


More information about the cfe-dev mailing list