[PATCH] D144878: __builtin_FILE_NAME()

Aaron Ballman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 10:10:43 PDT 2023


aaron.ballman added inline comments.


================
Comment at: clang/docs/ReleaseNotes.rst:113-114
   nondeterministic value of the same type as the provided argument.
+- Clang now supports ``__builtin_FILE_NAME`` that returns a
+  ``__FILE_NAME__`` value at the "invocation point".
 
----------------



================
Comment at: clang/include/clang/AST/Expr.h:4689
 /// Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(),
-/// __builtin_FUNCTION(), __builtin_FILE(), or __builtin_source_location().
+/// __builtin_FUNCTION(), __builtin_FILE(), builtin_FILE_NAME(),
+/// or __builtin_source_location().
----------------



================
Comment at: clang/lib/AST/Expr.cpp:2283-2284
+  case SourceLocExpr::FileName: {
+    // builtin_FILE_NAME() is a Clang-specific extension that expands to the
+    // the last part of builtin_FILE().
+    SmallString<256> FileName;
----------------



================
Comment at: clang/lib/Lex/PPMacroExpansion.cpp:2000-2002
+  if (PLFileName.empty()) {
+    PLFileName = PLoc.getFilename();
+  }
----------------
Minor coding style nit.


================
Comment at: clang/lib/Parse/ParseExpr.cpp:805-816
+/// [C++11] simple-type-specifier braced-init-list [C++11 5.2.3] [C++]
+/// typename-specifier '(' expression-list[opt] ')'         [C++ 5.2.3] [C++11]
+/// typename-specifier braced-init-list                     [C++11 5.2.3] [C++]
+/// 'const_cast' '<' type-name '>' '(' expression ')'       [C++ 5.2p1] [C++]
+/// 'dynamic_cast' '<' type-name '>' '(' expression ')'     [C++ 5.2p1] [C++]
+/// 'reinterpret_cast' '<' type-name '>' '(' expression ')' [C++ 5.2p1] [C++]
+/// 'static_cast' '<' type-name '>' '(' expression ')'      [C++ 5.2p1] [C++]
----------------
It looks like the formatting here got wrecked, you should back these changes out.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144878/new/

https://reviews.llvm.org/D144878



More information about the llvm-commits mailing list