diff options
author | Josh Gao <jmgao@google.com> | 2017-11-06 17:15:47 -0800 |
---|---|---|
committer | Josh Gao <jmgao@google.com> | 2017-11-06 17:23:36 -0800 |
commit | 8e13b67c64df389ce72bcb02ab3e1888da48f254 (patch) | |
tree | 267672ca0200e822e6139271abd404893880e754 /tools/versioner/tests/preprocessor_extern_cpp/expected/foo.h | |
parent | db4f3346958684424815720ca00a56c75fc536e0 (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/expected/foo.h')
-rw-r--r-- | tools/versioner/tests/preprocessor_extern_cpp/expected/foo.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/versioner/tests/preprocessor_extern_cpp/expected/foo.h b/tools/versioner/tests/preprocessor_extern_cpp/expected/foo.h new file mode 100644 index 000000000..9b2d122c9 --- /dev/null +++ b/tools/versioner/tests/preprocessor_extern_cpp/expected/foo.h @@ -0,0 +1,27 @@ +#define __RENAME(x) asm(#x) + +#if defined(__cplusplus) + +#if __ANDROID_API__ >= 24 +extern "C++" const char* strchrnul(const char*, int) __RENAME(strchrnul) __INTRODUCED_IN(24); +#endif /* __ANDROID_API__ >= 24 */ + +#endif + +#if defined(__cplusplus) +extern "C" int foo(); +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + + +#if __ANDROID_API__ >= 24 +char* strchrnul(char*, int) __INTRODUCED_IN(24); +#endif /* __ANDROID_API__ >= 24 */ + + +#if defined(__cplusplus) +} +#endif |