[PATCH] D20773: [Sema] Fix incorrect enum token namespace

Etienne Bergeron via cfe-commits cfe-commits at lists.llvm.org
Sat May 28 12:04:38 PDT 2016


etienneb created this revision.
etienneb added a reviewer: rsmith.
etienneb added a subscriber: cfe-commits.

This patch fix the scoping of enum literal. They were not resolving
to the right type.

It was not causing any problem as one is a copy of the other one.

The literal in the switch are resolving to Sema.h:5527
```
  enum AccessResult {
    AR_accessible,
    AR_inaccessible,
    AR_dependent,
    AR_delayed
  };
```

Instead of SemaAccess.cpp:27
```
/// A copy of Sema's enum without AR_delayed.
enum AccessResult {
  AR_accessible,
  AR_inaccessible,
  AR_dependent
};
```

This issue was found by a new clang-tidy check (still on-going).

http://reviews.llvm.org/D20773

Files:
  lib/Sema/SemaAccess.cpp

Index: lib/Sema/SemaAccess.cpp
===================================================================
--- lib/Sema/SemaAccess.cpp
+++ lib/Sema/SemaAccess.cpp
@@ -1766,9 +1766,9 @@
   // while the ParsingDeclarator is active.
   EffectiveContext EC(CurContext);
   switch (CheckEffectiveAccess(*this, EC, target->getLocation(), entity)) {
-  case AR_accessible: return Sema::AR_accessible;
-  case AR_inaccessible: return Sema::AR_inaccessible;
-  case AR_dependent: return Sema::AR_dependent;
+  case ::AR_accessible: return Sema::AR_accessible;
+  case ::AR_inaccessible: return Sema::AR_inaccessible;
+  case ::AR_dependent: return Sema::AR_dependent;
   }
   llvm_unreachable("invalid access result");
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20773.58898.patch
Type: text/x-patch
Size: 705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160528/0bcc42ab/attachment.bin>


More information about the cfe-commits mailing list