llvm-project/clang/test
Alexander Kornienko 160d9472f4 Fix -Wshadow false positives with function-local classes.
Summary:
Fixes http://llvm.org/PR33947.

https://godbolt.org/g/54XRMT

void f(int a) {
  struct A {
    void g(int a) {}
    A() { int a; }
  };
}

3 : <source>:3:16: warning: declaration shadows a local variable [-Wshadow]
    void g(int a) {}
               ^
1 : <source>:1:12: note: previous declaration is here
void f(int a) {
           ^
4 : <source>:4:15: warning: declaration shadows a local variable [-Wshadow]
    A() { int a; }
              ^
1 : <source>:1:12: note: previous declaration is here
void f(int a) {
           ^
2 warnings generated.

The local variable `a` of the function `f` can't be accessed from a method of
the function-local class A, thus no shadowing occurs and no diagnostic is
needed.

Reviewers: rnk, rsmith, arphaman, Quuxplusone

Reviewed By: rnk, Quuxplusone

Subscribers: Quuxplusone, cfe-commits

Differential Revision: https://reviews.llvm.org/D35941

llvm-svn: 309569
2017-07-31 15:21:26 +00:00
..
ARCMT clang/test/ARCMT/remap-applying.c: Use %/s on the command line of echo(1). 2017-04-28 05:02:52 +00:00
ASTMerge Revert r299355 "[ASTImporter] Fix for importing unnamed structs" 2017-04-03 21:06:45 +00:00
Analysis [StaticAnalyzer] Completely unrolling specific loops with known bound option 2017-07-25 19:23:23 +00:00
CXX [modules ts] Basic for module linkage. 2017-07-07 20:04:28 +00:00
CodeCompletion Fixed failing assert in code completion. 2017-07-21 09:24:00 +00:00
CodeGen [x86][inline-asm][ms-compat] legalize the use of "jc/jz short <op>" 2017-07-30 11:13:46 +00:00
CodeGenCUDA CodeGenModule: Always output wchar_size, check LLVM assumptions. 2017-05-20 01:29:55 +00:00
CodeGenCXX Update comment in test case after r309308. 2017-07-28 01:58:14 +00:00
CodeGenCoroutines [coroutines] Evaluate the operand of void `co_return` expressions. 2017-07-31 07:48:13 +00:00
CodeGenObjC Adopt to LLVM API change (llvm.dbg.value no longer has an offset) 2017-07-28 20:21:08 +00:00
CodeGenObjCXX test: fix test for release builds 2017-06-27 18:57:50 +00:00
CodeGenOpenCL [OpenCL] Add extension Sema check for subgroup builtins 2017-07-31 15:15:59 +00:00
Coverage Handle -ast-dump-all when passed as the only option. 2017-06-15 00:00:08 +00:00
CoverageMapping [Coverage] Avoid null deref in skipRegionMappingForDecl (fixes PR32761) 2017-04-24 20:52:04 +00:00
Driver Also pass -pie back to the linker when linking on OpenBSD. 2017-07-30 21:13:59 +00:00
FixIt -Wpragma-pack: add an additional note and fixit when warning 2017-07-31 13:37:50 +00:00
Format [clang-format] Replace IncompleteFormat by a struct with Line 2017-04-21 14:35:20 +00:00
Frontend Remove Bitrig: Clang Changes 2017-07-21 22:46:31 +00:00
Headers [Headers] Add a test for arm64intr.h 2017-07-27 19:45:13 +00:00
Import [ExternalASTMerger] Import Objective-C classes 2017-07-25 19:54:22 +00:00
Index [index] Set SymbolSubKind::Accessor[GS]etter on class methods 2017-07-21 23:04:27 +00:00
Integration Tie the macOS tests in test/Integration to the latest macOS SDK 2017-06-02 11:26:35 +00:00
Layout Print nested name specifiers for typedefs and type aliases 2017-03-10 15:04:58 +00:00
Lexer Reorder tests to match latest SD-6 draft. 2017-07-25 23:31:42 +00:00
Misc PR33902: Invalidate line number cache when adding more text to existing buffer. 2017-07-30 06:31:29 +00:00
Modules Fix incorrect use of current directory to find moved paths in ASTReader. 2017-07-25 10:22:06 +00:00
OpenMP Recommit r308327 3rd time: Add a warning for missing 2017-07-28 14:41:21 +00:00
PCH -Wpragma-pack: add an additional note and fixit when warning 2017-07-31 13:37:50 +00:00
Parser Recommit r308327 3rd time: Add a warning for missing 2017-07-28 14:41:21 +00:00
Preprocessor Fix a typo. 2017-07-30 20:33:06 +00:00
Profile [Profile] Do not assign counters to functions without bodies 2017-06-30 21:02:14 +00:00
Rewriter [Objective-C] Fix non-determinism in clang 2017-07-06 18:49:57 +00:00
Sema -Wpragma-pack: add an additional note and fixit when warning 2017-07-31 13:37:50 +00:00
SemaCUDA [CUDA] Let NVPTX inherit the host's calling conventions. 2017-01-05 16:53:38 +00:00
SemaCXX Fix -Wshadow false positives with function-local classes. 2017-07-31 15:21:26 +00:00
SemaObjC Recommit r308327 3rd time: Add a warning for missing 2017-07-28 14:41:21 +00:00
SemaObjCXX Fix errored return value in CheckFunctionReturnType and add a fixit hint 2017-05-10 20:03:16 +00:00
SemaOpenCL [OpenCL] Add extension Sema check for subgroup builtins 2017-07-31 15:15:59 +00:00
SemaTemplate Regression test for PR10856 2017-07-26 14:58:55 +00:00
TableGen
Tooling [clang-diff] Add initial implementation 2017-07-21 12:49:28 +00:00
Unit Change remaining references to lit.util.capture to use subprocess.check_output. 2017-07-06 21:46:47 +00:00
VFS
clang-rename Move ClassReplacements.cpp test from clang-rename tests to the 2017-06-30 16:58:36 +00:00
.clang-format
CMakeLists.txt Clang's tests should depend on clang-diff 2017-07-21 13:12:01 +00:00
TestRunner.sh
cxx-sections.data
lit.cfg [clang] Add abi-breaking-checks support to clang 2017-07-25 23:00:02 +00:00
lit.site.cfg.in [clang] Add abi-breaking-checks support to clang 2017-07-25 23:00:02 +00:00
make_test_dirs.pl