Skip to content

Commit d81fd36

Browse files
committed
switch to an HLSL lang opt for now
1 parent 158ea9b commit d81fd36

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

clang/include/clang/Basic/LangOptions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ ENUM_LANGOPT(HLSLVersion, HLSLLangStd, 16, HLSL_Unset, NotCompatible, "HLSL Vers
243243
LANGOPT(HLSLStrictAvailability, 1, 0, NotCompatible,
244244
"Strict availability diagnostic mode for HLSL built-in functions.")
245245
LANGOPT(HLSLSpvUseUnknownImageFormat, 1, 0, NotCompatible, "For storage images and texel buffers, sets the default format to 'Unknown' when not specified via the `vk::image_format` attribute. If this option is not used, the format is inferred from the resource's data type.")
246-
VALUE_LANGOPT(MaxMatrixDimension, 32, (1 << 20) - 1, NotCompatible, "maximum allowed matrix dimension")
246+
VALUE_LANGOPT(HLSLMaxMatrixDimension, 32, 4, NotCompatible, "maximum allowed matrix dimension")
247247

248248
LANGOPT(CUDAIsDevice , 1, 0, NotCompatible, "compiling for CUDA device")
249249
LANGOPT(CUDAAllowVariadicFunctions, 1, 0, NotCompatible, "allowing variadic functions in CUDA device code")

clang/lib/Basic/LangOptions.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,8 @@ void LangOptions::setLangDefaults(LangOptions &Opts, Language Lang,
131131
Opts.NamedLoops = Std.isC2y();
132132

133133
Opts.HLSL = Lang == Language::HLSL;
134-
if (Opts.HLSL) {
135-
if (Opts.IncludeDefaultHeader)
136-
Includes.push_back("hlsl.h");
137-
// Set maximum matrix dimension to 4 for HLSL
138-
Opts.MaxMatrixDimension = 4;
139-
}
134+
if (Opts.HLSL && Opts.IncludeDefaultHeader)
135+
Includes.push_back("hlsl.h");
140136

141137
// Set OpenCL Version.
142138
Opts.OpenCL = Std.isOpenCL();

clang/lib/Sema/HLSLExternalSemaSource.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void HLSLExternalSemaSource::defineHLSLMatrixAlias() {
159159
SourceLocation(), ColsParam));
160160
TemplateParams.emplace_back(ColsParam);
161161

162-
const unsigned MaxMatDim = SemaPtr->getLangOpts().MaxMatrixDimension;
162+
const unsigned MaxMatDim = SemaPtr->getLangOpts().HLSLMaxMatrixDimension;
163163
auto *MaxRow = IntegerLiteral::Create(
164164
AST, llvm::APInt(AST.getIntWidth(AST.IntTy), MaxMatDim), AST.IntTy,
165165
SourceLocation());

0 commit comments

Comments
 (0)