mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-23 21:45:46 -04:00

Summary: This patch implements the source location builtins `__builtin_LINE(), `__builtin_FUNCTION()`, `__builtin_FILE()` and `__builtin_COLUMN()`. These builtins are needed to implement [`std::experimental::source_location`](https://rawgit.com/cplusplus/fundamentals-ts/v2/main.html#reflection.src_loc.creation). With the exception of `__builtin_COLUMN`, GCC also implements these builtins, and Clangs behavior is intended to match as closely as possible. Reviewers: rsmith, joerg, aaron.ballman, bogner, majnemer, shafik, martong Reviewed By: rsmith Subscribers: rnkovacs, loskutov, riccibruno, mgorny, kunitoki, alexr, majnemer, hfinkel, cfe-commits Differential Revision: https://reviews.llvm.org/D37035 llvm-svn: 360937
20 lines
695 B
C
20 lines
695 B
C
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
|
|
int main() {
|
|
int line = __builtin_LINE();
|
|
__builtin_LINE(42); // expected-error {{expected ')'}}
|
|
__builtin_LINE(double); // expected-error {{expected ')'}}
|
|
|
|
int column = __builtin_COLUMN();
|
|
__builtin_COLUMN(42); // expected-error {{expected ')'}}
|
|
__builtin_COLUMN(double); // expected-error {{expected ')'}}
|
|
|
|
const char *func = __builtin_FUNCTION();
|
|
__builtin_FUNCTION(42); // expected-error {{expected ')'}}
|
|
__builtin_FUNCTION(double); // expected-error {{expected ')'}}
|
|
|
|
const char *file = __builtin_FILE();
|
|
__builtin_FILE(42); // expected-error {{expected ')'}}
|
|
__builtin_FILE(double); // expected-error {{expected ')'}}
|
|
}
|