]> granicus.if.org Git - clang/commit
Implement __builtin_LINE() et. al. to support source location capture.
authorEric Fiselier <eric@efcs.ca>
Thu, 16 May 2019 21:04:15 +0000 (21:04 +0000)
committerEric Fiselier <eric@efcs.ca>
Thu, 16 May 2019 21:04:15 +0000 (21:04 +0000)
commitc786ab0af6ba5928e93d45f7a7b4d44050b94a91
tree77da207262a8915c422484a4b70c6a8f25948352
parent197e8c7ceb8394e1f74b98c3a9024804e35531fa
Implement __builtin_LINE() et. al. to support source location capture.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360937 91177308-0d34-0410-b5e6-96231b3b80d8
44 files changed:
docs/LanguageExtensions.rst
include/clang/AST/ASTContext.h
include/clang/AST/CurrentSourceLocExprScope.h [new file with mode: 0644]
include/clang/AST/Expr.h
include/clang/AST/ExprCXX.h
include/clang/AST/RecursiveASTVisitor.h
include/clang/AST/Stmt.h
include/clang/Basic/StmtNodes.td
include/clang/Basic/TokenKinds.def
include/clang/Sema/Sema.h
include/clang/Serialization/ASTBitCodes.h
lib/AST/ASTContext.cpp
lib/AST/ASTImporter.cpp
lib/AST/Expr.cpp
lib/AST/ExprCXX.cpp
lib/AST/ExprClassification.cpp
lib/AST/ExprConstant.cpp
lib/AST/ItaniumMangle.cpp
lib/AST/StmtPrinter.cpp
lib/AST/StmtProfile.cpp
lib/CodeGen/CGExpr.cpp
lib/CodeGen/CGExprAgg.cpp
lib/CodeGen/CGExprComplex.cpp
lib/CodeGen/CGExprConstant.cpp
lib/CodeGen/CGExprScalar.cpp
lib/CodeGen/CodeGenFunction.h
lib/Parse/ParseExpr.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaExceptionSpec.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaExprObjC.cpp
lib/Sema/TreeTransform.h
lib/Serialization/ASTReaderStmt.cpp
lib/Serialization/ASTWriterStmt.cpp
lib/StaticAnalyzer/Core/ExprEngine.cpp
test/CodeGenCXX/builtin-source-location.cpp [new file with mode: 0644]
test/CodeGenCXX/builtin_FUNCTION.cpp [new file with mode: 0644]
test/CodeGenCXX/builtin_LINE.cpp [new file with mode: 0644]
test/CodeGenCXX/debug-info-line.cpp
test/Parser/builtin_source_location.c [new file with mode: 0644]
test/Sema/source_location.c [new file with mode: 0644]
test/SemaCXX/Inputs/source-location-file.h [new file with mode: 0644]
test/SemaCXX/source_location.cpp [new file with mode: 0644]
tools/libclang/CXCursor.cpp