From deb6b7eae7458e29b8c66ee8dcbedf0210138b4d Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 26 Apr 2017 23:49:57 +0000 Subject: [PATCH] Remove unnecessary and somewhat inaccurate "C89" flag from language standards. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301500 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Frontend/LangStandard.h | 26 ++++++++++-------------- include/clang/Frontend/LangStandards.def | 12 +++++------ lib/Frontend/CompilerInvocation.cpp | 2 +- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/include/clang/Frontend/LangStandard.h b/include/clang/Frontend/LangStandard.h index cd92b269d3..ec32aa8d16 100644 --- a/include/clang/Frontend/LangStandard.h +++ b/include/clang/Frontend/LangStandard.h @@ -20,18 +20,17 @@ namespace frontend { enum LangFeatures { LineComment = (1 << 0), - C89 = (1 << 1), - C99 = (1 << 2), - C11 = (1 << 3), - CPlusPlus = (1 << 4), - CPlusPlus11 = (1 << 5), - CPlusPlus14 = (1 << 6), - CPlusPlus1z = (1 << 7), - Digraphs = (1 << 8), - GNUMode = (1 << 9), - HexFloat = (1 << 10), - ImplicitInt = (1 << 11), - OpenCL = (1 << 12) + C99 = (1 << 1), + C11 = (1 << 2), + CPlusPlus = (1 << 3), + CPlusPlus11 = (1 << 4), + CPlusPlus14 = (1 << 5), + CPlusPlus1z = (1 << 6), + Digraphs = (1 << 7), + GNUMode = (1 << 8), + HexFloat = (1 << 9), + ImplicitInt = (1 << 10), + OpenCL = (1 << 11) }; } @@ -64,9 +63,6 @@ public: /// Language supports '//' comments. bool hasLineComments() const { return Flags & frontend::LineComment; } - /// isC89 - Language is a superset of C89. - bool isC89() const { return Flags & frontend::C89; } - /// isC99 - Language is a superset of C99. bool isC99() const { return Flags & frontend::C99; } diff --git a/include/clang/Frontend/LangStandards.def b/include/clang/Frontend/LangStandards.def index cc042bce0a..ee0deaa2ef 100644 --- a/include/clang/Frontend/LangStandards.def +++ b/include/clang/Frontend/LangStandards.def @@ -31,24 +31,24 @@ // C89-ish modes. LANGSTANDARD(c89, "c89", C, "ISO C 1990", - C89 | ImplicitInt) + ImplicitInt) LANGSTANDARD(c90, "c90", C, "ISO C 1990", - C89 | ImplicitInt) + ImplicitInt) LANGSTANDARD(iso9899_1990, "iso9899:1990", C, "ISO C 1990", - C89 | ImplicitInt) + ImplicitInt) LANGSTANDARD(c94, "iso9899:199409", C, "ISO C 1990 with amendment 1", - C89 | Digraphs | ImplicitInt) + Digraphs | ImplicitInt) LANGSTANDARD(gnu89, "gnu89", C, "ISO C 1990 with GNU extensions", - LineComment | C89 | Digraphs | GNUMode | ImplicitInt) + LineComment | Digraphs | GNUMode | ImplicitInt) LANGSTANDARD(gnu90, "gnu90", C, "ISO C 1990 with GNU extensions", - LineComment | C89 | Digraphs | GNUMode | ImplicitInt) + LineComment | Digraphs | GNUMode | ImplicitInt) // C99-ish modes LANGSTANDARD(c99, "c99", diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index dbbe6af6ab..481ce5bfa6 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -1615,7 +1615,7 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK, Opts.CPlusPlus1z = Std.isCPlusPlus1z(); Opts.Digraphs = Std.hasDigraphs(); Opts.GNUMode = Std.isGNUMode(); - Opts.GNUInline = Std.isC89(); + Opts.GNUInline = !Opts.C99 && !Opts.CPlusPlus; Opts.HexFloats = Std.hasHexFloats(); Opts.ImplicitInt = Std.hasImplicitInt(); -- 2.40.0