Skip to content

Commit

Permalink
Add source_location test
Browse files Browse the repository at this point in the history
  • Loading branch information
devajithvs authored and jenkins committed Jan 17, 2024
1 parent 254f3d5 commit 67a4153
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/Prompt/ValuePrinter/SourceLocation.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//------------------------------------------------------------------------------
// CLING - the C++ LLVM-based InterpreterG :)
//
// This file is dual-licensed: you can choose to license it under the University
// of Illinois Open Source License or the GNU Lesser General Public License. See
// LICENSE.TXT for details.

//------------------------------------------------------------------------------
// RUN: cat %s | %cling | FileCheck %s

#include <iostream>
#if __cplusplus >= 202002L
#include <version>
#endif

#ifndef __cpp_lib_source_location
// Hack to prevent failure if __cpp_lib_source_location feature does not exist!
std::cout << "(std::source_location) ";
std::cout << "CHECK_SRCLOC:42:std::source_location getsrcloc()\n";
#else
#include <source_location>
std::source_location getsrcloc() {
#line 42 "CHECK_SRCLOC"
return std::source_location::current();
}
getsrcloc()
#endif
// CHECK: (std::source_location)
// CHECK: CHECK_SRCLOC:42:std::source_location getsrcloc()

0 comments on commit 67a4153

Please sign in to comment.