aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 29723b5..17f624e 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -253,6 +253,8 @@ static void DefineExactWidthIntType(const LangOptions &LangOpts,
StringRef ConstSuffix(TI.getTypeConstantSuffix(Ty));
Builder.defineMacro(Prefix + Twine(TypeWidth) + "_C_SUFFIX__", ConstSuffix);
+ Builder.defineMacro(Prefix + Twine(TypeWidth) + "_C(c)",
+ ConstSuffix.size() ? Twine("c##") + ConstSuffix : "c");
}
static void DefineExactWidthIntTypeSize(TargetInfo::IntType Ty,
@@ -1164,12 +1166,16 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
DefineType("__INTMAX_TYPE__", TI.getIntMaxType(), Builder);
DefineFmt(LangOpts, "__INTMAX", TI.getIntMaxType(), TI, Builder);
- Builder.defineMacro("__INTMAX_C_SUFFIX__",
- TI.getTypeConstantSuffix(TI.getIntMaxType()));
+ StringRef ConstSuffix(TI.getTypeConstantSuffix(TI.getIntMaxType()));
+ Builder.defineMacro("__INTMAX_C_SUFFIX__", ConstSuffix);
+ Builder.defineMacro("__INTMAX_C(c)",
+ ConstSuffix.size() ? Twine("c##") + ConstSuffix : "c");
DefineType("__UINTMAX_TYPE__", TI.getUIntMaxType(), Builder);
DefineFmt(LangOpts, "__UINTMAX", TI.getUIntMaxType(), TI, Builder);
- Builder.defineMacro("__UINTMAX_C_SUFFIX__",
- TI.getTypeConstantSuffix(TI.getUIntMaxType()));
+ ConstSuffix = TI.getTypeConstantSuffix(TI.getUIntMaxType());
+ Builder.defineMacro("__UINTMAX_C_SUFFIX__", ConstSuffix);
+ Builder.defineMacro("__UINTMAX_C(c)",
+ ConstSuffix.size() ? Twine("c##") + ConstSuffix : "c");
DefineType("__PTRDIFF_TYPE__", TI.getPtrDiffType(LangAS::Default), Builder);
DefineFmt(LangOpts, "__PTRDIFF", TI.getPtrDiffType(LangAS::Default), TI,
Builder);