summaryrefslogtreecommitdiffstats
path: root/tests/c/libbuiltins.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/c/libbuiltins.c')
-rw-r--r--tests/c/libbuiltins.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/c/libbuiltins.c b/tests/c/libbuiltins.c
new file mode 100644
index 0000000..4ba3033
--- /dev/null
+++ b/tests/c/libbuiltins.c
@@ -0,0 +1,34 @@
+//===--- libbuiltins.c - test input file for iwyu -------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Library builtins are, like normal builtins, compiled down to an intrinsic,
+// but a header still needs to be included for the program to be valid. The math
+// library (pow, round, etc) is a typical example.
+
+// IWYU_ARGS: -I .
+
+#include "tests/c/libbuiltins-direct.h"
+
+float kapow(float x) {
+ // IWYU: pow is...*math.h
+ return pow(x, 2.0F);
+}
+
+/**** IWYU_SUMMARY
+
+tests/c/libbuiltins.c should add these lines:
+#include <math.h>
+
+tests/c/libbuiltins.c should remove these lines:
+- #include "tests/c/libbuiltins-direct.h" // lines XX-XX
+
+The full include-list for tests/c/libbuiltins.c:
+#include <math.h> // for pow
+
+***** IWYU_SUMMARY */