summaryrefslogtreecommitdiff
path: root/tools/versioner/tests/preprocessor_extern_cpp/headers/foo.h
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2017-11-06 17:15:47 -0800
committerJosh Gao <jmgao@google.com>2017-11-06 17:23:36 -0800
commit8e13b67c64df389ce72bcb02ab3e1888da48f254 (patch)
tree267672ca0200e822e6139271abd404893880e754 /tools/versioner/tests/preprocessor_extern_cpp/headers/foo.h
parentdb4f3346958684424815720ca00a56c75fc536e0 (diff)
versioner: properly handle extern "C", "C++".
extern "C" and "C++" are parsed as a LinkageSpecDecl with the real Decl as a child node. This leads to the preprocessor sticking its guard between the extern specifier and the declaration. Update the AST visitor to add a special-case for calculating the SourceRange on a LinkageSpecDecl, and add a test. Bug: https://github.com/android-ndk/ndk/issues/440 Test: python run_tests.py Change-Id: I76445fe366cef46cfd2f16fb93d534d410c5edca
Diffstat (limited to 'tools/versioner/tests/preprocessor_extern_cpp/headers/foo.h')
-rw-r--r--tools/versioner/tests/preprocessor_extern_cpp/headers/foo.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/versioner/tests/preprocessor_extern_cpp/headers/foo.h b/tools/versioner/tests/preprocessor_extern_cpp/headers/foo.h
new file mode 100644
index 000000000..de26d2115
--- /dev/null
+++ b/tools/versioner/tests/preprocessor_extern_cpp/headers/foo.h
@@ -0,0 +1,19 @@
+#define __RENAME(x) asm(#x)
+
+#if defined(__cplusplus)
+extern "C++" const char* strchrnul(const char*, int) __RENAME(strchrnul) __INTRODUCED_IN(24);
+#endif
+
+#if defined(__cplusplus)
+extern "C" int foo();
+#endif
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+char* strchrnul(char*, int) __INTRODUCED_IN(24);
+
+#if defined(__cplusplus)
+}
+#endif