Skip to content

Commit 2691029

Browse files
author
Cameron McInally
committed
Add LLVM_ATTRIBUTE_UNINITIALIZED
Add LLVM_ATTRIBUTE_UNINITIALIZED to map to __attribute__((uninitialized)) when available.
1 parent 8b69907 commit 2691029

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3177,7 +3177,7 @@ StringRef tools::ParseMPreferVectorWidthOption(clang::DiagnosticsEngine &Diags,
31773177
return "";
31783178

31793179
StringRef Value = A->getValue();
3180-
unsigned Width;
3180+
unsigned Width LLVM_ATTRIBUTE_UNINITIALIZED;
31813181

31823182
// Only "none" and Integer values are accepted by
31833183
// -mprefer-vector-width=<value>.

llvm/include/llvm/Support/Compiler.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,12 @@
238238
#define LLVM_PREFETCH(addr, rw, locality)
239239
#endif
240240

241+
#if __has_attribute(uninitialized)
242+
#define LLVM_ATTRIBUTE_UNINITIALIED __attribute__((uninitialized))
243+
#else
244+
#define LLVM_ATTRIBUTE_UNINITIALIZED
245+
#endif
246+
241247
#if __has_attribute(used)
242248
#define LLVM_ATTRIBUTE_USED __attribute__((__used__))
243249
#else

0 commit comments

Comments
 (0)