summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp4
-rw-r--r--clang/test/CodeGenCXX/builtin_FUNCTION.cpp8
-rw-r--r--clang/test/Preprocessor/feature_tests.c9
3 files changed, 17 insertions, 4 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 4576f1a47e1..72f8f48839d 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -1620,6 +1620,10 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
.Case("__is_target_vendor", true)
.Case("__is_target_os", true)
.Case("__is_target_environment", true)
+ .Case("__builtin_LINE", true)
+ .Case("__builtin_FILE", true)
+ .Case("__builtin_FUNCTION", true)
+ .Case("__builtin_COLUMN", true)
.Default(false);
}
});
diff --git a/clang/test/CodeGenCXX/builtin_FUNCTION.cpp b/clang/test/CodeGenCXX/builtin_FUNCTION.cpp
index b3156ea45ae..02e616351a9 100644
--- a/clang/test/CodeGenCXX/builtin_FUNCTION.cpp
+++ b/clang/test/CodeGenCXX/builtin_FUNCTION.cpp
@@ -6,7 +6,7 @@ namespace test_func {
constexpr const char *test_default_arg(const char *f = __builtin_FUNCTION()) {
return f;
}
-// CHECK: @[[EMPTY_STR:.+]] = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
+// CHECK: @[[EMPTY_STR:.+]] = private unnamed_addr constant [1 x i8] zeroinitializer
// CHECK: @_ZN9test_func6globalE = {{(dso_local )?}}global i8* getelementptr inbounds ([1 x i8], [1 x i8]* @[[EMPTY_STR]], i32 0, i32 0)
const char *global = test_default_arg();
@@ -16,9 +16,9 @@ const char *global_two = __builtin_FUNCTION();
const char * const global_three = test_default_arg();
-// CHECK: @[[STR_ONE:.+]] = private unnamed_addr constant [14 x i8] c"test_func_one\00", align 1
-// CHECK: @[[STR_TWO:.+]] = private unnamed_addr constant [14 x i8] c"test_func_two\00", align 1
-// CHECK: @[[STR_THREE:.+]] = private unnamed_addr constant [20 x i8] c"do_default_arg_test\00", align 1
+// CHECK: @[[STR_ONE:.+]] = private unnamed_addr constant [14 x i8] c"test_func_one\00"
+// CHECK: @[[STR_TWO:.+]] = private unnamed_addr constant [14 x i8] c"test_func_two\00"
+// CHECK: @[[STR_THREE:.+]] = private unnamed_addr constant [20 x i8] c"do_default_arg_test\00"
// CHECK: define {{(dso_local )?}}i8* @_ZN9test_func13test_func_oneEv()
// CHECK: ret i8* getelementptr inbounds ([14 x i8], [14 x i8]* @[[STR_ONE]], i32 0, i32 0)
diff --git a/clang/test/Preprocessor/feature_tests.c b/clang/test/Preprocessor/feature_tests.c
index c2fbd11c97c..2035a729f2d 100644
--- a/clang/test/Preprocessor/feature_tests.c
+++ b/clang/test/Preprocessor/feature_tests.c
@@ -20,6 +20,15 @@
#error Clang should have these
#endif
+// These are technically implemented as keywords, but __has_builtin should
+// still return true.
+#if !__has_builtin(__builtin_LINE) || \
+ !__has_builtin(__builtin_FILE) || \
+ !__has_builtin(__builtin_FUNCTION) || \
+ !__has_builtin(__builtin_COLUMN)
+#error Clang should have these
+#endif
+
#if __has_builtin(__builtin_insanity)
#error Clang should not have this
#endif
OpenPOWER on IntegriCloud