diff options
Diffstat (limited to 'tests/cxx/libbuiltins.cc')
-rw-r--r-- | tests/cxx/libbuiltins.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/cxx/libbuiltins.cc b/tests/cxx/libbuiltins.cc new file mode 100644 index 0000000..d2cdd3e --- /dev/null +++ b/tests/cxx/libbuiltins.cc @@ -0,0 +1,34 @@ +//===--- libbuiltins.cc - 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 (std::pow, std::round, etc) is a typical example. + +// IWYU_ARGS: -I . + +#include "tests/cxx/libbuiltins-direct.h" + +float kapow(float x) { + // IWYU: std::pow is...*cmath + return std::pow(x, 2.0F); +} + +/**** IWYU_SUMMARY + +tests/cxx/libbuiltins.cc should add these lines: +#include <cmath> + +tests/cxx/libbuiltins.cc should remove these lines: +- #include "tests/cxx/libbuiltins-direct.h" // lines XX-XX + +The full include-list for tests/cxx/libbuiltins.cc: +#include <cmath> // for pow + +***** IWYU_SUMMARY */ |