summaryrefslogtreecommitdiffstats
path: root/clang/include
diff options
context:
space:
mode:
Diffstat (limited to 'clang/include')
-rw-r--r--clang/include/clang/Basic/IdentifierTable.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/include/clang/Basic/IdentifierTable.h b/clang/include/clang/Basic/IdentifierTable.h
index 7aa1d074a59..ea5d7adeb2d 100644
--- a/clang/include/clang/Basic/IdentifierTable.h
+++ b/clang/include/clang/Basic/IdentifierTable.h
@@ -384,6 +384,17 @@ public:
return getName().startswith("<#") && getName().endswith("#>");
}
+ /// Determine whether \p this is a name reserved for the implementation (C99
+ /// 7.1.3, C++ [lib.global.names]).
+ bool isReservedName(bool doubleUnderscoreOnly = false) const {
+ if (getLength() < 2)
+ return false;
+ const char *Name = getNameStart();
+ return Name[0] == '_' &&
+ (Name[1] == '_' ||
+ (Name[1] >= 'A' && Name[1] <= 'Z' && !doubleUnderscoreOnly));
+ }
+
/// Provide less than operator for lexicographical sorting.
bool operator<(const IdentifierInfo &RHS) const {
return getName() < RHS.getName();
OpenPOWER on IntegriCloud