aaron.ballman added inline comments.
================ Comment at: clang/lib/Sema/Sema.cpp:1494-1505 +Decl *Sema::getCurLocalScopeDecl() { + if (const BlockScopeInfo *BSI = getCurBlock()) + return BSI->TheDecl; + else if (const LambdaScopeInfo *LSI = getCurLambda()) + return LSI->CallOperator; + else if (const CapturedRegionScopeInfo *CSI = getCurCapturedRegion()) + return CSI->TheCapturedDecl; ---------------- RIscRIpt wrote: > aaron.ballman wrote: > > Made the function `const` because it's not writing to any fields, removed > > `else` because of preceding `return`. > I would love to, and I tried. But unfortunately it's not possible without > introducing more changes: all the member functions (except > `getCurFunctionOrMethodDecl()`) are non-const. > Removed `else`. Ah, thanks! ================ Comment at: clang/lib/Sema/SemaExpr.cpp:2034-2035 + // StringToks is read-only, we need backstorage for expanded macros + std::vector<Token> ExpandedToks; + if (getLangOpts().MicrosoftExt) ---------------- ================ Comment at: clang/lib/Sema/SemaExpr.cpp:1998-2000 + if (isa<TranslationUnitDecl>(currentDecl)) { + Diag(Tok.getLocation(), diag::ext_predef_outside_function); + } ---------------- RIscRIpt wrote: > aaron.ballman wrote: > > This will miss the diagnostic if the current declaration is a namespace > > instead of at file scope, right? > Right. But `getCurLocalScopeDecl()` returns function scope at most. See Note > in a code comment above. Ah, exactly right, thank you! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153914/new/ https://reviews.llvm.org/D153914 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits