diff options
author | Leonard Chan <leonardchan@google.com> | 2019-05-07 03:20:17 +0000 |
---|---|---|
committer | Leonard Chan <leonardchan@google.com> | 2019-05-07 03:20:17 +0000 |
commit | c72aaf62d3f92c0c6d33b4df2253505f6eb22996 (patch) | |
tree | bb29b4896b3792cdef8f5017a40b59625c456f04 /clang/test/Frontend | |
parent | da82ce99b7460164ffb841619aadb44f397d2106 (diff) | |
download | bcm5719-llvm-c72aaf62d3f92c0c6d33b4df2253505f6eb22996.tar.gz bcm5719-llvm-c72aaf62d3f92c0c6d33b4df2253505f6eb22996.zip |
Recommit r359859 "[Attribute/Diagnostics] Print macro if definition is an attribute declaration"
Updated with fix for read of uninitialized memory.
llvm-svn: 360109
Diffstat (limited to 'clang/test/Frontend')
-rw-r--r-- | clang/test/Frontend/macro_defined_type.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Frontend/macro_defined_type.cpp b/clang/test/Frontend/macro_defined_type.cpp new file mode 100644 index 00000000000..4e60c840382 --- /dev/null +++ b/clang/test/Frontend/macro_defined_type.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +#define NODEREF __attribute__((noderef)) + +void Func() { + int NODEREF i; // expected-warning{{'noderef' can only be used on an array or pointer type}} + int NODEREF *i_ptr; + + // There should be no difference whether a macro defined type is used or not. + auto __attribute__((noderef)) *auto_i_ptr = i_ptr; + auto __attribute__((noderef)) auto_i = i; // expected-warning{{'noderef' can only be used on an array or pointer type}} + + auto NODEREF *auto_i_ptr2 = i_ptr; + auto NODEREF auto_i2 = i; // expected-warning{{'noderef' can only be used on an array or pointer type}} +} |