r367864 - Move LangStandard*, InputKind::Language to Basic
Rainer Orth via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 5 06:59:26 PDT 2019
Author: ro
Date: Mon Aug 5 06:59:26 2019
New Revision: 367864
URL: http://llvm.org/viewvc/llvm-project?rev=367864&view=rev
Log:
Move LangStandard*, InputKind::Language to Basic
This patch is a prerequisite for using LangStandard from Driver in
https://reviews.llvm.org/D64793.
It moves LangStandard* and InputKind::Language to Basic. It is mostly
mechanical, with only a few changes of note:
- enum Language has been changed into enum class Language : uint8_t to
avoid a clash between OpenCL in enum Language and OpenCL in enum
LangFeatures and not to increase the size of class InputKind.
- Now that getLangStandardForName, which is currently unused, also checks
both canonical and alias names, I've introduced a helper getLangKind
which factors out a code pattern already used 3 times.
The patch has been tested on x86_64-pc-solaris2.11, sparcv9-sun-solaris2.11,
and x86_64-pc-linux-gnu.
There's a companion patch for lldb which uses LangStandard.h
(https://reviews.llvm.org/D65717).
While polly includes isl which in turn uses InputKind::C, that part of the
code isn't even built inside the llvm tree. I've posted a patch to allow
for both InputKind::C and Language::C upstream
(https://groups.google.com/forum/#!topic/isl-development/6oEvNWOSQFE).
Differential Revision: https://reviews.llvm.org/D65562
Added:
cfe/trunk/include/clang/Basic/LangStandard.h
- copied, changed from r367863, cfe/trunk/include/clang/Frontend/LangStandard.h
cfe/trunk/include/clang/Basic/LangStandards.def
- copied, changed from r367863, cfe/trunk/include/clang/Frontend/LangStandards.def
cfe/trunk/lib/Basic/LangStandards.cpp
- copied, changed from r367863, cfe/trunk/lib/Frontend/LangStandards.cpp
Removed:
cfe/trunk/include/clang/Frontend/LangStandard.h
cfe/trunk/include/clang/Frontend/LangStandards.def
cfe/trunk/lib/Frontend/LangStandards.cpp
Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/CompilerInvocation.h
cfe/trunk/include/clang/Frontend/FrontendOptions.h
cfe/trunk/include/clang/module.modulemap
cfe/trunk/lib/Basic/CMakeLists.txt
cfe/trunk/lib/CodeGen/CodeGenAction.cpp
cfe/trunk/lib/Frontend/ASTUnit.cpp
cfe/trunk/lib/Frontend/CMakeLists.txt
cfe/trunk/lib/Frontend/CompilerInstance.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/FrontendAction.cpp
cfe/trunk/lib/Frontend/FrontendActions.cpp
cfe/trunk/lib/Frontend/FrontendOptions.cpp
cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp
cfe/trunk/lib/Frontend/Rewrite/FrontendActions.cpp
cfe/trunk/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp
cfe/trunk/unittests/Frontend/CodeGenActionTest.cpp
cfe/trunk/unittests/Frontend/FrontendActionTest.cpp
cfe/trunk/unittests/Frontend/OutputStreamTest.cpp
Copied: cfe/trunk/include/clang/Basic/LangStandard.h (from r367863, cfe/trunk/include/clang/Frontend/LangStandard.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangStandard.h?p2=cfe/trunk/include/clang/Basic/LangStandard.h&p1=cfe/trunk/include/clang/Frontend/LangStandard.h&r1=367863&r2=367864&rev=367864&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/LangStandard.h (original)
+++ cfe/trunk/include/clang/Basic/LangStandard.h Mon Aug 5 06:59:26 2019
@@ -6,16 +6,37 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_FRONTEND_LANGSTANDARD_H
-#define LLVM_CLANG_FRONTEND_LANGSTANDARD_H
+#ifndef LLVM_CLANG_BASIC_LANGSTANDARD_H
+#define LLVM_CLANG_BASIC_LANGSTANDARD_H
#include "clang/Basic/LLVM.h"
-#include "clang/Frontend/FrontendOptions.h"
#include "llvm/ADT/StringRef.h"
namespace clang {
-namespace frontend {
+/// The language for the input, used to select and validate the language
+/// standard and possible actions.
+enum class Language : uint8_t {
+ Unknown,
+
+ /// Assembly: we accept this only so that we can preprocess it.
+ Asm,
+
+ /// LLVM IR: we accept this so that we can run the optimizer on it,
+ /// and compile it to assembly or object code.
+ LLVM_IR,
+
+ ///@{ Languages that the frontend can parse and compile.
+ C,
+ CXX,
+ ObjC,
+ ObjCXX,
+ OpenCL,
+ CUDA,
+ RenderScript,
+ HIP,
+ ///@}
+};
enum LangFeatures {
LineComment = (1 << 0),
@@ -35,22 +56,20 @@ enum LangFeatures {
OpenCL = (1 << 14)
};
-}
-
/// LangStandard - Information about the properties of a particular language
/// standard.
struct LangStandard {
enum Kind {
#define LANGSTANDARD(id, name, lang, desc, features) \
lang_##id,
-#include "clang/Frontend/LangStandards.def"
+#include "clang/Basic/LangStandards.def"
lang_unspecified
};
const char *ShortName;
const char *Description;
unsigned Flags;
- InputKind::Language Language;
+ clang::Language Language;
public:
/// getName - Get the name of this standard.
@@ -60,54 +79,54 @@ public:
const char *getDescription() const { return Description; }
/// Get the language that this standard describes.
- InputKind::Language getLanguage() const { return Language; }
+ clang::Language getLanguage() const { return Language; }
/// Language supports '//' comments.
- bool hasLineComments() const { return Flags & frontend::LineComment; }
+ bool hasLineComments() const { return Flags & LineComment; }
/// isC99 - Language is a superset of C99.
- bool isC99() const { return Flags & frontend::C99; }
+ bool isC99() const { return Flags & C99; }
/// isC11 - Language is a superset of C11.
- bool isC11() const { return Flags & frontend::C11; }
+ bool isC11() const { return Flags & C11; }
/// isC17 - Language is a superset of C17.
- bool isC17() const { return Flags & frontend::C17; }
+ bool isC17() const { return Flags & C17; }
/// isC2x - Language is a superset of C2x.
- bool isC2x() const { return Flags & frontend::C2x; }
+ bool isC2x() const { return Flags & C2x; }
/// isCPlusPlus - Language is a C++ variant.
- bool isCPlusPlus() const { return Flags & frontend::CPlusPlus; }
+ bool isCPlusPlus() const { return Flags & CPlusPlus; }
/// isCPlusPlus11 - Language is a C++11 variant (or later).
- bool isCPlusPlus11() const { return Flags & frontend::CPlusPlus11; }
+ bool isCPlusPlus11() const { return Flags & CPlusPlus11; }
/// isCPlusPlus14 - Language is a C++14 variant (or later).
- bool isCPlusPlus14() const { return Flags & frontend::CPlusPlus14; }
+ bool isCPlusPlus14() const { return Flags & CPlusPlus14; }
/// isCPlusPlus17 - Language is a C++17 variant (or later).
- bool isCPlusPlus17() const { return Flags & frontend::CPlusPlus17; }
+ bool isCPlusPlus17() const { return Flags & CPlusPlus17; }
/// isCPlusPlus2a - Language is a post-C++17 variant (or later).
- bool isCPlusPlus2a() const { return Flags & frontend::CPlusPlus2a; }
-
+ bool isCPlusPlus2a() const { return Flags & CPlusPlus2a; }
/// hasDigraphs - Language supports digraphs.
- bool hasDigraphs() const { return Flags & frontend::Digraphs; }
+ bool hasDigraphs() const { return Flags & Digraphs; }
/// isGNUMode - Language includes GNU extensions.
- bool isGNUMode() const { return Flags & frontend::GNUMode; }
+ bool isGNUMode() const { return Flags & GNUMode; }
/// hasHexFloats - Language supports hexadecimal float constants.
- bool hasHexFloats() const { return Flags & frontend::HexFloat; }
+ bool hasHexFloats() const { return Flags & HexFloat; }
/// hasImplicitInt - Language allows variables to be typed as int implicitly.
- bool hasImplicitInt() const { return Flags & frontend::ImplicitInt; }
+ bool hasImplicitInt() const { return Flags & ImplicitInt; }
/// isOpenCL - Language is a OpenCL variant.
- bool isOpenCL() const { return Flags & frontend::OpenCL; }
+ bool isOpenCL() const { return Flags & OpenCL; }
+ static Kind getLangKind(StringRef Name);
static const LangStandard &getLangStandardForKind(Kind K);
static const LangStandard *getLangStandardForName(StringRef Name);
};
Copied: cfe/trunk/include/clang/Basic/LangStandards.def (from r367863, cfe/trunk/include/clang/Frontend/LangStandards.def)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangStandards.def?p2=cfe/trunk/include/clang/Basic/LangStandards.def&p1=cfe/trunk/include/clang/Frontend/LangStandards.def&r1=367863&r2=367864&rev=367864&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/LangStandards.def (original)
+++ cfe/trunk/include/clang/Basic/LangStandards.def Mon Aug 5 06:59:26 2019
@@ -14,7 +14,7 @@
///
/// \param IDENT - The name of the standard as a C++ identifier.
/// \param NAME - The name of the standard.
-/// \param LANG - The InputKind::Language for which this is a standard.
+/// \param LANG - The Language for which this is a standard.
/// \param DESC - A short description of the standard.
/// \param FEATURES - The standard features as flags, these are enums from the
/// clang::frontend namespace, which is assumed to be be available.
Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Aug 5 06:59:26 2019
@@ -2637,7 +2637,7 @@ def std_EQ : Joined<["-", "--"], "std=">
const char *Values =
#define LANGSTANDARD(id, name, lang, desc, features) name ","
#define LANGSTANDARD_ALIAS(id, alias) alias ","
- #include "clang/Frontend/LangStandards.def"
+ #include "clang/Basic/LangStandards.def"
;
}]>;
def stdlib_EQ : Joined<["-", "--"], "stdlib=">, Flags<[CC1Option]>,
Modified: cfe/trunk/include/clang/Frontend/CompilerInvocation.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInvocation.h?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/CompilerInvocation.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInvocation.h Mon Aug 5 06:59:26 2019
@@ -14,9 +14,9 @@
#include "clang/Basic/FileSystemOptions.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
+#include "clang/Basic/LangStandard.h"
#include "clang/Frontend/DependencyOutputOptions.h"
#include "clang/Frontend/FrontendOptions.h"
-#include "clang/Frontend/LangStandard.h"
#include "clang/Frontend/MigratorOptions.h"
#include "clang/Frontend/PreprocessorOutputOptions.h"
#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
Modified: cfe/trunk/include/clang/Frontend/FrontendOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendOptions.h?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/FrontendOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendOptions.h Mon Aug 5 06:59:26 2019
@@ -10,15 +10,16 @@
#define LLVM_CLANG_FRONTEND_FRONTENDOPTIONS_H
#include "clang/AST/ASTDumperUtils.h"
+#include "clang/Basic/LangStandard.h"
#include "clang/Frontend/CommandLineSourceLoc.h"
-#include "clang/Serialization/ModuleFileExtension.h"
#include "clang/Sema/CodeCompleteOptions.h"
+#include "clang/Serialization/ModuleFileExtension.h"
#include "llvm/ADT/StringRef.h"
#include <cassert>
#include <memory>
#include <string>
-#include <vector>
#include <unordered_map>
+#include <vector>
namespace llvm {
@@ -143,35 +144,11 @@ enum ActionKind {
/// The kind of a file that we've been handed as an input.
class InputKind {
private:
- unsigned Lang : 4;
+ Language Lang;
unsigned Fmt : 3;
unsigned Preprocessed : 1;
public:
- /// The language for the input, used to select and validate the language
- /// standard and possible actions.
- enum Language {
- Unknown,
-
- /// Assembly: we accept this only so that we can preprocess it.
- Asm,
-
- /// LLVM IR: we accept this so that we can run the optimizer on it,
- /// and compile it to assembly or object code.
- LLVM_IR,
-
- ///@{ Languages that the frontend can parse and compile.
- C,
- CXX,
- ObjC,
- ObjCXX,
- OpenCL,
- CUDA,
- RenderScript,
- HIP,
- ///@}
- };
-
/// The input file format.
enum Format {
Source,
@@ -179,7 +156,7 @@ public:
Precompiled
};
- constexpr InputKind(Language L = Unknown, Format F = Source,
+ constexpr InputKind(Language L = Language::Unknown, Format F = Source,
bool PP = false)
: Lang(L), Fmt(F), Preprocessed(PP) {}
@@ -188,10 +165,12 @@ public:
bool isPreprocessed() const { return Preprocessed; }
/// Is the input kind fully-unknown?
- bool isUnknown() const { return Lang == Unknown && Fmt == Source; }
+ bool isUnknown() const { return Lang == Language::Unknown && Fmt == Source; }
/// Is the language of the input some dialect of Objective-C?
- bool isObjectiveC() const { return Lang == ObjC || Lang == ObjCXX; }
+ bool isObjectiveC() const {
+ return Lang == Language::ObjC || Lang == Language::ObjCXX;
+ }
InputKind getPreprocessed() const {
return InputKind(getLanguage(), getFormat(), true);
@@ -467,9 +446,9 @@ public:
IncludeTimestamps(true), TimeTraceGranularity(500) {}
/// getInputKindForExtension - Return the appropriate input kind for a file
- /// extension. For example, "c" would return InputKind::C.
+ /// extension. For example, "c" would return Language::C.
///
- /// \return The input kind for the extension, or InputKind::Unknown if the
+ /// \return The input kind for the extension, or Language::Unknown if the
/// extension is not recognized.
static InputKind getInputKindForExtension(StringRef Extension);
};
Removed: cfe/trunk/include/clang/Frontend/LangStandard.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/LangStandard.h?rev=367863&view=auto
==============================================================================
--- cfe/trunk/include/clang/Frontend/LangStandard.h (original)
+++ cfe/trunk/include/clang/Frontend/LangStandard.h (removed)
@@ -1,117 +0,0 @@
-//===--- LangStandard.h -----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_FRONTEND_LANGSTANDARD_H
-#define LLVM_CLANG_FRONTEND_LANGSTANDARD_H
-
-#include "clang/Basic/LLVM.h"
-#include "clang/Frontend/FrontendOptions.h"
-#include "llvm/ADT/StringRef.h"
-
-namespace clang {
-
-namespace frontend {
-
-enum LangFeatures {
- LineComment = (1 << 0),
- C99 = (1 << 1),
- C11 = (1 << 2),
- C17 = (1 << 3),
- C2x = (1 << 4),
- CPlusPlus = (1 << 5),
- CPlusPlus11 = (1 << 6),
- CPlusPlus14 = (1 << 7),
- CPlusPlus17 = (1 << 8),
- CPlusPlus2a = (1 << 9),
- Digraphs = (1 << 10),
- GNUMode = (1 << 11),
- HexFloat = (1 << 12),
- ImplicitInt = (1 << 13),
- OpenCL = (1 << 14)
-};
-
-}
-
-/// LangStandard - Information about the properties of a particular language
-/// standard.
-struct LangStandard {
- enum Kind {
-#define LANGSTANDARD(id, name, lang, desc, features) \
- lang_##id,
-#include "clang/Frontend/LangStandards.def"
- lang_unspecified
- };
-
- const char *ShortName;
- const char *Description;
- unsigned Flags;
- InputKind::Language Language;
-
-public:
- /// getName - Get the name of this standard.
- const char *getName() const { return ShortName; }
-
- /// getDescription - Get the description of this standard.
- const char *getDescription() const { return Description; }
-
- /// Get the language that this standard describes.
- InputKind::Language getLanguage() const { return Language; }
-
- /// Language supports '//' comments.
- bool hasLineComments() const { return Flags & frontend::LineComment; }
-
- /// isC99 - Language is a superset of C99.
- bool isC99() const { return Flags & frontend::C99; }
-
- /// isC11 - Language is a superset of C11.
- bool isC11() const { return Flags & frontend::C11; }
-
- /// isC17 - Language is a superset of C17.
- bool isC17() const { return Flags & frontend::C17; }
-
- /// isC2x - Language is a superset of C2x.
- bool isC2x() const { return Flags & frontend::C2x; }
-
- /// isCPlusPlus - Language is a C++ variant.
- bool isCPlusPlus() const { return Flags & frontend::CPlusPlus; }
-
- /// isCPlusPlus11 - Language is a C++11 variant (or later).
- bool isCPlusPlus11() const { return Flags & frontend::CPlusPlus11; }
-
- /// isCPlusPlus14 - Language is a C++14 variant (or later).
- bool isCPlusPlus14() const { return Flags & frontend::CPlusPlus14; }
-
- /// isCPlusPlus17 - Language is a C++17 variant (or later).
- bool isCPlusPlus17() const { return Flags & frontend::CPlusPlus17; }
-
- /// isCPlusPlus2a - Language is a post-C++17 variant (or later).
- bool isCPlusPlus2a() const { return Flags & frontend::CPlusPlus2a; }
-
-
- /// hasDigraphs - Language supports digraphs.
- bool hasDigraphs() const { return Flags & frontend::Digraphs; }
-
- /// isGNUMode - Language includes GNU extensions.
- bool isGNUMode() const { return Flags & frontend::GNUMode; }
-
- /// hasHexFloats - Language supports hexadecimal float constants.
- bool hasHexFloats() const { return Flags & frontend::HexFloat; }
-
- /// hasImplicitInt - Language allows variables to be typed as int implicitly.
- bool hasImplicitInt() const { return Flags & frontend::ImplicitInt; }
-
- /// isOpenCL - Language is a OpenCL variant.
- bool isOpenCL() const { return Flags & frontend::OpenCL; }
-
- static const LangStandard &getLangStandardForKind(Kind K);
- static const LangStandard *getLangStandardForName(StringRef Name);
-};
-
-} // end namespace clang
-
-#endif
Removed: cfe/trunk/include/clang/Frontend/LangStandards.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/LangStandards.def?rev=367863&view=auto
==============================================================================
--- cfe/trunk/include/clang/Frontend/LangStandards.def (original)
+++ cfe/trunk/include/clang/Frontend/LangStandards.def (removed)
@@ -1,189 +0,0 @@
-//===-- LangStandards.def - Language Standard Data --------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LANGSTANDARD
-#error "LANGSTANDARD must be defined before including this file"
-#endif
-
-/// LANGSTANDARD(IDENT, NAME, LANG, DESC, FEATURES)
-///
-/// \param IDENT - The name of the standard as a C++ identifier.
-/// \param NAME - The name of the standard.
-/// \param LANG - The InputKind::Language for which this is a standard.
-/// \param DESC - A short description of the standard.
-/// \param FEATURES - The standard features as flags, these are enums from the
-/// clang::frontend namespace, which is assumed to be be available.
-
-/// LANGSTANDARD_ALIAS(IDENT, ALIAS)
-/// \param IDENT - The name of the standard as a C++ identifier.
-/// \param ALIAS - The alias of the standard.
-
-/// LANGSTANDARD_ALIAS_DEPR(IDENT, ALIAS)
-/// Same as LANGSTANDARD_ALIAS, but for a deprecated alias.
-
-#ifndef LANGSTANDARD_ALIAS
-#define LANGSTANDARD_ALIAS(IDENT, ALIAS)
-#endif
-
-#ifndef LANGSTANDARD_ALIAS_DEPR
-#define LANGSTANDARD_ALIAS_DEPR(IDENT, ALIAS) LANGSTANDARD_ALIAS(IDENT, ALIAS)
-#endif
-
-// C89-ish modes.
-LANGSTANDARD(c89, "c89",
- C, "ISO C 1990",
- ImplicitInt)
-LANGSTANDARD_ALIAS(c89, "c90")
-LANGSTANDARD_ALIAS(c89, "iso9899:1990")
-
-LANGSTANDARD(c94, "iso9899:199409",
- C, "ISO C 1990 with amendment 1",
- Digraphs | ImplicitInt)
-
-LANGSTANDARD(gnu89, "gnu89",
- C, "ISO C 1990 with GNU extensions",
- LineComment | Digraphs | GNUMode | ImplicitInt)
-LANGSTANDARD_ALIAS(gnu89, "gnu90")
-
-// C99-ish modes
-LANGSTANDARD(c99, "c99",
- C, "ISO C 1999",
- LineComment | C99 | Digraphs | HexFloat)
-LANGSTANDARD_ALIAS(c99, "iso9899:1999")
-LANGSTANDARD_ALIAS_DEPR(c99, "c9x")
-LANGSTANDARD_ALIAS_DEPR(c99, "iso9899:199x")
-
-LANGSTANDARD(gnu99, "gnu99",
- C, "ISO C 1999 with GNU extensions",
- LineComment | C99 | Digraphs | GNUMode | HexFloat)
-LANGSTANDARD_ALIAS_DEPR(gnu99, "gnu9x")
-
-// C11 modes
-LANGSTANDARD(c11, "c11",
- C, "ISO C 2011",
- LineComment | C99 | C11 | Digraphs | HexFloat)
-LANGSTANDARD_ALIAS(c11, "iso9899:2011")
-LANGSTANDARD_ALIAS_DEPR(c11, "c1x")
-LANGSTANDARD_ALIAS_DEPR(c11, "iso9899:201x")
-
-LANGSTANDARD(gnu11, "gnu11",
- C, "ISO C 2011 with GNU extensions",
- LineComment | C99 | C11 | Digraphs | GNUMode | HexFloat)
-LANGSTANDARD_ALIAS_DEPR(gnu11, "gnu1x")
-
-// C17 modes
-LANGSTANDARD(c17, "c17",
- C, "ISO C 2017",
- LineComment | C99 | C11 | C17 | Digraphs | HexFloat)
-LANGSTANDARD_ALIAS(c17, "iso9899:2017")
-LANGSTANDARD_ALIAS(c17, "c18")
-LANGSTANDARD_ALIAS(c17, "iso9899:2018")
-LANGSTANDARD(gnu17, "gnu17",
- C, "ISO C 2017 with GNU extensions",
- LineComment | C99 | C11 | C17 | Digraphs | GNUMode | HexFloat)
-LANGSTANDARD_ALIAS(gnu17, "gnu18")
-
-// C2x modes
-LANGSTANDARD(c2x, "c2x",
- C, "Working Draft for ISO C2x",
- LineComment | C99 | C11 | C17 | C2x | Digraphs | HexFloat)
-LANGSTANDARD(gnu2x, "gnu2x",
- C, "Working Draft for ISO C2x with GNU extensions",
- LineComment | C99 | C11 | C17 | C2x | Digraphs | GNUMode | HexFloat)
-
-// C++ modes
-LANGSTANDARD(cxx98, "c++98",
- CXX, "ISO C++ 1998 with amendments",
- LineComment | CPlusPlus | Digraphs)
-LANGSTANDARD_ALIAS(cxx98, "c++03")
-
-LANGSTANDARD(gnucxx98, "gnu++98",
- CXX, "ISO C++ 1998 with amendments and GNU extensions",
- LineComment | CPlusPlus | Digraphs | GNUMode)
-LANGSTANDARD_ALIAS(gnucxx98, "gnu++03")
-
-LANGSTANDARD(cxx11, "c++11",
- CXX, "ISO C++ 2011 with amendments",
- LineComment | CPlusPlus | CPlusPlus11 | Digraphs)
-LANGSTANDARD_ALIAS_DEPR(cxx11, "c++0x")
-
-LANGSTANDARD(gnucxx11, "gnu++11", CXX,
- "ISO C++ 2011 with amendments and GNU extensions",
- LineComment | CPlusPlus | CPlusPlus11 | Digraphs | GNUMode)
-LANGSTANDARD_ALIAS_DEPR(gnucxx11, "gnu++0x")
-
-LANGSTANDARD(cxx14, "c++14",
- CXX, "ISO C++ 2014 with amendments",
- LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs)
-LANGSTANDARD_ALIAS_DEPR(cxx14, "c++1y")
-
-LANGSTANDARD(gnucxx14, "gnu++14",
- CXX, "ISO C++ 2014 with amendments and GNU extensions",
- LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs |
- GNUMode)
-LANGSTANDARD_ALIAS_DEPR(gnucxx14, "gnu++1y")
-
-LANGSTANDARD(cxx17, "c++17",
- CXX, "ISO C++ 2017 with amendments",
- LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- Digraphs | HexFloat)
-LANGSTANDARD_ALIAS_DEPR(cxx17, "c++1z")
-
-LANGSTANDARD(gnucxx17, "gnu++17",
- CXX, "ISO C++ 2017 with amendments and GNU extensions",
- LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- Digraphs | HexFloat | GNUMode)
-LANGSTANDARD_ALIAS_DEPR(gnucxx17, "gnu++1z")
-
-LANGSTANDARD(cxx2a, "c++2a",
- CXX, "Working draft for ISO C++ 2020",
- LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- CPlusPlus2a | Digraphs | HexFloat)
-
-LANGSTANDARD(gnucxx2a, "gnu++2a",
- CXX, "Working draft for ISO C++ 2020 with GNU extensions",
- LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- CPlusPlus2a | Digraphs | HexFloat | GNUMode)
-
-// OpenCL
-LANGSTANDARD(opencl10, "cl1.0",
- OpenCL, "OpenCL 1.0",
- LineComment | C99 | Digraphs | HexFloat | OpenCL)
-LANGSTANDARD_ALIAS_DEPR(opencl10, "cl")
-
-LANGSTANDARD(opencl11, "cl1.1",
- OpenCL, "OpenCL 1.1",
- LineComment | C99 | Digraphs | HexFloat | OpenCL)
-LANGSTANDARD(opencl12, "cl1.2",
- OpenCL, "OpenCL 1.2",
- LineComment | C99 | Digraphs | HexFloat | OpenCL)
-LANGSTANDARD(opencl20, "cl2.0",
- OpenCL, "OpenCL 2.0",
- LineComment | C99 | Digraphs | HexFloat | OpenCL)
-LANGSTANDARD(openclcpp, "c++",
- OpenCL, "C++ for OpenCL",
- LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- Digraphs | HexFloat | OpenCL)
-
-LANGSTANDARD_ALIAS_DEPR(opencl10, "CL")
-LANGSTANDARD_ALIAS_DEPR(opencl11, "CL1.1")
-LANGSTANDARD_ALIAS_DEPR(opencl12, "CL1.2")
-LANGSTANDARD_ALIAS_DEPR(opencl20, "CL2.0")
-LANGSTANDARD_ALIAS_DEPR(openclcpp, "CLC++")
-
-// CUDA
-LANGSTANDARD(cuda, "cuda", CUDA, "NVIDIA CUDA(tm)",
- LineComment | CPlusPlus | Digraphs)
-
-// HIP
-LANGSTANDARD(hip, "hip", HIP, "HIP",
- LineComment | CPlusPlus | Digraphs)
-
-#undef LANGSTANDARD
-#undef LANGSTANDARD_ALIAS
-#undef LANGSTANDARD_ALIAS_DEPR
Modified: cfe/trunk/include/clang/module.modulemap
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/module.modulemap?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/include/clang/module.modulemap (original)
+++ cfe/trunk/include/clang/module.modulemap Mon Aug 5 06:59:26 2019
@@ -100,7 +100,7 @@ module Clang_Frontend {
requires cplusplus
umbrella "Frontend"
- textual header "Frontend/LangStandards.def"
+ textual header "Basic/LangStandards.def"
module * { export * }
}
Modified: cfe/trunk/lib/Basic/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/CMakeLists.txt?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/CMakeLists.txt (original)
+++ cfe/trunk/lib/Basic/CMakeLists.txt Mon Aug 5 06:59:26 2019
@@ -50,6 +50,7 @@ add_clang_library(clangBasic
FixedPoint.cpp
IdentifierTable.cpp
LangOptions.cpp
+ LangStandards.cpp
Module.cpp
ObjCRuntime.cpp
OpenMPKinds.cpp
Copied: cfe/trunk/lib/Basic/LangStandards.cpp (from r367863, cfe/trunk/lib/Frontend/LangStandards.cpp)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/LangStandards.cpp?p2=cfe/trunk/lib/Basic/LangStandards.cpp&p1=cfe/trunk/lib/Frontend/LangStandards.cpp&r1=367863&r2=367864&rev=367864&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/LangStandards.cpp (original)
+++ cfe/trunk/lib/Basic/LangStandards.cpp Mon Aug 5 06:59:26 2019
@@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/Frontend/LangStandard.h"
+#include "clang/Basic/LangStandard.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/ErrorHandling.h"
using namespace clang;
-using namespace clang::frontend;
-#define LANGSTANDARD(id, name, lang, desc, features) \
-static const LangStandard Lang_##id = { name, desc, features, InputKind::lang };
-#include "clang/Frontend/LangStandards.def"
+#define LANGSTANDARD(id, name, lang, desc, features) \
+ static const LangStandard Lang_##id = {name, desc, features, Language::lang};
+#include "clang/Basic/LangStandards.def"
const LangStandard &LangStandard::getLangStandardForKind(Kind K) {
switch (K) {
@@ -22,17 +21,21 @@ const LangStandard &LangStandard::getLan
llvm::report_fatal_error("getLangStandardForKind() on unspecified kind");
#define LANGSTANDARD(id, name, lang, desc, features) \
case lang_##id: return Lang_##id;
-#include "clang/Frontend/LangStandards.def"
+#include "clang/Basic/LangStandards.def"
}
llvm_unreachable("Invalid language kind!");
}
+LangStandard::Kind LangStandard::getLangKind(StringRef Name) {
+ return llvm::StringSwitch<Kind>(Name)
+#define LANGSTANDARD(id, name, lang, desc, features) .Case(name, lang_##id)
+#define LANGSTANDARD_ALIAS(id, alias) .Case(alias, lang_##id)
+#include "clang/Basic/LangStandards.def"
+ .Default(lang_unspecified);
+}
+
const LangStandard *LangStandard::getLangStandardForName(StringRef Name) {
- Kind K = llvm::StringSwitch<Kind>(Name)
-#define LANGSTANDARD(id, name, lang, desc, features) \
- .Case(name, lang_##id)
-#include "clang/Frontend/LangStandards.def"
- .Default(lang_unspecified);
+ Kind K = getLangKind(Name);
if (K == lang_unspecified)
return nullptr;
Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Mon Aug 5 06:59:26 2019
@@ -15,6 +15,7 @@
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclGroup.h"
#include "clang/Basic/FileManager.h"
+#include "clang/Basic/LangStandard.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/CodeGen/BackendUtil.h"
@@ -1014,7 +1015,7 @@ CodeGenAction::loadModule(MemoryBufferRe
void CodeGenAction::ExecuteAction() {
// If this is an IR file, we have to treat it specially.
- if (getCurrentFileKind().getLanguage() == InputKind::LLVM_IR) {
+ if (getCurrentFileKind().getLanguage() == Language::LLVM_IR) {
BackendAction BA = static_cast<BackendAction>(Act);
CompilerInstance &CI = getCompilerInstance();
std::unique_ptr<raw_pwrite_stream> OS =
Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Mon Aug 5 06:59:26 2019
@@ -30,6 +30,7 @@
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
+#include "clang/Basic/LangStandard.h"
#include "clang/Basic/Module.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
@@ -1153,7 +1154,7 @@ bool ASTUnit::Parse(std::shared_ptr<PCHC
InputKind::Source &&
"FIXME: AST inputs not yet supported here!");
assert(Clang->getFrontendOpts().Inputs[0].getKind().getLanguage() !=
- InputKind::LLVM_IR &&
+ Language::LLVM_IR &&
"IR inputs not support here!");
// Configure the various subsystems.
@@ -1586,7 +1587,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvoca
InputKind::Source &&
"FIXME: AST inputs not yet supported here!");
assert(Clang->getFrontendOpts().Inputs[0].getKind().getLanguage() !=
- InputKind::LLVM_IR &&
+ Language::LLVM_IR &&
"IR inputs not support here!");
// Configure the various subsystems.
@@ -2210,7 +2211,7 @@ void ASTUnit::CodeComplete(
InputKind::Source &&
"FIXME: AST inputs not yet supported here!");
assert(Clang->getFrontendOpts().Inputs[0].getKind().getLanguage() !=
- InputKind::LLVM_IR &&
+ Language::LLVM_IR &&
"IR inputs not support here!");
// Use the source and file managers that we were given.
@@ -2667,17 +2668,17 @@ bool ASTUnit::isModuleFile() const {
InputKind ASTUnit::getInputKind() const {
auto &LangOpts = getLangOpts();
- InputKind::Language Lang;
+ Language Lang;
if (LangOpts.OpenCL)
- Lang = InputKind::OpenCL;
+ Lang = Language::OpenCL;
else if (LangOpts.CUDA)
- Lang = InputKind::CUDA;
+ Lang = Language::CUDA;
else if (LangOpts.RenderScript)
- Lang = InputKind::RenderScript;
+ Lang = Language::RenderScript;
else if (LangOpts.CPlusPlus)
- Lang = LangOpts.ObjC ? InputKind::ObjCXX : InputKind::CXX;
+ Lang = LangOpts.ObjC ? Language::ObjCXX : Language::CXX;
else
- Lang = LangOpts.ObjC ? InputKind::ObjC : InputKind::C;
+ Lang = LangOpts.ObjC ? Language::ObjC : Language::C;
InputKind::Format Fmt = InputKind::Source;
if (LangOpts.getCompilingModule() == LangOptions::CMK_ModuleMap)
Modified: cfe/trunk/lib/Frontend/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CMakeLists.txt?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CMakeLists.txt (original)
+++ cfe/trunk/lib/Frontend/CMakeLists.txt Mon Aug 5 06:59:26 2019
@@ -32,7 +32,6 @@ add_clang_library(clangFrontend
HeaderIncludeGen.cpp
InitHeaderSearch.cpp
InitPreprocessor.cpp
- LangStandards.cpp
LayoutOverrideSource.cpp
LogDiagnosticPrinter.cpp
ModuleDependencyCollector.cpp
Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Mon Aug 5 06:59:26 2019
@@ -13,6 +13,7 @@
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/FileManager.h"
+#include "clang/Basic/LangStandard.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Stack.h"
#include "clang/Basic/TargetInfo.h"
@@ -1002,14 +1003,14 @@ bool CompilerInstance::ExecuteAction(Fro
/// Determine the appropriate source input kind based on language
/// options.
-static InputKind::Language getLanguageFromOptions(const LangOptions &LangOpts) {
+static Language getLanguageFromOptions(const LangOptions &LangOpts) {
if (LangOpts.OpenCL)
- return InputKind::OpenCL;
+ return Language::OpenCL;
if (LangOpts.CUDA)
- return InputKind::CUDA;
+ return Language::CUDA;
if (LangOpts.ObjC)
- return LangOpts.CPlusPlus ? InputKind::ObjCXX : InputKind::ObjC;
- return LangOpts.CPlusPlus ? InputKind::CXX : InputKind::C;
+ return LangOpts.CPlusPlus ? Language::ObjCXX : Language::ObjC;
+ return LangOpts.CPlusPlus ? Language::CXX : Language::C;
}
/// Compile a module file for the given module, using the options
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Aug 5 06:59:26 2019
@@ -18,6 +18,7 @@
#include "clang/Basic/FileSystemOptions.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
+#include "clang/Basic/LangStandard.h"
#include "clang/Basic/ObjCRuntime.h"
#include "clang/Basic/Sanitizers.h"
#include "clang/Basic/SourceLocation.h"
@@ -34,7 +35,6 @@
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Frontend/FrontendOptions.h"
#include "clang/Frontend/FrontendPluginRegistry.h"
-#include "clang/Frontend/LangStandard.h"
#include "clang/Frontend/MigratorOptions.h"
#include "clang/Frontend/PreprocessorOutputOptions.h"
#include "clang/Frontend/Utils.h"
@@ -122,7 +122,7 @@ CompilerInvocationBase::~CompilerInvocat
static unsigned getOptimizationLevel(ArgList &Args, InputKind IK,
DiagnosticsEngine &Diags) {
unsigned DefaultOpt = llvm::CodeGenOpt::None;
- if (IK.getLanguage() == InputKind::OpenCL && !Args.hasArg(OPT_cl_opt_disable))
+ if (IK.getLanguage() == Language::OpenCL && !Args.hasArg(OPT_cl_opt_disable))
DefaultOpt = llvm::CodeGenOpt::Default;
if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
@@ -944,7 +944,7 @@ static bool ParseCodeGenArgs(CodeGenOpti
Opts.LTOUnit = Args.hasFlag(OPT_flto_unit, OPT_fno_lto_unit, false);
Opts.EnableSplitLTOUnit = Args.hasArg(OPT_fsplit_lto_unit);
if (Arg *A = Args.getLastArg(OPT_fthinlto_index_EQ)) {
- if (IK.getLanguage() != InputKind::LLVM_IR)
+ if (IK.getLanguage() != Language::LLVM_IR)
Diags.Report(diag::err_drv_argument_only_allowed_with)
<< A->getAsString(Args) << "-x ir";
Opts.ThinLTOIndexFile = Args.getLastArgValue(OPT_fthinlto_index_EQ);
@@ -1285,7 +1285,7 @@ static bool ParseCodeGenArgs(CodeGenOpti
if (Opts.DiagnosticsWithHotness && !UsingProfile &&
// An IR file will contain PGO as metadata
- IK.getLanguage() != InputKind::LLVM_IR)
+ IK.getLanguage() != Language::LLVM_IR)
Diags.Report(diag::warn_drv_diagnostics_hotness_requires_pgo)
<< "-fdiagnostics-show-hotness";
@@ -1902,7 +1902,7 @@ static InputKind ParseFrontendArgs(Front
<< "ARC migration" << "ObjC migration";
}
- InputKind DashX(InputKind::Unknown);
+ InputKind DashX(Language::Unknown);
if (const Arg *A = Args.getLastArg(OPT_x)) {
StringRef XValue = A->getValue();
@@ -1915,33 +1915,33 @@ static InputKind ParseFrontendArgs(Front
// Principal languages.
DashX = llvm::StringSwitch<InputKind>(XValue)
- .Case("c", InputKind::C)
- .Case("cl", InputKind::OpenCL)
- .Case("cuda", InputKind::CUDA)
- .Case("hip", InputKind::HIP)
- .Case("c++", InputKind::CXX)
- .Case("objective-c", InputKind::ObjC)
- .Case("objective-c++", InputKind::ObjCXX)
- .Case("renderscript", InputKind::RenderScript)
- .Default(InputKind::Unknown);
+ .Case("c", Language::C)
+ .Case("cl", Language::OpenCL)
+ .Case("cuda", Language::CUDA)
+ .Case("hip", Language::HIP)
+ .Case("c++", Language::CXX)
+ .Case("objective-c", Language::ObjC)
+ .Case("objective-c++", Language::ObjCXX)
+ .Case("renderscript", Language::RenderScript)
+ .Default(Language::Unknown);
// "objc[++]-cpp-output" is an acceptable synonym for
// "objective-c[++]-cpp-output".
if (DashX.isUnknown() && Preprocessed && !IsHeaderFile && !ModuleMap)
DashX = llvm::StringSwitch<InputKind>(XValue)
- .Case("objc", InputKind::ObjC)
- .Case("objc++", InputKind::ObjCXX)
- .Default(InputKind::Unknown);
+ .Case("objc", Language::ObjC)
+ .Case("objc++", Language::ObjCXX)
+ .Default(Language::Unknown);
// Some special cases cannot be combined with suffixes.
if (DashX.isUnknown() && !Preprocessed && !ModuleMap && !IsHeaderFile)
DashX = llvm::StringSwitch<InputKind>(XValue)
- .Case("cpp-output", InputKind(InputKind::C).getPreprocessed())
- .Case("assembler-with-cpp", InputKind::Asm)
+ .Case("cpp-output", InputKind(Language::C).getPreprocessed())
+ .Case("assembler-with-cpp", Language::Asm)
.Cases("ast", "pcm",
- InputKind(InputKind::Unknown, InputKind::Precompiled))
- .Case("ir", InputKind::LLVM_IR)
- .Default(InputKind::Unknown);
+ InputKind(Language::Unknown, InputKind::Precompiled))
+ .Case("ir", Language::LLVM_IR)
+ .Default(Language::Unknown);
if (DashX.isUnknown())
Diags.Report(diag::err_drv_invalid_value)
@@ -1965,7 +1965,7 @@ static InputKind ParseFrontendArgs(Front
StringRef(Inputs[i]).rsplit('.').second);
// FIXME: Warn on this?
if (IK.isUnknown())
- IK = InputKind::C;
+ IK = Language::C;
// FIXME: Remove this hack.
if (i == 0)
DashX = IK;
@@ -2139,7 +2139,7 @@ void CompilerInvocation::setLangDefaults
// FIXME: Perhaps a better model would be for a single source file to have
// multiple language standards (C / C++ std, ObjC std, OpenCL std, OpenMP std)
// simultaneously active?
- if (IK.getLanguage() == InputKind::Asm) {
+ if (IK.getLanguage() == Language::Asm) {
Opts.AsmPreprocessor = 1;
} else if (IK.isObjectiveC()) {
Opts.ObjC = 1;
@@ -2148,17 +2148,17 @@ void CompilerInvocation::setLangDefaults
if (LangStd == LangStandard::lang_unspecified) {
// Based on the base language, pick one.
switch (IK.getLanguage()) {
- case InputKind::Unknown:
- case InputKind::LLVM_IR:
+ case Language::Unknown:
+ case Language::LLVM_IR:
llvm_unreachable("Invalid input kind!");
- case InputKind::OpenCL:
+ case Language::OpenCL:
LangStd = LangStandard::lang_opencl10;
break;
- case InputKind::CUDA:
+ case Language::CUDA:
LangStd = LangStandard::lang_cuda;
break;
- case InputKind::Asm:
- case InputKind::C:
+ case Language::Asm:
+ case Language::C:
#if defined(CLANG_DEFAULT_STD_C)
LangStd = CLANG_DEFAULT_STD_C;
#else
@@ -2169,25 +2169,25 @@ void CompilerInvocation::setLangDefaults
LangStd = LangStandard::lang_gnu11;
#endif
break;
- case InputKind::ObjC:
+ case Language::ObjC:
#if defined(CLANG_DEFAULT_STD_C)
LangStd = CLANG_DEFAULT_STD_C;
#else
LangStd = LangStandard::lang_gnu11;
#endif
break;
- case InputKind::CXX:
- case InputKind::ObjCXX:
+ case Language::CXX:
+ case Language::ObjCXX:
#if defined(CLANG_DEFAULT_STD_CXX)
LangStd = CLANG_DEFAULT_STD_CXX;
#else
LangStd = LangStandard::lang_gnucxx14;
#endif
break;
- case InputKind::RenderScript:
+ case Language::RenderScript:
LangStd = LangStandard::lang_c99;
break;
- case InputKind::HIP:
+ case Language::HIP:
LangStd = LangStandard::lang_hip;
break;
}
@@ -2244,13 +2244,13 @@ void CompilerInvocation::setLangDefaults
}
}
- Opts.HIP = IK.getLanguage() == InputKind::HIP;
- Opts.CUDA = IK.getLanguage() == InputKind::CUDA || Opts.HIP;
+ Opts.HIP = IK.getLanguage() == Language::HIP;
+ Opts.CUDA = IK.getLanguage() == Language::CUDA || Opts.HIP;
if (Opts.CUDA)
// Set default FP_CONTRACT to FAST.
Opts.setDefaultFPContractMode(LangOptions::FPC_Fast);
- Opts.RenderScript = IK.getLanguage() == InputKind::RenderScript;
+ Opts.RenderScript = IK.getLanguage() == Language::RenderScript;
if (Opts.RenderScript) {
Opts.NativeHalfType = 1;
Opts.NativeHalfArgsAndReturns = 1;
@@ -2298,32 +2298,31 @@ static Visibility parseVisibility(Arg *a
static bool IsInputCompatibleWithStandard(InputKind IK,
const LangStandard &S) {
switch (IK.getLanguage()) {
- case InputKind::Unknown:
- case InputKind::LLVM_IR:
+ case Language::Unknown:
+ case Language::LLVM_IR:
llvm_unreachable("should not parse language flags for this input");
- case InputKind::C:
- case InputKind::ObjC:
- case InputKind::RenderScript:
- return S.getLanguage() == InputKind::C;
-
- case InputKind::OpenCL:
- return S.getLanguage() == InputKind::OpenCL;
-
- case InputKind::CXX:
- case InputKind::ObjCXX:
- return S.getLanguage() == InputKind::CXX;
+ case Language::C:
+ case Language::ObjC:
+ case Language::RenderScript:
+ return S.getLanguage() == Language::C;
+
+ case Language::OpenCL:
+ return S.getLanguage() == Language::OpenCL;
+
+ case Language::CXX:
+ case Language::ObjCXX:
+ return S.getLanguage() == Language::CXX;
- case InputKind::CUDA:
+ case Language::CUDA:
// FIXME: What -std= values should be permitted for CUDA compilations?
- return S.getLanguage() == InputKind::CUDA ||
- S.getLanguage() == InputKind::CXX;
+ return S.getLanguage() == Language::CUDA ||
+ S.getLanguage() == Language::CXX;
- case InputKind::HIP:
- return S.getLanguage() == InputKind::CXX ||
- S.getLanguage() == InputKind::HIP;
+ case Language::HIP:
+ return S.getLanguage() == Language::CXX || S.getLanguage() == Language::HIP;
- case InputKind::Asm:
+ case Language::Asm:
// Accept (and ignore) all -std= values.
// FIXME: The -std= value is not ignored; it affects the tokenization
// and preprocessing rules if we're preprocessing this asm input.
@@ -2336,29 +2335,29 @@ static bool IsInputCompatibleWithStandar
/// Get language name for given input kind.
static const StringRef GetInputKindName(InputKind IK) {
switch (IK.getLanguage()) {
- case InputKind::C:
+ case Language::C:
return "C";
- case InputKind::ObjC:
+ case Language::ObjC:
return "Objective-C";
- case InputKind::CXX:
+ case Language::CXX:
return "C++";
- case InputKind::ObjCXX:
+ case Language::ObjCXX:
return "Objective-C++";
- case InputKind::OpenCL:
+ case Language::OpenCL:
return "OpenCL";
- case InputKind::CUDA:
+ case Language::CUDA:
return "CUDA";
- case InputKind::RenderScript:
+ case Language::RenderScript:
return "RenderScript";
- case InputKind::HIP:
+ case Language::HIP:
return "HIP";
- case InputKind::Asm:
+ case Language::Asm:
return "Asm";
- case InputKind::LLVM_IR:
+ case Language::LLVM_IR:
return "LLVM IR";
- case InputKind::Unknown:
+ case Language::Unknown:
break;
}
llvm_unreachable("unknown input language");
@@ -2371,13 +2370,7 @@ static void ParseLangArgs(LangOptions &O
// FIXME: Cleanup per-file based stuff.
LangStandard::Kind LangStd = LangStandard::lang_unspecified;
if (const Arg *A = Args.getLastArg(OPT_std_EQ)) {
- LangStd = llvm::StringSwitch<LangStandard::Kind>(A->getValue())
-#define LANGSTANDARD(id, name, lang, desc, features) \
- .Case(name, LangStandard::lang_##id)
-#define LANGSTANDARD_ALIAS(id, alias) \
- .Case(alias, LangStandard::lang_##id)
-#include "clang/Frontend/LangStandards.def"
- .Default(LangStandard::lang_unspecified);
+ LangStd = LangStandard::getLangKind(A->getValue());
if (LangStd == LangStandard::lang_unspecified) {
Diags.Report(diag::err_drv_invalid_value)
<< A->getAsString(Args) << A->getValue();
@@ -2395,13 +2388,13 @@ static void ParseLangArgs(LangOptions &O
#define LANGSTANDARD_ALIAS(id, alias) \
if (KindValue == LangStandard::lang_##id) ++NumAliases;
#define LANGSTANDARD_ALIAS_DEPR(id, alias)
-#include "clang/Frontend/LangStandards.def"
+#include "clang/Basic/LangStandards.def"
Diag << NumAliases;
#define LANGSTANDARD(id, name, lang, desc, features)
#define LANGSTANDARD_ALIAS(id, alias) \
if (KindValue == LangStandard::lang_##id) Diag << alias;
#define LANGSTANDARD_ALIAS_DEPR(id, alias)
-#include "clang/Frontend/LangStandards.def"
+#include "clang/Basic/LangStandards.def"
}
}
} else {
@@ -3391,7 +3384,7 @@ bool CompilerInvocation::CreateFromArgs(
Res.getFileSystemOpts().WorkingDir);
llvm::Triple T(Res.getTargetOpts().Triple);
if (DashX.getFormat() == InputKind::Precompiled ||
- DashX.getLanguage() == InputKind::LLVM_IR) {
+ DashX.getLanguage() == Language::LLVM_IR) {
// ObjCAAutoRefCount and Sanitize LangOpts are used to setup the
// PassManager in BackendUtil.cpp. They need to be initializd no matter
// what the input type is.
@@ -3405,7 +3398,7 @@ bool CompilerInvocation::CreateFromArgs(
Diags, LangOpts.Sanitize);
} else {
// Other LangOpts are only initialized when the input is not AST or LLVM IR.
- // FIXME: Should we really be calling this for an InputKind::Asm input?
+ // FIXME: Should we really be calling this for an Language::Asm input?
ParseLangArgs(LangOpts, Args, DashX, Res.getTargetOpts(),
Res.getPreprocessorOpts(), Diags);
if (Res.getFrontendOpts().ProgramAction == frontend::RewriteObjC)
Modified: cfe/trunk/lib/Frontend/FrontendAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendAction.cpp Mon Aug 5 06:59:26 2019
@@ -10,6 +10,7 @@
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclGroup.h"
+#include "clang/Basic/LangStandard.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendDiagnostic.h"
@@ -683,7 +684,7 @@ bool FrontendAction::BeginSourceFile(Com
CI.getSourceManager().setAllFilesAreTransient(true);
// IR files bypass the rest of initialization.
- if (Input.getKind().getLanguage() == InputKind::LLVM_IR) {
+ if (Input.getKind().getLanguage() == Language::LLVM_IR) {
assert(hasIRSupport() &&
"This action does not have IR file support!");
Modified: cfe/trunk/lib/Frontend/FrontendActions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendActions.cpp?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendActions.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendActions.cpp Mon Aug 5 06:59:26 2019
@@ -9,6 +9,7 @@
#include "clang/Frontend/FrontendActions.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/Basic/FileManager.h"
+#include "clang/Basic/LangStandard.h"
#include "clang/Frontend/ASTConsumers.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendDiagnostic.h"
@@ -832,19 +833,19 @@ void PrintPreprocessedAction::ExecuteAct
void PrintPreambleAction::ExecuteAction() {
switch (getCurrentFileKind().getLanguage()) {
- case InputKind::C:
- case InputKind::CXX:
- case InputKind::ObjC:
- case InputKind::ObjCXX:
- case InputKind::OpenCL:
- case InputKind::CUDA:
- case InputKind::HIP:
+ case Language::C:
+ case Language::CXX:
+ case Language::ObjC:
+ case Language::ObjCXX:
+ case Language::OpenCL:
+ case Language::CUDA:
+ case Language::HIP:
break;
- case InputKind::Unknown:
- case InputKind::Asm:
- case InputKind::LLVM_IR:
- case InputKind::RenderScript:
+ case Language::Unknown:
+ case Language::Asm:
+ case Language::LLVM_IR:
+ case Language::RenderScript:
// We can't do anything with these.
return;
}
Modified: cfe/trunk/lib/Frontend/FrontendOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendOptions.cpp?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendOptions.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendOptions.cpp Mon Aug 5 06:59:26 2019
@@ -7,28 +7,29 @@
//===----------------------------------------------------------------------===//
#include "clang/Frontend/FrontendOptions.h"
+#include "clang/Basic/LangStandard.h"
#include "llvm/ADT/StringSwitch.h"
using namespace clang;
InputKind FrontendOptions::getInputKindForExtension(StringRef Extension) {
return llvm::StringSwitch<InputKind>(Extension)
- .Cases("ast", "pcm", InputKind(InputKind::Unknown, InputKind::Precompiled))
- .Case("c", InputKind::C)
- .Cases("S", "s", InputKind::Asm)
- .Case("i", InputKind(InputKind::C).getPreprocessed())
- .Case("ii", InputKind(InputKind::CXX).getPreprocessed())
- .Case("cui", InputKind(InputKind::CUDA).getPreprocessed())
- .Case("m", InputKind::ObjC)
- .Case("mi", InputKind(InputKind::ObjC).getPreprocessed())
- .Cases("mm", "M", InputKind::ObjCXX)
- .Case("mii", InputKind(InputKind::ObjCXX).getPreprocessed())
- .Cases("C", "cc", "cp", InputKind::CXX)
- .Cases("cpp", "CPP", "c++", "cxx", "hpp", InputKind::CXX)
- .Case("cppm", InputKind::CXX)
- .Case("iim", InputKind(InputKind::CXX).getPreprocessed())
- .Case("cl", InputKind::OpenCL)
- .Case("cu", InputKind::CUDA)
- .Cases("ll", "bc", InputKind::LLVM_IR)
- .Default(InputKind::Unknown);
+ .Cases("ast", "pcm", InputKind(Language::Unknown, InputKind::Precompiled))
+ .Case("c", Language::C)
+ .Cases("S", "s", Language::Asm)
+ .Case("i", InputKind(Language::C).getPreprocessed())
+ .Case("ii", InputKind(Language::CXX).getPreprocessed())
+ .Case("cui", InputKind(Language::CUDA).getPreprocessed())
+ .Case("m", Language::ObjC)
+ .Case("mi", InputKind(Language::ObjC).getPreprocessed())
+ .Cases("mm", "M", Language::ObjCXX)
+ .Case("mii", InputKind(Language::ObjCXX).getPreprocessed())
+ .Cases("C", "cc", "cp", Language::CXX)
+ .Cases("cpp", "CPP", "c++", "cxx", "hpp", Language::CXX)
+ .Case("cppm", Language::CXX)
+ .Case("iim", InputKind(Language::CXX).getPreprocessed())
+ .Case("cl", Language::OpenCL)
+ .Case("cu", Language::CUDA)
+ .Cases("ll", "bc", Language::LLVM_IR)
+ .Default(Language::Unknown);
}
Removed: cfe/trunk/lib/Frontend/LangStandards.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/LangStandards.cpp?rev=367863&view=auto
==============================================================================
--- cfe/trunk/lib/Frontend/LangStandards.cpp (original)
+++ cfe/trunk/lib/Frontend/LangStandards.cpp (removed)
@@ -1,42 +0,0 @@
-//===--- LangStandards.cpp - Language Standard Definitions ----------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Frontend/LangStandard.h"
-#include "llvm/ADT/StringSwitch.h"
-#include "llvm/Support/ErrorHandling.h"
-using namespace clang;
-using namespace clang::frontend;
-
-#define LANGSTANDARD(id, name, lang, desc, features) \
-static const LangStandard Lang_##id = { name, desc, features, InputKind::lang };
-#include "clang/Frontend/LangStandards.def"
-
-const LangStandard &LangStandard::getLangStandardForKind(Kind K) {
- switch (K) {
- case lang_unspecified:
- llvm::report_fatal_error("getLangStandardForKind() on unspecified kind");
-#define LANGSTANDARD(id, name, lang, desc, features) \
- case lang_##id: return Lang_##id;
-#include "clang/Frontend/LangStandards.def"
- }
- llvm_unreachable("Invalid language kind!");
-}
-
-const LangStandard *LangStandard::getLangStandardForName(StringRef Name) {
- Kind K = llvm::StringSwitch<Kind>(Name)
-#define LANGSTANDARD(id, name, lang, desc, features) \
- .Case(name, lang_##id)
-#include "clang/Frontend/LangStandards.def"
- .Default(lang_unspecified);
- if (K == lang_unspecified)
- return nullptr;
-
- return &getLangStandardForKind(K);
-}
-
-
Modified: cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp (original)
+++ cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp Mon Aug 5 06:59:26 2019
@@ -12,6 +12,7 @@
#include "clang/Frontend/PrecompiledPreamble.h"
#include "clang/AST/DeclObjC.h"
+#include "clang/Basic/LangStandard.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/CompilerInvocation.h"
@@ -303,7 +304,7 @@ llvm::ErrorOr<PrecompiledPreamble> Preco
Clang->getFrontendOpts().Inputs[0].getKind().getFormat() !=
InputKind::Source ||
Clang->getFrontendOpts().Inputs[0].getKind().getLanguage() ==
- InputKind::LLVM_IR) {
+ Language::LLVM_IR) {
return BuildPreambleError::BadInputs;
}
Modified: cfe/trunk/lib/Frontend/Rewrite/FrontendActions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Rewrite/FrontendActions.cpp?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/Rewrite/FrontendActions.cpp (original)
+++ cfe/trunk/lib/Frontend/Rewrite/FrontendActions.cpp Mon Aug 5 06:59:26 2019
@@ -9,6 +9,7 @@
#include "clang/Rewrite/Frontend/FrontendActions.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/Basic/CharInfo.h"
+#include "clang/Basic/LangStandard.h"
#include "clang/Config/config.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendActions.h"
@@ -250,7 +251,7 @@ public:
Instance.getFrontendOpts().DisableFree = false;
Instance.getFrontendOpts().Inputs.clear();
Instance.getFrontendOpts().Inputs.emplace_back(
- Filename, InputKind(InputKind::Unknown, InputKind::Precompiled));
+ Filename, InputKind(Language::Unknown, InputKind::Precompiled));
Instance.getFrontendOpts().ModuleFiles.clear();
Instance.getFrontendOpts().ModuleMapFiles.clear();
// Don't recursively rewrite imports. We handle them all at the top level.
Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/ModelInjector.cpp?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Frontend/ModelInjector.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/ModelInjector.cpp Mon Aug 5 06:59:26 2019
@@ -9,6 +9,7 @@
#include "ModelInjector.h"
#include "clang/AST/Decl.h"
#include "clang/Basic/IdentifierTable.h"
+#include "clang/Basic/LangStandard.h"
#include "clang/Basic/Stack.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Frontend/CompilerInstance.h"
@@ -65,7 +66,7 @@ void ModelInjector::onBodySynthesis(cons
auto Invocation = std::make_shared<CompilerInvocation>(CI.getInvocation());
FrontendOptions &FrontendOpts = Invocation->getFrontendOpts();
- InputKind IK = InputKind::CXX; // FIXME
+ InputKind IK = Language::CXX; // FIXME
FrontendOpts.Inputs.clear();
FrontendOpts.Inputs.emplace_back(fileName, IK);
FrontendOpts.DisableFree = true;
Modified: cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp (original)
+++ cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp Mon Aug 5 06:59:26 2019
@@ -42,9 +42,9 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/Basic/LangStandard.h"
#include "clang/Driver/Options.h"
#include "clang/Driver/Types.h"
-#include "clang/Frontend/LangStandard.h"
#include "clang/Tooling/CompilationDatabase.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Optional.h"
@@ -249,15 +249,15 @@ private:
}
// Map the language from the --std flag to that of the -x flag.
- static types::ID toType(InputKind::Language Lang) {
+ static types::ID toType(Language Lang) {
switch (Lang) {
- case InputKind::C:
+ case Language::C:
return types::TY_C;
- case InputKind::CXX:
+ case Language::CXX:
return types::TY_CXX;
- case InputKind::ObjC:
+ case Language::ObjC:
return types::TY_ObjC;
- case InputKind::ObjCXX:
+ case Language::ObjCXX:
return types::TY_ObjCXX;
default:
return types::TY_INVALID;
@@ -297,15 +297,8 @@ private:
// Try to interpret the argument as '-std='.
Optional<LangStandard::Kind> tryParseStdArg(const llvm::opt::Arg &Arg) {
using namespace driver::options;
- if (Arg.getOption().matches(ClangCLMode ? OPT__SLASH_std : OPT_std_EQ)) {
- return llvm::StringSwitch<LangStandard::Kind>(Arg.getValue())
-#define LANGSTANDARD(id, name, lang, ...) .Case(name, LangStandard::lang_##id)
-#define LANGSTANDARD_ALIAS(id, alias) .Case(alias, LangStandard::lang_##id)
-#include "clang/Frontend/LangStandards.def"
-#undef LANGSTANDARD_ALIAS
-#undef LANGSTANDARD
- .Default(LangStandard::lang_unspecified);
- }
+ if (Arg.getOption().matches(ClangCLMode ? OPT__SLASH_std : OPT_std_EQ))
+ return LangStandard::getLangKind(Arg.getValue());
return None;
}
};
Modified: cfe/trunk/unittests/Frontend/CodeGenActionTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Frontend/CodeGenActionTest.cpp?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/unittests/Frontend/CodeGenActionTest.cpp (original)
+++ cfe/trunk/unittests/Frontend/CodeGenActionTest.cpp Mon Aug 5 06:59:26 2019
@@ -10,8 +10,9 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/CodeGen/BackendUtil.h"
#include "clang/CodeGen/CodeGenAction.h"
+#include "clang/Basic/LangStandard.h"
+#include "clang/CodeGen/BackendUtil.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/PreprocessorOptions.h"
#include "gtest/gtest.h"
@@ -45,7 +46,7 @@ TEST(CodeGenTest, TestNullCodeGen) {
"test.cc",
MemoryBuffer::getMemBuffer("").release());
Invocation->getFrontendOpts().Inputs.push_back(
- FrontendInputFile("test.cc", InputKind::CXX));
+ FrontendInputFile("test.cc", Language::CXX));
Invocation->getFrontendOpts().ProgramAction = EmitLLVM;
Invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu";
CompilerInstance Compiler;
Modified: cfe/trunk/unittests/Frontend/FrontendActionTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Frontend/FrontendActionTest.cpp?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/unittests/Frontend/FrontendActionTest.cpp (original)
+++ cfe/trunk/unittests/Frontend/FrontendActionTest.cpp Mon Aug 5 06:59:26 2019
@@ -10,6 +10,7 @@
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/RecursiveASTVisitor.h"
+#include "clang/Basic/LangStandard.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/CompilerInvocation.h"
#include "clang/Frontend/FrontendActions.h"
@@ -84,7 +85,7 @@ TEST(ASTFrontendAction, Sanity) {
"test.cc",
MemoryBuffer::getMemBuffer("int main() { float x; }").release());
invocation->getFrontendOpts().Inputs.push_back(
- FrontendInputFile("test.cc", InputKind::CXX));
+ FrontendInputFile("test.cc", Language::CXX));
invocation->getFrontendOpts().ProgramAction = frontend::ParseSyntaxOnly;
invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu";
CompilerInstance compiler;
@@ -104,7 +105,7 @@ TEST(ASTFrontendAction, IncrementalParsi
"test.cc",
MemoryBuffer::getMemBuffer("int main() { float x; }").release());
invocation->getFrontendOpts().Inputs.push_back(
- FrontendInputFile("test.cc", InputKind::CXX));
+ FrontendInputFile("test.cc", Language::CXX));
invocation->getFrontendOpts().ProgramAction = frontend::ParseSyntaxOnly;
invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu";
CompilerInstance compiler;
@@ -131,7 +132,7 @@ TEST(ASTFrontendAction, LateTemplateIncr
"};\n"
"B<char> c() { return B<char>(); }\n").release());
invocation->getFrontendOpts().Inputs.push_back(
- FrontendInputFile("test.cc", InputKind::CXX));
+ FrontendInputFile("test.cc", Language::CXX));
invocation->getFrontendOpts().ProgramAction = frontend::ParseSyntaxOnly;
invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu";
CompilerInstance compiler;
@@ -177,7 +178,7 @@ TEST(PreprocessorFrontendAction, EndSour
"test.cc",
MemoryBuffer::getMemBuffer("int main() { float x; }").release());
Invocation->getFrontendOpts().Inputs.push_back(
- FrontendInputFile("test.cc", InputKind::CXX));
+ FrontendInputFile("test.cc", Language::CXX));
Invocation->getFrontendOpts().ProgramAction = frontend::ParseSyntaxOnly;
Invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu";
CompilerInstance Compiler;
@@ -238,7 +239,7 @@ TEST(ASTFrontendAction, ExternalSemaSour
"int main() { foo(); }")
.release());
Invocation->getFrontendOpts().Inputs.push_back(
- FrontendInputFile("test.cc", InputKind::CXX));
+ FrontendInputFile("test.cc", Language::CXX));
Invocation->getFrontendOpts().ProgramAction = frontend::ParseSyntaxOnly;
Invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu";
CompilerInstance Compiler;
@@ -270,7 +271,7 @@ TEST(GeneratePCHFrontendAction, CacheGen
"test.h",
MemoryBuffer::getMemBuffer("int foo(void) { return 1; }\n").release());
Invocation->getFrontendOpts().Inputs.push_back(
- FrontendInputFile("test.h", InputKind::C));
+ FrontendInputFile("test.h", Language::C));
Invocation->getFrontendOpts().OutputFile = StringRef(PCHFilename);
Invocation->getFrontendOpts().ProgramAction = frontend::GeneratePCH;
Invocation->getTargetOpts().Triple = "x86_64-apple-darwin19.0.0";
Modified: cfe/trunk/unittests/Frontend/OutputStreamTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Frontend/OutputStreamTest.cpp?rev=367864&r1=367863&r2=367864&view=diff
==============================================================================
--- cfe/trunk/unittests/Frontend/OutputStreamTest.cpp (original)
+++ cfe/trunk/unittests/Frontend/OutputStreamTest.cpp Mon Aug 5 06:59:26 2019
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/Basic/LangStandard.h"
#include "clang/CodeGen/BackendUtil.h"
#include "clang/CodeGen/CodeGenAction.h"
#include "clang/Frontend/CompilerInstance.h"
@@ -24,7 +25,7 @@ TEST(FrontendOutputTests, TestOutputStre
Invocation->getPreprocessorOpts().addRemappedFile(
"test.cc", MemoryBuffer::getMemBuffer("").release());
Invocation->getFrontendOpts().Inputs.push_back(
- FrontendInputFile("test.cc", InputKind::CXX));
+ FrontendInputFile("test.cc", Language::CXX));
Invocation->getFrontendOpts().ProgramAction = EmitBC;
Invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu";
CompilerInstance Compiler;
More information about the cfe-commits
mailing list